Author: Alex Gaynor <[email protected]>
Branch: release-gil-flush-heapcache
Changeset: r45734:ce8caa1e35db
Date: 2011-07-18 17:55 -0700
http://bitbucket.org/pypy/pypy/changeset/ce8caa1e35db/
Log: It didn't work because array's have a fixed length and the JIT is
very smart. Rewrite the test to ues an attribute (could have also
used a non-fixed-size array), it fails before this patch and passes
afterwords.
diff --git a/pypy/jit/metainterp/optimizeopt/__init__.py
b/pypy/jit/metainterp/optimizeopt/__init__.py
--- a/pypy/jit/metainterp/optimizeopt/__init__.py
+++ b/pypy/jit/metainterp/optimizeopt/__init__.py
@@ -61,7 +61,6 @@
optimizations, unroll = build_opt_chain(metainterp_sd, enable_opts,
inline_short_preamble, retraced)
-
if unroll:
optimize_unroll(metainterp_sd, loop, optimizations)
else:
diff --git a/pypy/jit/metainterp/test/test_ajit.py
b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -2628,24 +2628,27 @@
@dont_look_inside
def release(self):
external(lltype.nullptr(T.TO))
+ class X(object):
+ def __init__(self, idx):
+ self.field = idx
@dont_look_inside
- def get_lst():
- return [0]
- myjitdriver = JitDriver(greens=[], reds=["n", "l", "lock"])
- def f(n):
+ def get_obj(z):
+ return X(z)
+ myjitdriver = JitDriver(greens=[], reds=["n", "l", "z", "lock"])
+ def f(n, z):
lock = Lock()
l = 0
while n > 0:
- myjitdriver.jit_merge_point(lock=lock, l=l, n=n)
- x = get_lst()
- l += len(x)
+ myjitdriver.jit_merge_point(lock=lock, l=l, n=n, z=z)
+ x = get_obj(z)
+ l += x.field
lock.acquire()
# This must not reuse the previous one.
- n -= len(x)
+ n -= x.field
lock.release()
return n
- res = self.meta_interp(f, [10])
- self.check_loops(arraylen_gc=2)
+ res = self.meta_interp(f, [10, 1])
+ self.check_loops(getfield_gc=2)
class TestLLtype(BaseLLtypeTests, LLJitMixin):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit