Author: Richard Plangger <[email protected]>
Branch: s390x-backend
Changeset: r81757:41b2950af11a
Date: 2016-01-14 10:29 +0100
http://bitbucket.org/pypy/pypy/changeset/41b2950af11a/
Log: still searching for this weird problem. seems to be introduced when
switching from a guard to a bridge in a very rare case
diff --git a/rpython/jit/backend/test/runner_test.py
b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -535,11 +535,11 @@
return chr(ord(c) + ord(c1))
functions = [
- #(func_int, lltype.Signed, types.sint, 655360, 655360),
- #(func_int, lltype.Signed, types.sint, 655360, -293999429),
+ (func_int, lltype.Signed, types.sint, 655360, 655360),
+ (func_int, lltype.Signed, types.sint, 655360, -293999429),
(func_int, rffi.SHORT, types.sint16, 1213, 1213),
- #(func_int, rffi.SHORT, types.sint16, 1213, -12020),
- #(func_char, lltype.Char, types.uchar, 12, 12),
+ (func_int, rffi.SHORT, types.sint16, 1213, -12020),
+ (func_char, lltype.Char, types.uchar, 12, 12),
]
cpu = self.cpu
diff --git a/rpython/jit/backend/zarch/callbuilder.py
b/rpython/jit/backend/zarch/callbuilder.py
--- a/rpython/jit/backend/zarch/callbuilder.py
+++ b/rpython/jit/backend/zarch/callbuilder.py
@@ -58,6 +58,7 @@
gpr_regs = 0
fpr_regs = 0
stack_params = []
+ print("### prepare_arguemtns:")
for i in range(num_args):
loc = arglocs[i]
if not arglocs[i].is_float():
@@ -65,8 +66,10 @@
non_float_locs.append(arglocs[i])
non_float_regs.append(self.GPR_ARGS[gpr_regs])
gpr_regs += 1
+ print(" %d: %s at [%s];" % (i, arglocs[i],
self.GPR_ARGS[gpr_regs-1]))
else:
stack_params.append(i)
+ print(" %d: %s at stack[%d];" % (i,arglocs[i],
len(stack_params)-1))
else:
if fpr_regs < max_fpr_in_reg:
float_locs.append(arglocs[i])
@@ -74,8 +77,8 @@
else:
stack_params.append(i)
- self.subtracted_to_sp += len(stack_params) * 8
- base = -len(stack_params) * 8
+ self.subtracted_to_sp += len(stack_params) * WORD
+ base = -len(stack_params) * WORD
if self.is_call_release_gil:
self.subtracted_to_sp += 8*WORD
base -= 8*WORD
@@ -139,8 +142,8 @@
self.mc.raw_call()
def restore_stack_pointer(self):
- if self.subtracted_to_sp != 0:
- self.mc.LAY(r.SP, l.addr(self.subtracted_to_sp, r.SP))
+ # it must at LEAST be 160 bytes
+ self.mc.LAY(r.SP, l.addr(self.subtracted_to_sp, r.SP))
def load_result(self):
assert (self.resloc is None or
@@ -226,30 +229,28 @@
reg = self.resloc
PARAM_SAVE_AREA_OFFSET = 0
if reg is not None:
+ # save 1 word below the stack pointer
if reg.is_core_reg():
- self.mc.STG(reg, l.addr(-7*WORD, r.SP))
+ self.mc.STG(reg, l.addr(-1*WORD, r.SP))
elif reg.is_fp_reg():
- self.mc.STD(reg, l.addr(-7*WORD, r.SP))
+ self.mc.STD(reg, l.addr(-1*WORD, r.SP))
+ self.mc.push_std_frame(8*WORD)
self.mc.load_imm(self.mc.RAW_CALL_REG, self.asm.reacqgil_addr)
self.mc.raw_call()
+ self.mc.pop_std_frame(8*WORD)
if reg is not None:
if reg.is_core_reg():
- self.mc.LG(reg, l.addr(-7*WORD, r.SP))
+ self.mc.LG(reg, l.addr(-1*WORD, r.SP))
elif reg.is_fp_reg():
- self.mc.LD(reg, l.addr(-7*WORD, r.SP))
+ self.mc.LD(reg, l.addr(-1*WORD, r.SP))
# replace b1_location with BEQ(here)
pmc = OverwritingBuilder(self.mc, b1_location, 1)
pmc.BRCL(c.EQ, l.imm(self.mc.currpos() - b1_location))
pmc.overwrite()
- # restore the values that is void after LMG
- if gcrootmap:
- if gcrootmap.is_shadow_stack and self.is_call_release_gil:
- self.mc.LGR(r.SCRATCH, RSHADOWOLD)
self.mc.LMG(r.r8, r.r13, l.addr(-7*WORD, r.SP))
-
def write_real_errno(self, save_err):
if save_err & rffi.RFFI_READSAVED_ERRNO:
# Just before a call, read '*_errno' and write it into the
diff --git a/rpython/jit/backend/zarch/codebuilder.py
b/rpython/jit/backend/zarch/codebuilder.py
--- a/rpython/jit/backend/zarch/codebuilder.py
+++ b/rpython/jit/backend/zarch/codebuilder.py
@@ -217,12 +217,12 @@
def restore_link(self):
self.LG(r.RETURN, l.addr(14*WORD, r.SP))
- def push_std_frame(self):
- self.STG(r.SP, l.addr(-STD_FRAME_SIZE_IN_BYTES, r.SP))
- self.LAY(r.SP, l.addr(-STD_FRAME_SIZE_IN_BYTES, r.SP))
+ def push_std_frame(self, additional_bytes=0):
+ self.STG(r.SP, l.addr(-(STD_FRAME_SIZE_IN_BYTES + additional_bytes),
r.SP))
+ self.LAY(r.SP, l.addr(-(STD_FRAME_SIZE_IN_BYTES + additional_bytes),
r.SP))
- def pop_std_frame(self):
- self.LAY(r.SP, l.addr(STD_FRAME_SIZE_IN_BYTES, r.SP))
+ def pop_std_frame(self, additional_bytes=0):
+ self.LAY(r.SP, l.addr(STD_FRAME_SIZE_IN_BYTES + additional_bytes,
r.SP))
def get_assembler_function(self):
"NOT_RPYTHON: tests only"
diff --git a/rpython/jit/backend/zarch/test/test_assembler.py
b/rpython/jit/backend/zarch/test/test_assembler.py
--- a/rpython/jit/backend/zarch/test/test_assembler.py
+++ b/rpython/jit/backend/zarch/test/test_assembler.py
@@ -204,8 +204,9 @@
self.a.mc.LARL(r.r5, loc.imm(-8))
self.a.mc.LG(r.r4, loc.addr(8,r.r5))
self.a.mc.AG(r.r4, loc.addr(0,r.r5))
+ self.a.mc.LGR(r.r2, r.r4)
self.a.jmpto(r.r14)
- assert run_asm(self.a) == 0
+ assert run_asm(self.a) == -2
def test_xor(self):
self.a.mc.XGR(r.r2, r.r2)
diff --git a/rpython/jit/backend/zarch/test/test_runner.py
b/rpython/jit/backend/zarch/test/test_runner.py
--- a/rpython/jit/backend/zarch/test/test_runner.py
+++ b/rpython/jit/backend/zarch/test/test_runner.py
@@ -28,3 +28,36 @@
# realloc frame takes the most space (from just after larl, to lay)
bridge_loop_instructions = "larl; lg; cgfi; je; lghi; stg; " \
"lay; lgfi;( iihf;)? lgfi;( iihf;)? basr; lay;
lg; br;$"
+
+ def test_multiple_arguments(self):
+ from rpython.rtyper.annlowlevel import llhelper
+ from rpython.jit.metainterp.typesystem import deref
+ from rpython.rlib.jit_libffi import types
+ from rpython.jit.codewriter.effectinfo import EffectInfo
+ from rpython.rlib.rarithmetic import intmask
+
+ def func_int(a, b, c, d, e, f):
+ sum = intmask(a) + intmask(b) + intmask(c) + intmask(d) +
intmask(e) + intmask(f)
+ return sum
+
+ functions = [
+ (func_int, lltype.Signed, types.sint, 655360, 655360),
+ (func_int, lltype.Signed, types.sint, 655360, -293999429),
+ ]
+
+ cpu = self.cpu
+ for func, TP, ffi_type, num, num1 in functions:
+ #
+ FPTR = self.Ptr(self.FuncType([TP] * 6, TP))
+ func_ptr = llhelper(FPTR, func)
+ FUNC = deref(FPTR)
+ funcbox = self.get_funcbox(cpu, func_ptr)
+ # first, try it with the "normal" calldescr
+ calldescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
+ EffectInfo.MOST_GENERAL)
+ iargs = [0x7fffFFFFffffFFFF,1,0,0,0,0]
+ args = [InputArgInt(num) for num in iargs]
+ res = self.execute_operation(rop.CALL_I,
+ [funcbox] + args,
+ 'int', descr=calldescr)
+ assert res == sum(iargs)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit