Author: Armin Rigo <[email protected]>
Branch: optresult-unroll
Changeset: r79472:0156d890d463
Date: 2015-09-06 12:05 +0200
http://bitbucket.org/pypy/pypy/changeset/0156d890d463/
Log: 32bit: fix test_executor.py
diff --git a/rpython/jit/metainterp/executor.py
b/rpython/jit/metainterp/executor.py
--- a/rpython/jit/metainterp/executor.py
+++ b/rpython/jit/metainterp/executor.py
@@ -470,8 +470,10 @@
return ConstInt(value)
elif isinstance(value, bool):
return ConstInt(int(value))
+ elif lltype.typeOf(value) == longlong.FLOATSTORAGE:
+ return ConstFloat(value)
elif isinstance(value, float):
- return ConstFloat(value)
+ return ConstFloat(longlong.getfloatstorage(value))
else:
assert lltype.typeOf(value) == llmemory.GCREF
return ConstPtr(value)
diff --git a/rpython/jit/metainterp/resoperation.py
b/rpython/jit/metainterp/resoperation.py
--- a/rpython/jit/metainterp/resoperation.py
+++ b/rpython/jit/metainterp/resoperation.py
@@ -404,6 +404,7 @@
getfloat = getfloatstorage
def setfloatstorage(self, floatval):
+ assert lltype.typeOf(floatval) is longlong.FLOATSTORAGE
self._resfloat = floatval
def copy_value_from(self, other):
@@ -478,7 +479,7 @@
self.setint(intval)
class InputArgFloat(FloatOp, AbstractInputArg):
- def __init__(self, f=0.0):
+ def __init__(self, f=longlong.ZEROF):
self.setfloatstorage(f)
class InputArgRef(RefOp, AbstractInputArg):
diff --git a/rpython/jit/metainterp/test/test_executor.py
b/rpython/jit/metainterp/test/test_executor.py
--- a/rpython/jit/metainterp/test/test_executor.py
+++ b/rpython/jit/metainterp/test/test_executor.py
@@ -84,7 +84,7 @@
argboxes = [InputArgInt(99999), InputArgInt(321), constfloat(2.25),
ConstInt(123),
InputArgRef(), boxfloat(5.5)]
box = execute_varargs(cpu, FakeMetaInterp(), rop.CALL_F, argboxes, descr)
- assert box == 42.5
+ assert longlong.getrealfloat(box) == 42.5
assert cpu.fakecalled == (99999, [321, 123],
[ConstPtr.value],
[longlong.getfloatstorage(2.25),
@@ -99,7 +99,7 @@
argboxes = [InputArgInt(321), ConstInt(123)]
box = _execute_arglist(cpu, FakeMetaInterp(), rop.CALL_F,
argboxes, FakeCallDescr())
- assert box == 42.5
+ assert longlong.getrealfloat(box) == 42.5
# arity == 0
box = _execute_arglist(cpu, None, rop.NEW, [], descr)
assert box.fakeargs == ('new', descr)
@@ -298,7 +298,7 @@
boxargs = []
for x in args:
if isinstance(x, float):
- boxargs.append(InputArgFloat(x))
+ boxargs.append(boxfloat(x))
else:
boxargs.append(InputArgInt(x))
yield opnum, boxargs, rettype, retvalue
@@ -309,13 +309,15 @@
if (isinstance(args[0], float) and
isinstance(args[1], float) and
args[0] == args[1]):
- commonbox = InputArgFloat(args[0])
+ commonbox = boxfloat(args[0])
yield opnum, [commonbox, commonbox], rettype, retvalue
def test_float_ops():
cpu = FakeCPU()
for opnum, boxargs, rettype, retvalue in get_float_tests(cpu):
res = _execute_arglist(cpu, None, opnum, boxargs)
+ if rettype == 'float':
+ res = longlong.getrealfloat(res)
assert res == retvalue
def make_args_for_op(op, a, b):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit