[pypy-commit] pypy call-loopinvariant-into-bridges: a branch to try to emit less threadlocalref_get calls in bridges
cfbolz
pypy.commits at gmail.com
Sat Feb 24 03:27:53 EST 2018
Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: call-loopinvariant-into-bridges
Changeset: r93880:7d193b453f44
Date: 2018-02-23 21:31 +0100
http://bitbucket.org/pypy/pypy/changeset/7d193b453f44/
Log: a branch to try to emit less threadlocalref_get calls in bridges
first failing test
diff --git a/rpython/jit/metainterp/test/test_bridgeopt.py b/rpython/jit/metainterp/test/test_bridgeopt.py
--- a/rpython/jit/metainterp/test/test_bridgeopt.py
+++ b/rpython/jit/metainterp/test/test_bridgeopt.py
@@ -321,3 +321,38 @@
self.check_trace_count(3)
self.check_resops(guard_value=1)
self.check_resops(getarrayitem_gc_i=5)
+
+ def test_bridge_call_loopinvariant(self):
+ class A(object):
+ pass
+ class B(object):
+ pass
+
+ aholder = B()
+ aholder.a = A()
+
+ @jit.loop_invariant
+ def get():
+ return aholder.a
+
+ myjitdriver = jit.JitDriver(greens=[], reds=['y', 'res', 'n'])
+ def f(x, y, n):
+ if x == 10001121:
+ aholder.a = A()
+ if x:
+ get().x = 1
+ else:
+ get().x = 2
+ res = 0
+ while y > 0:
+ myjitdriver.jit_merge_point(y=y, n=n, res=res)
+ a = get()
+ res += a.x
+ if y > n:
+ res += 1
+ res += get().x + a.x
+ y -= 1
+ return res
+ res = self.meta_interp(f, [6, 32, 16])
+ self.check_trace_count(3)
+ self.check_resops(call_r=1)
More information about the pypy-commit
mailing list