[pypy-svn] r69673 - in pypy/branch/virtual-forcing/pypy/jit/backend: . llgraph test x86
fijal at codespeak.net
fijal at codespeak.net
Fri Nov 27 01:27:02 CET 2009
Author: fijal
Date: Fri Nov 27 01:27:01 2009
New Revision: 69673
Modified:
pypy/branch/virtual-forcing/pypy/jit/backend/llgraph/runner.py
pypy/branch/virtual-forcing/pypy/jit/backend/model.py
pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py
pypy/branch/virtual-forcing/pypy/jit/backend/x86/assembler.py
pypy/branch/virtual-forcing/pypy/jit/backend/x86/regalloc.py
pypy/branch/virtual-forcing/pypy/jit/backend/x86/runner.py
Log:
Pass descr and live args as argument to force, up to discussion.
Enough to implement this on x86 backend.
Modified: pypy/branch/virtual-forcing/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/backend/llgraph/runner.py (original)
+++ pypy/branch/virtual-forcing/pypy/jit/backend/llgraph/runner.py Fri Nov 27 01:27:01 2009
@@ -497,7 +497,7 @@
def do_cast_ptr_to_int(self, ptrbox):
return history.BoxInt(llimpl.cast_to_int(ptrbox.getref_base(),
self.memo_cast))
- def force(self, force_token):
+ def force(self, force_token, descr, args):
frame = llimpl.force(self.cast_int_to_adr(force_token))
self.latest_frame = frame
Modified: pypy/branch/virtual-forcing/pypy/jit/backend/model.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/backend/model.py (original)
+++ pypy/branch/virtual-forcing/pypy/jit/backend/model.py Fri Nov 27 01:27:01 2009
@@ -211,7 +211,7 @@
def do_call_may_force(self, args, calldescr):
raise NotImplementedError
- def force(self, force_token):
+ def force(self, force_token, descr, args):
raise NotImplementedError
# ootype specific operations
Modified: pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py (original)
+++ pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py Fri Nov 27 01:27:01 2009
@@ -1225,7 +1225,7 @@
values = []
def maybe_force(token, flag):
if flag:
- self.cpu.force(token)
+ self.cpu.force(token, faildescr, [i1, i0])
values.append(self.cpu.get_latest_value_int(0))
values.append(self.cpu.get_latest_value_int(1))
@@ -1237,11 +1237,12 @@
i0 = BoxInt()
i1 = BoxInt()
tok = BoxInt()
+ faildescr = BasicFailDescr(1)
ops = [
ResOperation(rop.FORCE_TOKEN, [], tok),
ResOperation(rop.CALL_MAY_FORCE, [funcbox, tok, i1], None,
descr=calldescr),
- ResOperation(rop.GUARD_NOT_FORCED, [], None, descr=BasicFailDescr(1)),
+ ResOperation(rop.GUARD_NOT_FORCED, [], None, descr=faildescr),
ResOperation(rop.FINISH, [i0], None, descr=BasicFailDescr(0))
]
ops[2].fail_args = [i1, i0]
Modified: pypy/branch/virtual-forcing/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/virtual-forcing/pypy/jit/backend/x86/assembler.py Fri Nov 27 01:27:01 2009
@@ -684,6 +684,11 @@
self.mc.CMP(heap(self.cpu.pos_exception()), imm(0))
return self.implement_guard(addr, self.mc.JNZ)
+ def genop_guard_guard_not_forced(self, ign_1, guard_op, addr,
+ locs, ign_2):
+ self.mc.CMP(mem(ebp, self.cpu.virtualizable_ofs), imm(0))
+ return self.implement_guard(addr, self.mc.JNZ)
+
def genop_guard_guard_exception(self, ign_1, guard_op, addr,
locs, resloc):
loc = locs[0]
Modified: pypy/branch/virtual-forcing/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/backend/x86/regalloc.py (original)
+++ pypy/branch/virtual-forcing/pypy/jit/backend/x86/regalloc.py Fri Nov 27 01:27:01 2009
@@ -399,7 +399,7 @@
consider_guard_isnull = _consider_guard
def consider_guard_not_forced(self, op, ignored):
- pass
+ self.perform_guard(op, [], None)
def consider_finish(self, op, ignored):
locs = [self.loc(v) for v in op.args]
Modified: pypy/branch/virtual-forcing/pypy/jit/backend/x86/runner.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/backend/x86/runner.py (original)
+++ pypy/branch/virtual-forcing/pypy/jit/backend/x86/runner.py Fri Nov 27 01:27:01 2009
@@ -8,7 +8,6 @@
from pypy.jit.backend.x86.assembler import Assembler386
from pypy.jit.backend.llsupport.llmodel import AbstractLLCPU
-
class CPU386(AbstractLLCPU):
debug = True
supports_floats = True
@@ -87,10 +86,26 @@
adr = llmemory.cast_ptr_to_adr(x)
return CPU386.cast_adr_to_int(adr)
- def force(self, stack_base):
+ def force(self, stack_base, descr, args):
+ # args parameter is there only for types
TP = rffi.CArrayPtr(lltype.Signed)
rffi.cast(TP, stack_base + self.virtualizable_ofs)[0] = 1
- # force stuff actually...
+ # move things to latest values
+ arglocs = self.assembler.rebuild_faillocs_from_descr(
+ descr._x86_failure_recovery_bytecode)
+ assert len(arglocs) == len(args)
+ for i in range(len(arglocs)):
+ arg = args[i]
+ argloc = arglocs[i]
+ if arg.type == history.FLOAT:
+ xxx
+ elif arg.type == history.REF:
+ xxx
+ elif arg.type == history.INT:
+ pos = stack_base + argloc.ofs_relative_to_ebp()
+ self.assembler.fail_boxes_int.setitem(i, rffi.cast(TP, pos)[0])
+ else:
+ raise NotImplementedError
class CPU386_NO_SSE2(CPU386):
supports_floats = False
More information about the Pypy-commit
mailing list