[pypy-commit] pypy stm-thread-2: Tweaks and fixes

arigo noreply at buildbot.pypy.org
Mon Sep 3 19:45:11 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r57102:1c60f249db31
Date: 2012-09-03 16:45 +0200
http://bitbucket.org/pypy/pypy/changeset/1c60f249db31/

Log:	Tweaks and fixes

diff --git a/pypy/rpython/lltypesystem/lloperation.py b/pypy/rpython/lltypesystem/lloperation.py
--- a/pypy/rpython/lltypesystem/lloperation.py
+++ b/pypy/rpython/lltypesystem/lloperation.py
@@ -399,22 +399,16 @@
     # direct_calls and maybe several casts, but it looks less heavy-weight
     # to keep them as operations until the genc stage)
 
-    'stm_getfield':           LLOp(sideeffects=False, canrun=True),
-    'stm_getarrayitem':       LLOp(sideeffects=False, canrun=True),
-    'stm_getinteriorfield':   LLOp(sideeffects=False, canrun=True),
+    'stm_barrier':            LLOp(sideeffects=False),
     'stm_become_inevitable':  LLOp(),
-    'stm_writebarrier':       LLOp(),
-    'stm_local_not_needed':   LLOp(),
-    'stm_normalize_global':   LLOp(),
+    'stm_ptr_eq':             LLOp(sideeffects=False),
     'stm_start_transaction':  LLOp(canrun=True, canmallocgc=True),
     'stm_stop_transaction':   LLOp(canrun=True, canmallocgc=True),
 
     'gc_load':                LLOp(sideeffects=False),   # so far, only if stm
     'gc_store':               LLOp(),                    # so far, only if stm
-    'stm_gc_load':            LLOp(sideeffects=False),
-    'stm_gc_store':           LLOp(),
 
-    'stm_jit_invoke_code':    LLOp(canmallocgc=True),
+    #'stm_jit_invoke_code':    LLOp(canmallocgc=True),
 
     # __________ address operations __________
 
diff --git a/pypy/translator/c/genc.py b/pypy/translator/c/genc.py
--- a/pypy/translator/c/genc.py
+++ b/pypy/translator/c/genc.py
@@ -135,11 +135,11 @@
         translator = self.translator
 
         if self.config.translation.stm:
-            from pypy.translator.stm import transform
+            from pypy.translator.stm import transform2
             self.getentrypointptr()    # build the wrapper first
             # ^^ this is needed to make sure we see the no-GC wrapper function
             # calling the GC entrypoint function.
-            transformer = transform.STMTransformer(self.translator)
+            transformer = transform2.STMTransformer(self.translator)
             transformer.transform()
 
         gcpolicyclass = self.get_gcpolicyclass()
diff --git a/pypy/translator/stm/transform2.py b/pypy/translator/stm/transform2.py
--- a/pypy/translator/stm/transform2.py
+++ b/pypy/translator/stm/transform2.py
@@ -1,6 +1,6 @@
 from pypy.objspace.flow.model import SpaceOperation, Constant, Variable
-from pypy.objspace.flow.model import checkgraph, c_last_exception
-from pypy.translator.unsimplify import varoftype
+from pypy.objspace.flow.model import checkgraph, c_last_exception, Block, Link
+from pypy.translator.unsimplify import varoftype, insert_empty_block
 from pypy.rpython.lltypesystem import lltype
 from pypy.translator.backendopt.writeanalyze import WriteAnalyzer, top_set
 
@@ -44,6 +44,15 @@
     'W': 'WN',
     'N': 'N'}
 
+def unwraplist(list_v):
+    for v in list_v: 
+        if isinstance(v, Constant):
+            yield v.value
+        elif isinstance(v, Variable):
+            yield None    # unknown
+        else:
+            raise AssertionError(v)
+
 def is_immutable(op):
     if op.opname in ('getfield', 'setfield'):
         STRUCT = op.args[0].concretetype.TO
@@ -167,7 +176,12 @@
 
             block.operations = newoperations
             #
-            assert block.exitswitch != c_last_exception   # transformed already
             for link in block.exits:
+                newoperations = []
                 for i, v in enumerate(link.args):
                     link.args[i] = renamings_get(v)
+                if newoperations:
+                    # must put them in a fresh block along the link
+                    annotator = stmtransformer.translator.annotator
+                    newblock = insert_empty_block(annotator, link,
+                                                  newoperations)


More information about the pypy-commit mailing list