[pypy-svn] r63635 - pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86
fijal at codespeak.net
fijal at codespeak.net
Sat Apr 4 23:31:07 CEST 2009
Author: fijal
Date: Sat Apr 4 23:31:06 2009
New Revision: 63635
Modified:
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/runner.py
Log:
do a dumb thing - hardcode maximal possible length of failboxes. I think
we need to live with it at least for now, since the way it's computed
might simply go away.
Add a marker if we want to know where is a failing guard
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py Sat Apr 4 23:31:06 2009
@@ -19,6 +19,8 @@
# our calling convention - we pass three first args as edx, ecx and eax
# and the rest stays on the stack
+MAX_FAIL_BOXES = 1000
+
def repr_of_arg(memo, arg):
try:
mv = memo[arg]
@@ -63,6 +65,7 @@
log_fd = -1
mc = None
mc2 = None
+ debug_markers = False
def __init__(self, cpu, translate_support_code=False):
self.cpu = cpu
@@ -88,6 +91,10 @@
def make_sure_mc_exists(self):
if self.mc is None:
+ self.fail_boxes = lltype.malloc(rffi.CArray(lltype.Signed),
+ MAX_FAIL_BOXES, flavor='raw')
+ self.fail_box_addr = self.cpu.cast_ptr_to_int(self.fail_boxes)
+
self._log_fd = self._get_log()
# we generate the loop body in 'mc'
# 'mc2' is for guard recovery code
@@ -164,17 +171,14 @@
if op.is_guard():
max_so_far = max(max_so_far, self._compute_longest_fail_op(
op.suboperations))
+ assert max_so_far < MAX_FAIL_BOXES
return max_so_far
def assemble(self, tree):
# the last operation can be 'jump', 'return' or 'guard_pause';
# a 'jump' can either close a loop, or end a bridge to some
# previously-compiled code.
- num = self._compute_longest_fail_op(tree.operations)
- fail_boxes = lltype.malloc(rffi.CArray(lltype.Signed), num,
- flavor='raw')
- self.fail_box_addr = self.cpu.cast_ptr_to_int(fail_boxes)
- tree.fail_boxes = fail_boxes
+ self._compute_longest_fail_op(tree.operations)
self.make_sure_mc_exists()
inputargs = tree.inputargs
op0 = tree.operations[0]
@@ -610,6 +614,7 @@
return addr
def generate_failure(self, op, locs, guard_index):
+ pos = self.mc.tell()
for i in range(len(locs)):
loc = locs[i]
if isinstance(loc, REG):
@@ -619,6 +624,11 @@
if not isinstance(loc, REG):
self.mc.MOV(eax, loc)
self.mc.MOV(addr_add(imm(self.fail_box_addr), imm(i*WORD)), eax)
+ if self.debug_markers:
+ self.mc.MOV(eax, imm(pos))
+ self.mc.MOV(addr_add(imm(self.fail_box_addr),
+ imm(len(locs) * WORD)),
+ eax)
if op.ovf:
ovf_error_vtable = self.cpu.cast_adr_to_int(self._ovf_error_vtable)
self.mc.MOV(eax, imm(ovf_error_vtable))
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/runner.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/runner.py Sat Apr 4 23:31:06 2009
@@ -279,7 +279,7 @@
op = self._guard_list[guard_index]
for i in range(len(op.args)):
box = op.args[i]
- self.set_value_of_box(box, i, loop.fail_boxes)
+ self.set_value_of_box(box, i, self.assembler.fail_boxes)
return op
def execute_call(self, loop, func, values_as_int):
More information about the Pypy-commit
mailing list