[pypy-commit] pypy stmgc-c4: some pure operations need barriers (stmrewrite.py)
Raemi
noreply at buildbot.pypy.org
Thu Aug 22 22:27:39 CEST 2013
Author: Remi Meier <remi.meier at gmail.com>
Branch: stmgc-c4
Changeset: r66299:f727195ab6ee
Date: 2013-08-22 22:08 +0200
http://bitbucket.org/pypy/pypy/changeset/f727195ab6ee/
Log: some pure operations need barriers (stmrewrite.py)
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
@@ -67,6 +67,15 @@
# uses h_tid which doesn't need a read-barrier
self.newops.append(op)
continue
+ # ---------- pure operations needing read-barrier ----------
+ if op.getopnum() in (rop.GETFIELD_GC_PURE,
+ rop.GETARRAYITEM_GC_PURE,
+ rop.ARRAYLEN_GC,):
+ # e.g. getting inst_intval of a W_IntObject that is
+ # currently only a stub needs to first resolve to a
+ # real object
+ self.handle_category_operations(op, 'R')
+ continue
# ---------- pure operations, guards ----------
if op.is_always_pure() or op.is_guard() or op.is_ovf():
self.newops.append(op)
diff --git a/rpython/jit/backend/llsupport/test/zrpy_gc_test.py b/rpython/jit/backend/llsupport/test/zrpy_gc_test.py
--- a/rpython/jit/backend/llsupport/test/zrpy_gc_test.py
+++ b/rpython/jit/backend/llsupport/test/zrpy_gc_test.py
@@ -813,7 +813,7 @@
x0 = promote(x0)
elif n % 3 == 1:
x1 = promote(x1)
- else:
+ else: # None
x2 = promote(x2)
raiseassert(x0 != ptrs[0])
raiseassert(x0 == ptrs[1])
@@ -849,3 +849,29 @@
def test_compile_framework_ptr_eq(self):
self.run('compile_framework_ptr_eq')
+
+ def define_compile_framework_call_assembler2(self):
+ S = lltype.GcStruct('S', ('i', lltype.Signed),
+ ('v', lltype.Signed))
+ driver = JitDriver(greens = [],
+ reds = ['a'])
+
+ def inner(a):
+ while a.i:
+ driver.jit_merge_point(a=a)
+ a.i -= 1
+ print a.v
+
+ def f(n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s):
+ u = lltype.malloc(S)
+ u.i = 10000
+ u.v = n
+ inner(u)
+
+ return n - 1, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s
+
+ return None, f, None
+
+ def test_compile_framework_call_assembler2(self):
+ self.run('compile_framework_call_assembler2')
+
More information about the pypy-commit
mailing list