[pypy-commit] pypy stmgc-c7: Of course the minimal size has to be 16 in case we actually hit the slow-path

Raemi noreply at buildbot.pypy.org
Wed May 7 15:12:27 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: stmgc-c7
Changeset: r71371:4169f1423e3d
Date: 2014-05-07 14:33 +0200
http://bitbucket.org/pypy/pypy/changeset/4169f1423e3d/

Log:	Of course the minimal size has to be 16 in case we actually hit the
	slow-path that asserts a size >= 16. So we can as well just use
	gen_malloc_nursery()

diff --git a/rpython/jit/backend/llsupport/stmrewrite.py b/rpython/jit/backend/llsupport/stmrewrite.py
--- a/rpython/jit/backend/llsupport/stmrewrite.py
+++ b/rpython/jit/backend/llsupport/stmrewrite.py
@@ -123,18 +123,12 @@
             # do a fake allocation since this is needed to check
             # for requested safe-points:
             self.does_any_allocation = True
-            self.emitting_an_operation_that_can_collect()
 
-            size = WORD
+            # minimum size for the slowpath of MALLOC_NURSERY:
+            size = self.gc_ll_descr.minimal_size_in_nursery
             v_result = BoxPtr()
             assert self._op_malloc_nursery is None # no ongoing allocation
-            malloc_op = ResOperation(rop.CALL_MALLOC_NURSERY,
-                              [ConstInt(size)], v_result)
-            self._op_malloc_nursery = malloc_op
-            self.newops.append(malloc_op)
-            self._previous_size = size
-            self._v_last_malloced_nursery = v_result
-            self.write_barrier_applied[v_result] = None
+            self.gen_malloc_nursery(size, v_result)
 
         self.newops.append(op)
 
diff --git a/rpython/jit/backend/llsupport/test/test_stmrewrite.py b/rpython/jit/backend/llsupport/test/test_stmrewrite.py
--- a/rpython/jit/backend/llsupport/test/test_stmrewrite.py
+++ b/rpython/jit/backend/llsupport/test/test_stmrewrite.py
@@ -52,6 +52,7 @@
                                                really_not_translated=True)
         self.gc_ll_descr.write_barrier_descr.has_write_barrier_from_array = (
             lambda cpu: False)   # for now
+        self.gc_ll_descr.minimal_size_in_nursery = 16
         #
         class FakeCPU(BaseFakeCPU):
             def sizeof(self, STRUCT):
@@ -1237,7 +1238,7 @@
         jump(i1)
         """, """
         []
-        p99 = call_malloc_nursery(8)
+        p99 = call_malloc_nursery(16)
         i1 = stm_should_break_transaction()
         jump(i1)
         """)
@@ -1264,7 +1265,7 @@
         jump(i1, i2)
         """, """
         []
-        p99 = call_malloc_nursery(8)
+        p99 = call_malloc_nursery(16)
         i1 = stm_should_break_transaction()
         i2 = stm_should_break_transaction()
         jump(i1, i2)
@@ -1282,7 +1283,7 @@
         p2 = call_malloc_nursery(%(tdescr.size)d)
         setfield_gc(p2, %(tdescr.tid)d, descr=tiddescr)
         label()
-        p99 = call_malloc_nursery(8)
+        p99 = call_malloc_nursery(16)
         i1 = stm_should_break_transaction()
         jump(i1)
         """)


More information about the pypy-commit mailing list