[pypy-svn] r76129 - in pypy/branch/kill-caninline/pypy/jit/metainterp: . test
arigo at codespeak.net
arigo at codespeak.net
Mon Jul 12 11:54:21 CEST 2010
Author: arigo
Date: Mon Jul 12 11:54:19 2010
New Revision: 76129
Modified:
pypy/branch/kill-caninline/pypy/jit/metainterp/blackhole.py
pypy/branch/kill-caninline/pypy/jit/metainterp/pyjitpl.py
pypy/branch/kill-caninline/pypy/jit/metainterp/test/test_recursive.py
Log:
Testing code, and fix in pyjitpl.py (see comment).
Modified: pypy/branch/kill-caninline/pypy/jit/metainterp/blackhole.py
==============================================================================
--- pypy/branch/kill-caninline/pypy/jit/metainterp/blackhole.py (original)
+++ pypy/branch/kill-caninline/pypy/jit/metainterp/blackhole.py Mon Jul 12 11:54:19 2010
@@ -2,7 +2,7 @@
from pypy.rlib.rarithmetic import intmask, LONG_BIT, r_uint, ovfcheck
from pypy.rlib.objectmodel import we_are_translated
from pypy.rlib.debug import debug_start, debug_stop
-from pypy.rlib.debug import make_sure_not_resized
+from pypy.rlib.debug import make_sure_not_resized, fatalerror
from pypy.rpython.lltypesystem import lltype, llmemory, rclass
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rpython.llinterp import LLException
@@ -756,6 +756,10 @@
assert e
reraise(e)
+ @arguments("r")
+ def bhimpl_debug_fatalerror(msg):
+ llop.debug_fatalerror(lltype.Void, msg)
+
# ----------
# the main hints and recursive calls
Modified: pypy/branch/kill-caninline/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/kill-caninline/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/kill-caninline/pypy/jit/metainterp/pyjitpl.py Mon Jul 12 11:54:19 2010
@@ -825,12 +825,21 @@
else:
warmrunnerstate = jitdriver_sd.warmstate
token = warmrunnerstate.get_assembler_token(greenboxes)
- resbox = self.do_recursive_call(jitdriver_sd,
- greenboxes + redboxes,
- token)
- # in case of exception, do_recursive_call() stops by raising
- # the ChangeFrame exception already.
- self.metainterp.finishframe(resbox)
+ # warning! careful here. We have to return from the current
+ # frame containing the jit_merge_point, and then use
+ # do_recursive_call() to follow the recursive call. This is
+ # needed because do_recursive_call() will write its result
+ # with make_result_of_lastop(), so the lastop must be right:
+ # it must be the call to 'self', and not the jit_merge_point
+ # itself, which has no lastop at all.
+ assert self.metainterp.framestack
+ try:
+ self.metainterp.finishframe(None)
+ except ChangeFrame:
+ pass
+ frame = self.metainterp.framestack[-1]
+ frame.do_recursive_call(jitdriver_sd, greenboxes + redboxes, token)
+ raise ChangeFrame
def debug_merge_point(self, jitdriver_sd, greenkey):
# debugging: produce a DEBUG_MERGE_POINT operation
@@ -881,6 +890,12 @@
return exc_value_box
@arguments("box")
+ def opimpl_debug_fatalerror(self, box):
+ from pypy.rpython.lltypesystem import rstr, lloperation
+ msg = box.getref(lltype.Ptr(rstr.STR))
+ lloperation.llop.debug_fatalerror(msg)
+
+ @arguments("box")
def opimpl_virtual_ref(self, box):
# Details on the content of metainterp.virtualref_boxes:
#
Modified: pypy/branch/kill-caninline/pypy/jit/metainterp/test/test_recursive.py
==============================================================================
--- pypy/branch/kill-caninline/pypy/jit/metainterp/test/test_recursive.py (original)
+++ pypy/branch/kill-caninline/pypy/jit/metainterp/test/test_recursive.py Mon Jul 12 11:54:19 2010
@@ -2,6 +2,7 @@
from pypy.rlib.jit import JitDriver, we_are_jitted, OPTIMIZER_SIMPLE, hint
from pypy.rlib.jit import unroll_safe, dont_look_inside
from pypy.rlib.objectmodel import we_are_translated
+from pypy.rlib.debug import fatalerror
from pypy.jit.metainterp.test.test_basic import LLJitMixin, OOJitMixin
from pypy.jit.codewriter.policy import StopAtXPolicy
from pypy.rpython.annlowlevel import hlstr
@@ -770,7 +771,7 @@
res = self.meta_interp(main, [0], inline=True)
assert res == main(0)
- def test_directly_call_assembler_virtualizable_force(self):
+ def test_directly_call_assembler_virtualizable_force1(self):
class Thing(object):
def __init__(self, val):
self.val = val
@@ -797,6 +798,7 @@
return frame.thing.val
def portal(codeno, frame):
+ print 'ENTER:', codeno, frame.thing.val
i = 0
while i < 10:
driver.can_enter_jit(frame=frame, codeno=codeno, i=i)
@@ -806,11 +808,15 @@
subframe = Frame()
subframe.thing = Thing(nextval)
nextval = portal(1, subframe)
- elif frame.thing.val > 40:
- change(Thing(13))
- nextval = 13
+ elif codeno == 1:
+ if frame.thing.val > 40:
+ change(Thing(13))
+ nextval = 13
+ else:
+ fatalerror("bad codeno = " + str(codeno))
frame.thing = Thing(nextval + 1)
i += 1
+ print 'LEAVE:', codeno, frame.thing.val
return frame.thing.val
res = self.meta_interp(main, [0], inline=True,
More information about the Pypy-commit
mailing list