[pypy-svn] r64687 - in pypy/branch/pyjitpl5/pypy/jit/backend: minimal test
arigo at codespeak.net
arigo at codespeak.net
Sun Apr 26 14:23:41 CEST 2009
Author: arigo
Date: Sun Apr 26 14:23:40 2009
New Revision: 64687
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/minimal/runner.py
pypy/branch/pyjitpl5/pypy/jit/backend/test/runner.py
Log:
Fix the minimal backend.
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/minimal/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/minimal/runner.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/minimal/runner.py Sun Apr 26 14:23:40 2009
@@ -3,7 +3,7 @@
from pypy.rlib.debug import ll_assert, debug_print
from pypy.rpython.lltypesystem import lltype, llmemory, rffi, rstr, rclass
from pypy.jit.metainterp.history import AbstractDescr, Box, BoxInt, BoxPtr
-from pypy.jit.metainterp import executor
+from pypy.jit.metainterp import executor, history
from pypy.jit.metainterp.resoperation import rop, opname
DEBUG = False
@@ -36,15 +36,14 @@
immortal=True)
self._ovf_error_inst = ll_inst
- def compile_operations(self, loop):
- pass
+ def compile_operations(self, loop, returnboxes):
+ loop._returnboxes = returnboxes
def execute_operations(self, loop, valueboxes):
if DEBUG:
print "execute_operations: starting", loop
for box in valueboxes:
print "\t", box, "\t", box.get_()
- valueboxes = [box.clonebox() for box in valueboxes]
self.clear_exception()
self._guard_failed = False
while True:
@@ -108,14 +107,23 @@
if DEBUG:
print "execute_operations: leaving", loop
+ returnboxes = loop._returnboxes
+ i_int = 0
+ i_ptr = 0
for i in range(len(op.args)):
box = op.args[i]
if isinstance(box, BoxInt):
value = env[box].getint()
- box.changevalue_int(value)
+ dstbox = returnboxes.get_int_box(i_int)
+ i_int += 1
+ dstbox.changevalue_int(value)
elif isinstance(box, BoxPtr):
value = env[box].getptr_base()
- box.changevalue_ptr(value)
+ dstbox = returnboxes.get_ptr_box(i_ptr)
+ i_ptr += 1
+ dstbox.changevalue_ptr(value)
+ else:
+ assert isinstance(box, history.Const)
if DEBUG:
print "\t", box, "\t", box.get_()
return op
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/runner.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/runner.py Sun Apr 26 14:23:40 2009
@@ -158,7 +158,7 @@
def test_ovf_operations(self):
minint = -sys.maxint-1
- boom = 666
+ boom = 'boom'
for opnum, testcases in [
(rop.INT_ADD_OVF, [(10, -2, 8),
(-1, minint, boom),
@@ -203,15 +203,18 @@
]
if opnum in (rop.INT_NEG_OVF, rop.INT_ABS_OVF):
del ops[0].args[1]
- ops[1].suboperations = [ResOperation(rop.FAIL, [ConstInt(boom)],
- None)]
+ ops[1].suboperations = [ResOperation(rop.FAIL, [], None)]
loop = TreeLoop('name')
loop.operations = ops
loop.inputargs = [v1, v2]
self.cpu.compile_operations(loop, returnboxes)
for x, y, z in testcases:
op = self.cpu.execute_operations(loop, [BoxInt(x), BoxInt(y)])
- assert returnboxes._returnboxes_int[0].value == z
+ if z == boom:
+ assert op is ops[1].suboperations[-1]
+ else:
+ assert op is ops[-1]
+ assert returnboxes._returnboxes_int[0].value == z
# ----------
# the same thing but with the exception path reversed
## v1 = BoxInt(testcases[0][0])
More information about the Pypy-commit
mailing list