Author: Antonio Cuni <[email protected]>
Branch: autoreds
Changeset: r58842:3d05b0c6d236
Date: 2012-11-12 18:23 +0100
http://bitbucket.org/pypy/pypy/changeset/3d05b0c6d236/
Log: add support for live variables which are between the start of the
block and the jit_marker
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
@@ -154,6 +154,21 @@
assert res == expected
self.check_resops(int_sub=2, int_mul=0, int_add=18, float_add=8)
+ def test_loop_automatic_reds_livevars_before_jit_merge_point(self):
+ myjitdriver = JitDriver(greens = ['m'], reds = 'auto')
+ def f(n, m):
+ res = 0
+ while n > 0:
+ n -= 1
+ myjitdriver.can_enter_jit(m=m)
+ myjitdriver.jit_merge_point(m=m)
+ res += m*2
+ return res
+ expected = f(21, 5)
+ res = self.meta_interp(f, [21, 5])
+ assert res == expected
+ self.check_resops(int_sub=2, int_mul=0, int_add=2)
+
def test_loop_variant_mul1(self):
myjitdriver = JitDriver(greens = [], reds = ['y', 'res', 'x'])
def f(x, y):
diff --git a/pypy/jit/metainterp/warmspot.py b/pypy/jit/metainterp/warmspot.py
--- a/pypy/jit/metainterp/warmspot.py
+++ b/pypy/jit/metainterp/warmspot.py
@@ -259,9 +259,14 @@
jitdriver = op.args[1].value
if not jitdriver.autoreds:
continue
+ # compute the set of live variables before the jit_marker
+ alive_v = set(block.inputargs)
+ for op1 in block.operations:
+ if op1 is op:
+ break # stop when the meet the jit_marker
+ if op1.result.concretetype != lltype.Void:
+ alive_v.add(op1.result)
greens_v = op.args[2:]
- alive_v = set(block.inputargs) # XXX: there might be more
- # alive vars?
reds_v = alive_v - set(greens_v)
reds_v = support.sort_vars(reds_v)
op.args.extend(reds_v)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit