Author: Hakan Ardo <[email protected]>
Branch: jit-usable_retrace_3
Changeset: r58383:3f77e097f483
Date: 2012-10-23 15:32 +0200
http://bitbucket.org/pypy/pypy/changeset/3f77e097f483/
Log: unboxed case
diff --git a/pypy/jit/metainterp/optimizeopt/optimizer.py
b/pypy/jit/metainterp/optimizeopt/optimizer.py
--- a/pypy/jit/metainterp/optimizeopt/optimizer.py
+++ b/pypy/jit/metainterp/optimizeopt/optimizer.py
@@ -458,6 +458,7 @@
def make_equal_to(self, box, value, replace=False):
assert isinstance(value, OptValue)
assert replace or box not in self.values
+ assert not isinstance(box, Const)
self.values[box] = value
def make_constant(self, box, constbox):
diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py
b/pypy/jit/metainterp/optimizeopt/unroll.py
--- a/pypy/jit/metainterp/optimizeopt/unroll.py
+++ b/pypy/jit/metainterp/optimizeopt/unroll.py
@@ -207,7 +207,7 @@
exported_values[box] = self.optimizer.getvalue(box)
target_token.exported_state = ExportedState(short_boxes,
inputarg_setup_ops,
- exported_values,
jump_args, resume_at_jump_descr)
+ exported_values,
original_jump_args, resume_at_jump_descr)
def import_state(self, targetop):
if not targetop: # Trace did not start with a label
@@ -299,7 +299,6 @@
short_inputargs = virtual_state.make_inputargs(values,
self.optimizer, keyboxes=True)
self.short[0] = ResOperation(rop.LABEL, short_inputargs, None)
-
def close_bridge(self, start_label):
inputargs = self.inputargs
short_jumpargs = inputargs[:]
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
@@ -3052,7 +3052,52 @@
res = self.meta_interp(f, [32])
assert res == f(32)
- def test_nested_loops(self):
+ def test_nested_loops_unboxed(self):
+ class A:
+ pass
+
+ bytecode = "iajb+JI"
+ def get_printable_location(i):
+ return "%d: %s" % (i, bytecode[i])
+ myjitdriver = JitDriver(greens = ['pc'], reds = ['n', 'sa', 'c', 'i',
'j', 'obj'],
+ get_printable_location=get_printable_location)
+ def f(n):
+ pc = sa = 0
+ i = j = 0
+ c = n + 1
+ obj = A()
+ while pc < len(bytecode):
+ myjitdriver.jit_merge_point(pc=pc, n=n, sa=sa, i=i, j=j, c=c,
obj=obj)
+ op = bytecode[pc]
+ if op == 'i':
+ i = 0
+ elif op == 'j':
+ j = 0
+ elif op == '+':
+ sa += 3 * i + j + 5 * c
+ elif op == 'a':
+ i = i + 1
+ obj = A()
+ elif op == 'b':
+ j = j + 1
+ elif op == 'J':
+ if j < n:
+ pc -= 2
+ myjitdriver.can_enter_jit(pc=pc, n=n, sa=sa, i=i, j=j,
c=c, obj=obj)
+ continue
+ elif op == 'I':
+ if i < n:
+ pc -= 5
+ myjitdriver.can_enter_jit(pc=pc, n=n, sa=sa, i=i, j=j,
c=c, obj=obj)
+ continue
+ pc += 1
+ return sa
+ res = self.meta_interp(f, [10])
+ assert res == f(10)
+ self.check_resops(new_with_vtable=0)
+ self.check_retraced_simple_loop(2, int_mul=0)
+
+ def test_nested_loops_boxed(self):
class Int(object):
def __init__(self, val):
self.val = val
@@ -3093,7 +3138,7 @@
res = self.meta_interp(f, [10])
assert res == f(10)
self.check_resops(new_with_vtable=0)
- self.check_retraced_simple_loop(2, getfield_gc=0)
+ self.check_retraced_simple_loop(2, getfield_gc=0, int_mul=0)
def test_retrace_failure_fallback(self):
myjitdriver = JitDriver(greens = [], reds = ['n', 'a', 'sa'])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit