Author: Armin Rigo <[email protected]>
Branch:
Changeset: r48121:854bc5e4b87f
Date: 2011-10-17 14:04 +0200
http://bitbucket.org/pypy/pypy/changeset/854bc5e4b87f/
Log: - fix a typo in untested code
- change the tests so that this code is tested too
- independently, fix a test
diff --git a/pypy/jit/metainterp/quasiimmut.py
b/pypy/jit/metainterp/quasiimmut.py
--- a/pypy/jit/metainterp/quasiimmut.py
+++ b/pypy/jit/metainterp/quasiimmut.py
@@ -51,13 +51,13 @@
class QuasiImmut(object):
llopaque = True
+ compress_limit = 30
def __init__(self, cpu):
self.cpu = cpu
# list of weakrefs to the LoopTokens that must be invalidated if
# this value ever changes
self.looptokens_wrefs = []
- self.compress_limit = 30
def hide(self):
qmut_ptr = self.cpu.ts.cast_instance_to_base_ref(self)
@@ -79,7 +79,7 @@
looptoken = wref()
if looptoken is not None and not looptoken.invalidated:
newlist.append(wref)
- self.looptokens_wrefs = wref
+ self.looptokens_wrefs = newlist
self.compress_limit = (len(self.looptokens_wrefs) + 15) * 2
def invalidate(self):
diff --git a/pypy/jit/metainterp/test/test_quasiimmut.py
b/pypy/jit/metainterp/test/test_quasiimmut.py
--- a/pypy/jit/metainterp/test/test_quasiimmut.py
+++ b/pypy/jit/metainterp/test/test_quasiimmut.py
@@ -48,6 +48,13 @@
class QuasiImmutTests(object):
+ def setup_method(self, meth):
+ self.prev_compress_limit = QuasiImmut.compress_limit
+ QuasiImmut.compress_limit = 1
+
+ def teardown_method(self, meth):
+ QuasiImmut.compress_limit = self.prev_compress_limit
+
def test_simple_1(self):
myjitdriver = JitDriver(greens=['foo'], reds=['x', 'total'])
class Foo:
@@ -453,7 +460,7 @@
assert f(100, 15) == 3009
res = self.meta_interp(f, [100, 15])
assert res == 3009
- self.check_loops(guard_not_invalidated=2, getfield_gc=0,
+ self.check_loops(guard_not_invalidated=4, getfield_gc=0,
getarrayitem_gc=0, getarrayitem_gc_pure=0,
call_may_force=0, guard_not_forced=0)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit