Author: Remi Meier <[email protected]>
Branch: stmgc-c4
Changeset: r65903:008566532c4f
Date: 2013-08-02 11:35 +0200
http://bitbucket.org/pypy/pypy/changeset/008566532c4f/
Log: invalidate all 'R' variables after a write barrier. Can be improved
with aliasing info and other tricks
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
@@ -115,6 +115,14 @@
for v, c in self.known_category.items():
if c == 'W':
self.known_category[v] = 'R'
+
+ def clear_readable_statuses(self, reason):
+ # XXX: needs aliasing info to be better
+ # XXX: move to optimizeopt to only invalidate same typed vars?
+ for v, c in self.known_category.items():
+ if c == 'R':
+ self.known_category[v] = 'P'
+
def gen_write_barrier(self, v):
raise NotImplementedError
@@ -123,6 +131,10 @@
v_base = self.unconstifyptr(v_base)
assert isinstance(v_base, BoxPtr)
source_category = self.known_category.get(v_base, 'P')
+ if target_category == 'W':
+ # if *any* of the readable vars is the same object,
+ # it must repeat the read_barrier now
+ self.clear_readable_statuses(v_base)
mpcat = self.more_precise_categories[source_category]
try:
write_barrier_descr = mpcat[target_category]
diff --git a/rpython/translator/stm/writebarrier.py
b/rpython/translator/stm/writebarrier.py
--- a/rpython/translator/stm/writebarrier.py
+++ b/rpython/translator/stm/writebarrier.py
@@ -126,6 +126,15 @@
newoperations.append(newop)
v_holder[0] = w
category[w] = to
+ if to == 'W':
+ # if any of the other vars in the same path
+ # points to the same object, they must lose
+ # their read-status now
+ for u in block.getvariables():
+ if get_category(u) == 'R' \
+ and u.concretetype == v.concretetype:
+ category[u] = 'P'
+
#
newop = SpaceOperation(op.opname,
[renamings_get(v) for v in op.args],
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit