[pypy-svn] pypy jit-continue_tracing: (cfbolz, hakanardo): test for e70e82655721
hakanardo
commits-noreply at bitbucket.org
Tue Apr 26 17:30:58 CEST 2011
Author: Hakan Ardo <hakan at debian.org>
Branch: jit-continue_tracing
Changeset: r43634:95c9a6c0fb06
Date: 2011-04-26 17:30 +0200
http://bitbucket.org/pypy/pypy/changeset/95c9a6c0fb06/
Log: (cfbolz, hakanardo): test for e70e82655721
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
@@ -2101,6 +2101,79 @@
assert self.meta_interp(f, [5, 100]) == 0
self.check_loops(int_rshift=1, everywhere=True)
+ def test_inputarg_reset_bug(self):
+ ## j = 0
+ ## while j < 100:
+ ## j += 1
+
+ ## c = 0
+ ## j = 0
+ ## while j < 2:
+ ## j += 1
+ ## if c == 0:
+ ## c = 1
+ ## else:
+ ## c = 0
+
+ ## j = 0
+ ## while j < 100:
+ ## j += 1
+
+ def get_printable_location(i):
+ return str(i)
+
+ myjitdriver = JitDriver(greens = ['i'], reds = ['j', 'c', 'a'],
+ get_printable_location=get_printable_location)
+ bytecode = "0j10jc20a3"
+ def f():
+ myjitdriver.set_param('threshold', 7)
+ myjitdriver.set_param('trace_eagerness', 1)
+ i = j = c = a = 1
+ while True:
+ myjitdriver.jit_merge_point(i=i, j=j, c=c, a=a)
+ if i >= len(bytecode):
+ break
+ op = bytecode[i]
+ if op == 'j':
+ j += 1
+ elif op == 'c':
+ c = hint(c, promote=True)
+ c = 1 - c
+ elif op == '2':
+ if j < 3:
+ i -= 3
+ myjitdriver.can_enter_jit(i=i, j=j, c=c, a=a)
+ elif op == '1':
+ k = j*a
+ if j < 100:
+ i -= 2
+ a += k
+ myjitdriver.can_enter_jit(i=i, j=j, c=c, a=a)
+ else:
+ a += k*2
+ elif op == '0':
+ j = c = a = 0
+ elif op == 'a':
+ j += 1
+ a += 1
+ elif op == '3':
+ if a < 100:
+ i -= 2
+ myjitdriver.can_enter_jit(i=i, j=j, c=c, a=a)
+
+ else:
+ return ord(op)
+ i += 1
+ return 42
+ assert f() == 42
+ def g():
+ res = 1
+ for i in range(10):
+ res = f()
+ return res
+ res = self.meta_interp(g, [])
+ assert res == 42
+
def test_read_timestamp(self):
import time
from pypy.rlib.rtimer import read_timestamp
More information about the Pypy-commit
mailing list