[pypy-commit] pypy gc_no_cleanup_nursery: Only emit clear_array_contents for arrays that are allocated with zero=True,

fijal noreply at buildbot.pypy.org
Thu Sep 25 10:11:04 CEST 2014


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: gc_no_cleanup_nursery
Changeset: r73687:0157e90c1899
Date: 2014-09-25 10:08 +0200
http://bitbucket.org/pypy/pypy/changeset/0157e90c1899/

Log:	Only emit clear_array_contents for arrays that are allocated with
	zero=True, but with no GC ptrs in them

diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py
--- a/rpython/jit/codewriter/jtransform.py
+++ b/rpython/jit/codewriter/jtransform.py
@@ -615,7 +615,14 @@
             op1 = SpaceOperation('new_array', [op.args[2], arraydescr],
                                  op.result)
             if op.args[1].value.get('zero', False):
-                return self.zero_contents([op1], op.result, ARRAY)
+                # complicated logic here - we only need to emit zero_contents
+                # in case this is an array of non-gcptrs and non-structs
+                if isinstance(ARRAY.OF, lltype.Ptr) and ARRAY.OF._needsgc():
+                    pass
+                elif isinstance(ARRAY.OF, lltype.Struct):
+                    pass
+                else:
+                    return self.zero_contents([op1], op.result, ARRAY)
             return op1
 
     def zero_contents(self, ops, v, TYPE):


More information about the pypy-commit mailing list