[pypy-commit] pypy stm-jit: Translation of an example getting closer

arigo noreply at buildbot.pypy.org
Wed Aug 8 18:12:17 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-jit
Changeset: r56656:ef3b7d59afb6
Date: 2012-08-08 16:09 +0200
http://bitbucket.org/pypy/pypy/changeset/ef3b7d59afb6/

Log:	Translation of an example getting closer

diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py
--- a/pypy/jit/backend/llsupport/gc.py
+++ b/pypy/jit/backend/llsupport/gc.py
@@ -122,7 +122,6 @@
     fielddescr_tid        = None
     str_type_id           = 0
     unicode_type_id       = 0
-    get_malloc_slowpath_addr = None
 
     @classmethod
     def configure_boehm_once(cls):
@@ -199,6 +198,9 @@
                                  arraydescr.itemsize,
                                  arraydescr.lendescr.offset)
 
+    def get_malloc_slowpath_addr(self):
+        return None
+
 
 # ____________________________________________________________
 # All code below is for the hybrid or minimark GC
@@ -897,6 +899,8 @@
         self.gcrootmap.freeing_block(start, stop)
 
     def get_malloc_slowpath_addr(self):
+        if self.max_size_of_young_obj is None:    # stm
+            return None
         return self.get_malloc_fn_addr('malloc_nursery')
 
 # ____________________________________________________________
diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -122,7 +122,7 @@
             support.ensure_sse2_floats()
             self._build_float_constants()
         self._build_propagate_exception_path()
-        if gc_ll_descr.get_malloc_slowpath_addr is not None:
+        if gc_ll_descr.get_malloc_slowpath_addr() is not None:
             self._build_malloc_slowpath()
         self._build_stack_check_slowpath()
         if gc_ll_descr.gcrootmap:
diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py
--- a/pypy/jit/backend/x86/regalloc.py
+++ b/pypy/jit/backend/x86/regalloc.py
@@ -1009,6 +1009,10 @@
     consider_cond_call_gc_wb_array = consider_cond_call_gc_wb
 
     def consider_call_malloc_nursery(self, op):
+        gc_ll_descr = self.assembler.cpu.gc_ll_descr
+        assert gc_ll_descr.get_malloc_slowpath_addr() is not None
+        # ^^^ if this returns None, don't translate the rest of this function
+        #
         size_box = op.getarg(0)
         assert isinstance(size_box, ConstInt)
         size = size_box.getint()
@@ -1020,7 +1024,6 @@
         self.rm.force_allocate_reg(tmp_box, selected_reg=edx)
         self.rm.possibly_free_var(tmp_box)
         #
-        gc_ll_descr = self.assembler.cpu.gc_ll_descr
         self.assembler.malloc_cond(
             gc_ll_descr.get_nursery_free_addr(),
             gc_ll_descr.get_nursery_top_addr(),
diff --git a/pypy/jit/backend/x86/test/test_gc_integration.py b/pypy/jit/backend/x86/test/test_gc_integration.py
--- a/pypy/jit/backend/x86/test/test_gc_integration.py
+++ b/pypy/jit/backend/x86/test/test_gc_integration.py
@@ -41,7 +41,8 @@
         return ['compressed'] + shape[1:]
 
 class MockGcDescr(GcCache):
-    get_malloc_slowpath_addr = None
+    get_malloc_slowpath_addr = lambda self: None
+    stm = False
     write_barrier_descr = None
     moving_gc = True
     gcrootmap = MockGcRootMap()


More information about the pypy-commit mailing list