[pypy-commit] pypy stmgc-static-barrier: Fix barrier choice

arigo noreply at buildbot.pypy.org
Wed Aug 14 19:24:43 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-static-barrier
Changeset: r66155:6cf44c497611
Date: 2013-08-14 19:22 +0200
http://bitbucket.org/pypy/pypy/changeset/6cf44c497611/

Log:	Fix barrier choice

diff --git a/rpython/translator/stm/funcgen.py b/rpython/translator/stm/funcgen.py
--- a/rpython/translator/stm/funcgen.py
+++ b/rpython/translator/stm/funcgen.py
@@ -48,19 +48,24 @@
 def stm_finalize(funcgen, op):
     return 'stm_finalize();'
 
-_STM_BARRIER_FUNCS = {   # XXX try to see if some combinations can be shorter
-    'P2R': 'stm_read_barrier',
-    'G2R': 'stm_read_barrier',
-    'O2R': 'stm_read_barrier',
-    'P2W': 'stm_write_barrier',
-    'G2W': 'stm_write_barrier',
-    'O2W': 'stm_write_barrier',
-    'R2W': 'stm_write_barrier',
-    }
-
 def stm_barrier(funcgen, op):
     category_change = op.args[0].value
-    funcname = _STM_BARRIER_FUNCS[category_change]
+    frm, middle, to = category_change
+    assert middle == '2'
+    if to == 'W':
+        if frm >= 'V':
+            funcname = 'stm_repeat_write_barrier'
+        else:
+            funcname = 'stm_write_barrier'
+    elif to == 'R':
+        if frm >= 'Q':
+            funcname = 'stm_repeat_read_barrier'
+        else:
+            funcname = 'stm_read_barrier'
+    elif to == 'I':
+        funcname = 'stm_immut_read_barrier'
+    else:
+        raise AssertionError(category_change)
     assert op.args[1].concretetype == op.result.concretetype
     arg = funcgen.expr(op.args[1])
     result = funcgen.expr(op.result)


More information about the pypy-commit mailing list