Author: Carl Friedrich Bolz <[email protected]>
Branch: value-profiling
Changeset: r81881:7a18372094c5
Date: 2016-01-21 08:23 +0100
http://bitbucket.org/pypy/pypy/changeset/7a18372094c5/
Log: fix the interaction between record_exact_class and the heapcache
diff --git a/rpython/jit/metainterp/heapcache.py
b/rpython/jit/metainterp/heapcache.py
--- a/rpython/jit/metainterp/heapcache.py
+++ b/rpython/jit/metainterp/heapcache.py
@@ -206,6 +206,7 @@
opnum == rop.SETFIELD_RAW or
opnum == rop.SETARRAYITEM_RAW or
opnum == rop.SETINTERIORFIELD_RAW or
+ opnum == rop.RECORD_EXACT_CLASS or
opnum == rop.RAW_STORE):
return
if (rop._OVF_FIRST <= opnum <= rop._OVF_LAST or
diff --git a/rpython/jit/metainterp/test/test_tracingopts.py
b/rpython/jit/metainterp/test/test_tracingopts.py
--- a/rpython/jit/metainterp/test/test_tracingopts.py
+++ b/rpython/jit/metainterp/test/test_tracingopts.py
@@ -707,3 +707,29 @@
res = self.interp_operations(fn, [0])
assert res == 0
self.check_operations_history(setfield_gc=0)
+
+ def test_record_known_class_does_not_invalidate(self):
+ class A:
+ pass
+ class B(A):
+ pass
+ class C(object):
+ _immutable_fields_ = ['x?']
+ c = C()
+ c.x = 5
+ c.b = A()
+ c.b.x = 14
+ def fn(n):
+ if n == 99:
+ c.x = 12
+ c.b = B()
+ c.b.x = 12
+ return 15
+ b = c.b
+ x = b.x
+ jit.record_exact_class(c.b, A)
+ y = b.x
+ return x + y
+ res = self.interp_operations(fn, [1])
+ assert res == 2 * 14
+ self.check_operations_history(getfield_gc_i=1)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit