[pypy-svn] r69890 - in pypy/branch/esp-params/pypy/jit/backend/x86: . test
pedronis at codespeak.net
pedronis at codespeak.net
Fri Dec 4 14:01:58 CET 2009
Author: pedronis
Date: Fri Dec 4 14:01:56 2009
New Revision: 69890
Modified:
pypy/branch/esp-params/pypy/jit/backend/x86/assembler.py
pypy/branch/esp-params/pypy/jit/backend/x86/regalloc.py
pypy/branch/esp-params/pypy/jit/backend/x86/test/test_regalloc.py
Log:
progress: basic logic in place, use sentinels local value in tests
next: factor out/cleanup up the logic in genop_call and reuse it consistently
Modified: pypy/branch/esp-params/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/esp-params/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/esp-params/pypy/jit/backend/x86/assembler.py Fri Dec 4 14:01:56 2009
@@ -160,10 +160,9 @@
assert ([loc.assembler() for loc in arglocs] ==
[loc.assembler() for loc in faildescr._x86_debug_faillocs])
regalloc = RegAlloc(self, self.cpu.translate_support_code)
- fail_frame_depth = faildescr._x86_current_frame_depth
- fail_param_depth = faildescr._x86_current_param_depth
- regalloc.prepare_bridge(fail_frame_depth, inputargs, arglocs,
- operations) # xxx param_depth
+ fail_depths = faildescr._x86_current_depths
+ regalloc.prepare_bridge(fail_depths, inputargs, arglocs,
+ operations)
adr_bridge = self.mc.tell()
adr_stackadjust = self._patchable_stackadjust()
frame_depth, param_depth = self._assemble(regalloc, operations)
@@ -196,7 +195,6 @@
target_frame_depth = jump_target_descr._x86_frame_depth
target_param_depth = jump_target_descr._x86_param_depth
frame_depth = max(frame_depth, target_frame_depth)
- # xxx tested?
param_depth = max(param_depth, target_param_depth)
return frame_depth, param_depth
@@ -308,11 +306,10 @@
genop_discard_list[op.opnum](self, op, arglocs)
def regalloc_perform_with_guard(self, op, guard_op, faillocs,
- arglocs, resloc, current_frame_depth):
+ arglocs, resloc, current_depths):
faildescr = guard_op.descr
assert isinstance(faildescr, AbstractFailDescr)
- faildescr._x86_current_frame_depth = current_frame_depth
- faildescr._x86_current_param_depth = 0 # xxx
+ faildescr._x86_current_depths = current_depths
failargs = guard_op.fail_args
guard_opnum = guard_op.opnum
failaddr = self.implement_guard_recovery(guard_opnum,
@@ -329,9 +326,9 @@
faildescr._x86_adr_jump_offset = adr_jump_offset
def regalloc_perform_guard(self, guard_op, faillocs, arglocs, resloc,
- current_frame_depth):
+ current_depths):
self.regalloc_perform_with_guard(None, guard_op, faillocs, arglocs,
- resloc, current_frame_depth)
+ resloc, current_depths)
def load_effective_addr(self, sizereg, baseofs, scale, result):
self.mc.LEA(result, addr_add(imm(0), sizereg, baseofs, scale))
@@ -1083,9 +1080,8 @@
extra_on_stack += round_up_to_4(arglocs[arg].width)
self._regalloc.reserve_param(extra_on_stack//4)
-
+
#extra_on_stack = self.align_stack_for_call(extra_on_stack)
- self.mc.SUB(esp, imm(extra_on_stack))
if isinstance(op.args[0], Const):
x = rel32(op.args[0].getint())
else:
@@ -1116,7 +1112,6 @@
p += round_up_to_4(loc.width)
self.mc.CALL(x)
self.mark_gc_roots()
- self.mc.ADD(esp, imm(extra_on_stack))
if isinstance(resloc, MODRM64):
self.mc.FSTP(resloc)
elif size == 1:
Modified: pypy/branch/esp-params/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/esp-params/pypy/jit/backend/x86/regalloc.py (original)
+++ pypy/branch/esp-params/pypy/jit/backend/x86/regalloc.py Fri Dec 4 14:01:56 2009
@@ -150,12 +150,12 @@
self.loop_consts = loop_consts
return self._process_inputargs(inputargs)
- def prepare_bridge(self, prev_frame_depth, inputargs, arglocs, operations):
+ def prepare_bridge(self, prev_depths, inputargs, arglocs, operations):
self._prepare(inputargs, operations)
self.loop_consts = {}
self._update_bindings(arglocs, inputargs)
- self.fm.frame_depth = prev_frame_depth
- self.param_depth = 0 # xxx
+ self.fm.frame_depth = prev_depths[0]
+ self.param_depth = prev_depths[1]
def reserve_param(self, n):
self.param_depth = max(self.param_depth, n)
@@ -290,9 +290,10 @@
faillocs = self.locs_for_fail(guard_op)
self.rm.position += 1
self.xrm.position += 1
+ current_depths = (self.fm.frame_depth, self.param_depth)
self.assembler.regalloc_perform_with_guard(op, guard_op, faillocs,
arglocs, result_loc,
- self.fm.frame_depth)
+ current_depths)
if op.result is not None:
self.possibly_free_var(op.result)
self.possibly_free_vars(guard_op.fail_args)
@@ -305,9 +306,10 @@
arglocs))
else:
self.assembler.dump('%s(%s)' % (guard_op, arglocs))
+ current_depths = (self.fm.frame_depth, self.param_depth)
self.assembler.regalloc_perform_guard(guard_op, faillocs, arglocs,
result_loc,
- self.fm.frame_depth)
+ current_depths)
self.possibly_free_vars(guard_op.fail_args)
def PerformDiscard(self, op, arglocs):
Modified: pypy/branch/esp-params/pypy/jit/backend/x86/test/test_regalloc.py
==============================================================================
--- pypy/branch/esp-params/pypy/jit/backend/x86/test/test_regalloc.py (original)
+++ pypy/branch/esp-params/pypy/jit/backend/x86/test/test_regalloc.py Fri Dec 4 14:01:56 2009
@@ -541,23 +541,23 @@
def test_one_call(self):
ops = '''
- [i0, i1]
- i2 = call(ConstClass(f1ptr), i0, descr=f1_calldescr)
- finish(i2)
+ [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9]
+ i10 = call(ConstClass(f1ptr), i0, descr=f1_calldescr)
+ finish(i10, i1, i2, i3, i4, i5, i6, i7, i8, i9)
'''
- loop = self.interpret(ops, [4, 7])
- assert self.getints(1) == [5]
+ loop = self.interpret(ops, [4, 7, 9, 9 ,9, 9, 9, 9, 9, 9, 9])
+ assert self.getints(11) == [5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9]
assert loop.token._x86_param_depth == 1
def test_two_calls(self):
ops = '''
- [i0, i1]
- i2 = call(ConstClass(f1ptr), i0, descr=f1_calldescr)
- i3 = call(ConstClass(f2ptr), i2, i1, descr=f2_calldescr)
- finish(i3)
+ [i0, i1, i2, i3, i4, i5, i6, i7, i8, i9]
+ i10 = call(ConstClass(f1ptr), i0, descr=f1_calldescr)
+ i11 = call(ConstClass(f2ptr), i10, i1, descr=f2_calldescr)
+ finish(i11, i1, i2, i3, i4, i5, i6, i7, i8, i9)
'''
- loop = self.interpret(ops, [4, 7])
- assert self.getints(1) == [5*7]
+ loop = self.interpret(ops, [4, 7, 9, 9 ,9, 9, 9, 9, 9, 9, 9])
+ assert self.getints(11) == [5*7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9]
assert loop.token._x86_param_depth == 2
def test_bridge_calls_1(self):
More information about the Pypy-commit
mailing list