[pypy-commit] pypy stmgc-c7: make duhton translate without --stm on this branch

Raemi noreply at buildbot.pypy.org
Thu Aug 28 14:42:31 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: stmgc-c7
Changeset: r73109:98cf7234b83a
Date: 2014-08-28 14:42 +0200
http://bitbucket.org/pypy/pypy/changeset/98cf7234b83a/

Log:	make duhton translate without --stm on this branch

diff --git a/rpython/memory/gc/base.py b/rpython/memory/gc/base.py
--- a/rpython/memory/gc/base.py
+++ b/rpython/memory/gc/base.py
@@ -344,6 +344,7 @@
                     break
                 obj = self.run_finalizers.popleft()
                 finalizer = self.getfinalizer(self.get_type_id(obj))
+                assert finalizer
                 finalizer(obj)
         finally:
             self.finalizer_lock_count -= 1
diff --git a/rpython/memory/gctransform/framework.py b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -48,7 +48,7 @@
                     LL_OPERATIONS[op.opname].canmallocgc)
 
 
-        
+
 def find_initializing_stores(collect_analyzer, graph):
     from rpython.flowspace.model import mkentrymap
     entrymap = mkentrymap(graph)
@@ -625,7 +625,7 @@
                 # causes it to return True
                 raise Exception("'no_collect' function can trigger collection:"
                                 " %s\n%s" % (func, err.getvalue()))
-                
+
         if self.write_barrier_ptr:
             self.clean_sets = (
                 find_initializing_stores(self.collect_analyzer, graph))
@@ -1284,15 +1284,15 @@
             ll_call_destructor(destrptr, v, typename)
         fptr = self.transformer.annotate_finalizer(ll_finalizer,
                 [llmemory.Address], lltype.Void)
-        g = destrptr._obj.graph
-        if self.translator.config.translation.stm:
-            light = False    # XXX no working finalizers with STM so far
-        else:
-            try:
+        try:
+            g = destrptr._obj.graph
+            if self.translator.config.translation.stm:
+                light = False    # XXX no working finalizers with STM so far
+            else:
                 analyzer = FinalizerAnalyzer(self.translator)
                 light = not analyzer.analyze_light_finalizer(g)
-            except lltype.DelayedPointer:
-                light = False    # XXX bah, too bad
+        except lltype.DelayedPointer:
+            light = False    # XXX bah, too bad
         return fptr, light
 
     def make_custom_trace_funcptr_for_type(self, TYPE):
diff --git a/rpython/rtyper/lltypesystem/rffi.py b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -315,10 +315,16 @@
     source = py.code.Source(r"""
         def wrapper(%(args)s):    # no *args - no GIL for mallocing the tuple
             token = 0
-            rjbuf = llop.stm_rewind_jmp_frame(llmemory.Address, 1)
+            if rgc.stm_is_enabled():
+                rjbuf = llop.stm_rewind_jmp_frame(llmemory.Address, 1)
+            else:
+                rjbuf = llmemory.NULL
             if aroundstate is not None:
                 if aroundstate.enter_callback is not None:
-                    token = aroundstate.enter_callback(rjbuf)
+                    if rgc.stm_is_enabled():
+                        token = aroundstate.enter_callback(rjbuf)
+                    else:
+                        aroundstate.enter_callback()
                 else:
                     after = aroundstate.after
                     if after is not None:
@@ -339,7 +345,10 @@
             stackcounter.stacks_counter -= 1
             if aroundstate is not None:
                 if aroundstate.leave_callback is not None:
-                    aroundstate.leave_callback(rjbuf, token)
+                    if rgc.stm_is_enabled():
+                        aroundstate.leave_callback(rjbuf, token)
+                    else:
+                        aroundstate.leave_callback()
                 else:
                     before = aroundstate.before
                     if before is not None:
@@ -352,6 +361,7 @@
     miniglobals = locals().copy()
     miniglobals['Exception'] = Exception
     miniglobals['os'] = os
+    miniglobals['rgc'] = rgc
     miniglobals['we_are_translated'] = we_are_translated
     miniglobals['stackcounter'] = stackcounter
     miniglobals['llmemory'] = llmemory


More information about the pypy-commit mailing list