[pypy-svn] pypy arm-backend-2: Fix an issue when emitting a call with a const as the first argument and checking if it survives the call
bivab
commits-noreply at bitbucket.org
Thu Dec 30 19:45:17 CET 2010
Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r40294:a2a7da4d6dd6
Date: 2010-12-30 19:42 +0100
http://bitbucket.org/pypy/pypy/changeset/a2a7da4d6dd6/
Log: Fix an issue when emitting a call with a const as the first argument
and checking if it survives the call
diff --git a/pypy/jit/backend/arm/opassembler.py b/pypy/jit/backend/arm/opassembler.py
--- a/pypy/jit/backend/arm/opassembler.py
+++ b/pypy/jit/backend/arm/opassembler.py
@@ -271,7 +271,8 @@
regalloc.before_call(save_all_regs=spill_all_regs)
else:
if result:
- if reg_args > 0 and regalloc.stays_alive(args[0]):
+ # XXX maybe move instance check to llsupport/regalloc
+ if reg_args > 0 and isinstance(args[0], Box) and regalloc.stays_alive(args[0]):
regalloc.force_spill_var(args[0])
self.mc.PUSH([reg.value for reg in r.caller_resp][1:])
else:
diff --git a/pypy/jit/backend/test/runner_test.py b/pypy/jit/backend/test/runner_test.py
--- a/pypy/jit/backend/test/runner_test.py
+++ b/pypy/jit/backend/test/runner_test.py
@@ -460,6 +460,13 @@
[funcbox, BoxInt(num), BoxInt(num)],
'int', descr=dyn_calldescr)
assert res.value == 2 * num
+
+ # last, try it with one constant argument
+ calldescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT)
+ res = self.execute_operation(rop.CALL,
+ [funcbox, ConstInt(num), BoxInt(num)],
+ 'int', descr=calldescr)
+ assert res.value == 2 * num
if cpu.supports_floats:
More information about the Pypy-commit
mailing list