[pypy-svn] r63489 - in pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp: . test
arigo at codespeak.net
arigo at codespeak.net
Wed Apr 1 15:19:20 CEST 2009
Author: arigo
Date: Wed Apr 1 15:19:18 2009
New Revision: 63489
Modified:
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/compile.py
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/optimize.py
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_virtual.py
Log:
Fix test_virtual by fixing the logic in initialize_state_from_guard_failure
that appends rebuilding operations at the start of the history.
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/compile.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/compile.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/compile.py Wed Apr 1 15:19:18 2009
@@ -55,7 +55,8 @@
show_loop(metainterp, error=exc)
raise
else:
- show_loop(metainterp, target_loop)
+ if target_loop is not None:
+ show_loop(metainterp, target_loop)
if target_loop is not None:
target_loop.check_consistency()
return target_loop
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/optimize.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/optimize.py Wed Apr 1 15:19:18 2009
@@ -895,23 +895,6 @@
result.append(box)
return result
-##def rebuild_boxes_from_guard_failure(guard_op, cpu, history, boxes_from_frame):
-## currentvalues = {}
-## assert len(boxes_from_frame) == len(guard_op.liveboxes)
-## for i in range(len(boxes_from_frame)):
-## currentvalues[guard_op.liveboxes[i]] = boxes_from_frame[i]
-
-## # interpret the operations stored in 'rebuild_ops'
-## for op in guard_op.rebuild_ops:
-## argboxes = get_in_list(currentvalues, op.args)
-## # similar to execute_and_record, but not specialized on op.opnum
-## resbox = executor.execute_nonspec(cpu, op.opnum, argboxes, op.descr)
-## history.record(op.opnum, argboxes, resbox, op.descr)
-## if resbox is not None:
-## currentvalues[op.result] = resbox
-## # done
-## return [currentvalues[box] for box in guard_op.unoptboxes]
-
# ---------------------------------------------------------------
def partition(array, left, right):
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py Wed Apr 1 15:19:18 2009
@@ -901,6 +901,7 @@
# full loop header. Complete it as a full loop by
# inserting a copy of the operations from the old
# loop branch before the guard that failed.
+ del self.history.operations[:self.extra_rebuild_operations]
compile.prepare_loop_from_bridge(self, key)
loop = self.compile(original_boxes, live_arg_boxes)
raise GenerateMergePoint(live_arg_boxes, loop)
@@ -1001,8 +1002,12 @@
assert isinstance(resumedescr, history.ResumeDescr)
if self.state.must_compile_from_failure(resumedescr):
self.history = history.History(self.cpu)
- suboperations = resumedescr.guard_op.suboperations
- for i in range(len(suboperations)-1):
+ guard_op = resumedescr.guard_op
+ if guard_op.optimized is not None: # should never be None
+ guard_op = guard_op.optimized
+ suboperations = guard_op.suboperations
+ self.extra_rebuild_operations = len(suboperations) - 1
+ for i in range(self.extra_rebuild_operations):
self.history.operations.append(suboperations[i])
else:
self.history = history.BlackHole(self.cpu)
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_virtual.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_virtual.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_virtual.py Wed Apr 1 15:19:18 2009
@@ -95,8 +95,8 @@
node = next
n -= 1
return node.value
- res = self.meta_interp(f, [10])
- assert res == f(10)
+ res = self.meta_interp(f, [18])
+ assert res == f(18)
self.check_loop_count(2)
self.check_loops(new=0, new_with_vtable=0,
getfield_gc=0, setfield_gc=0)
More information about the Pypy-commit
mailing list