[pypy-commit] pypy stm-jit: progress
arigo
noreply at buildbot.pypy.org
Sat Aug 11 08:46:13 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-jit
Changeset: r56699:5c12e79bfb31
Date: 2012-08-10 16:09 +0200
http://bitbucket.org/pypy/pypy/changeset/5c12e79bfb31/
Log: progress
diff --git a/pypy/jit/backend/llsupport/stmrewrite.py b/pypy/jit/backend/llsupport/stmrewrite.py
--- a/pypy/jit/backend/llsupport/stmrewrite.py
+++ b/pypy/jit/backend/llsupport/stmrewrite.py
@@ -17,15 +17,21 @@
for op in operations:
if op.getopnum() == rop.DEBUG_MERGE_POINT:
continue
- # ---------- mallocs ----------
- if op.is_malloc():
- self.handle_malloc_operation(op)
+ # ---------- getfields ----------
+ if op.getopnum() in (rop.GETFIELD_GC,
+ rop.GETARRAYITEM_GC,
+ rop.GETINTERIORFIELD_GC):
+ self.handle_getfield_operations(op)
continue
# ---------- setfields ----------
if op.getopnum() in (rop.SETFIELD_GC,
rop.SETARRAYITEM_GC,
rop.SETINTERIORFIELD_GC):
- self.handle_write_barrier(op)
+ self.handle_setfield_operations(op)
+ continue
+ # ---------- mallocs ----------
+ if op.is_malloc():
+ self.handle_malloc_operation(op)
continue
# ---------- calls, labels ----------
if op.is_call() or op.getopnum() == rop.LABEL:
@@ -54,10 +60,21 @@
assert isinstance(v, BoxPtr)
return v
- def handle_write_barrier(self, op):
+ def handle_setfield_operations(self, op):
self.gen_write_barrier(self.unconstifyptr(op.getarg(0)))
self.newops.append(op)
def handle_malloc_operation(self, op):
GcRewriterAssembler.handle_malloc_operation(self, op)
self.known_local.add(op.result)
+
+ def handle_getfield_operations(self, op):
+ lst = op.getarglist()
+ lst[0] = self.unconstifyptr(lst[0])
+ self.newops.append(OP_STM_READ_BEFORE)
+ self.newops.append(op.copy_and_change(op.getopnum(), args=lst))
+ self.newops.append(OP_STM_READ_AFTER)
+
+
+OP_STM_READ_BEFORE = ResOperation(rop.STM_READ_BEFORE, [], None)
+OP_STM_READ_AFTER = ResOperation(rop.STM_READ_AFTER, [], None)
diff --git a/pypy/jit/backend/llsupport/test/test_rewrite.py b/pypy/jit/backend/llsupport/test/test_rewrite.py
--- a/pypy/jit/backend/llsupport/test/test_rewrite.py
+++ b/pypy/jit/backend/llsupport/test/test_rewrite.py
@@ -27,6 +27,8 @@
tdescr.tid = 5678
tzdescr = get_field_descr(self.gc_ll_descr, T, 'z')
tydescr = get_field_descr(self.gc_ll_descr, T, 'y')
+ t = lltype.cast_opaque_ptr(llmemory.GCREF,
+ lltype.malloc(T, immortal=True))
#
A = lltype.GcArray(lltype.Signed)
adescr = get_array_descr(self.gc_ll_descr, A)
diff --git a/pypy/jit/backend/llsupport/test/test_stmrewrite.py b/pypy/jit/backend/llsupport/test/test_stmrewrite.py
--- a/pypy/jit/backend/llsupport/test/test_stmrewrite.py
+++ b/pypy/jit/backend/llsupport/test/test_stmrewrite.py
@@ -144,13 +144,13 @@
def test_rewrite_getfield_gc_const(self):
self.check_rewrite("""
[p1]
- p2 = getfield_gc(123456, descr=tzdescr)
+ p2 = getfield_gc(ConstPtr(t), descr=tzdescr)
jump(p2)
""", """
[p1]
- p1 = same_as(123456)
+ p3 = same_as(ConstPtr(t))
stm_read_before()
- p2 = getfield_gc(p1, descr=tzdescr)
+ p2 = getfield_gc(p3, descr=tzdescr)
stm_read_after()
jump(p2)
""")
diff --git a/pypy/jit/metainterp/executor.py b/pypy/jit/metainterp/executor.py
--- a/pypy/jit/metainterp/executor.py
+++ b/pypy/jit/metainterp/executor.py
@@ -350,6 +350,8 @@
rop.CALL_MALLOC_GC,
rop.CALL_MALLOC_NURSERY,
rop.LABEL,
+ rop.STM_READ_BEFORE,
+ rop.STM_READ_AFTER,
): # list of opcodes never executed by pyjitpl
continue
raise AssertionError("missing %r" % (key,))
diff --git a/pypy/jit/metainterp/resoperation.py b/pypy/jit/metainterp/resoperation.py
--- a/pypy/jit/metainterp/resoperation.py
+++ b/pypy/jit/metainterp/resoperation.py
@@ -503,6 +503,8 @@
'QUASIIMMUT_FIELD/1d', # [objptr], descr=SlowMutateDescr
'RECORD_KNOWN_CLASS/2', # [objptr, clsptr]
'KEEPALIVE/1',
+ 'STM_READ_BEFORE/0', # inserted by backend/llsupport/stmrewrite
+ 'STM_READ_AFTER/0', # inserted by backend/llsupport/stmrewrite
'_CANRAISE_FIRST', # ----- start of can_raise operations -----
'_CALL_FIRST',
More information about the pypy-commit
mailing list