Author: Armin Rigo <[email protected]>
Branch: conditional_call_value_3
Changeset: r87035:31565879b1f7
Date: 2016-09-12 13:43 +0200
http://bitbucket.org/pypy/pypy/changeset/31565879b1f7/
Log: Delicate ordering here (shown by test_ll_random)
diff --git a/rpython/jit/backend/llsupport/regalloc.py
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -759,6 +759,8 @@
if (opnum != rop.GUARD_TRUE and opnum != rop.GUARD_FALSE
and opnum != rop.COND_CALL):
return False
+ # NB: don't list COND_CALL_VALUE_I/R here, these two variants
+ # of COND_CALL don't accept a cc as input
if next_op.getarg(0) is not op:
return False
if self.longevity[op][1] > i + 1:
diff --git a/rpython/jit/backend/x86/assembler.py
b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -2382,7 +2382,7 @@
def label(self):
self._check_frame_depth_debug(self.mc)
- def cond_call(self, op, gcmap, imm_func, arglocs, resloc=None):
+ def cond_call(self, gcmap, imm_func, arglocs, resloc=None):
assert self.guard_success_cc >= 0
self.mc.J_il8(rx86.invert_condition(self.guard_success_cc), 0)
# patched later
diff --git a/rpython/jit/backend/x86/regalloc.py
b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -943,8 +943,13 @@
v_func = args[1]
assert isinstance(v_func, Const)
imm_func = self.rm.convert_to_imm(v_func)
+
+ # Delicate ordering here. First get the argument's locations.
+ # If this also contains args[0], this returns the current
+ # location too.
arglocs = [self.loc(args[i]) for i in range(2, len(args))]
gcmap = self.get_gcmap()
+
if op.type == 'v':
# a plain COND_CALL. Calls the function when args[0] is
# true. Often used just after a comparison operation.
@@ -957,13 +962,18 @@
# Implemented by forcing the result to live in the same
# register as args[0], and overwriting it if we really do
# the call.
- condvalue_loc = self.loc(args[0])
- assert not isinstance(condvalue_loc, ImmedLoc)
- self.assembler.test_location(condvalue_loc)
+
+ # Load the register for the result. Possibly reuse 'args[0]'.
+ # But the old value of args[0], if it survives, is first
+ # spilled away. We can't overwrite any of op.args[2:] here.
+ resloc = self.rm.force_result_in_reg(op, args[0],
+ forbidden_vars=args[2:])
+
+ # Test the register for the result.
+ self.assembler.test_location(resloc)
self.assembler.guard_success_cc = rx86.Conditions['Z']
- resloc = self.rm.force_result_in_reg(op, args[0],
- forbidden_vars=arglocs)
- self.assembler.cond_call(op, gcmap, imm_func, arglocs, resloc)
+
+ self.assembler.cond_call(gcmap, imm_func, arglocs, resloc)
consider_cond_call_value_i = consider_cond_call
consider_cond_call_value_r = consider_cond_call
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit