Author: Maciej Fijalkowski <[email protected]>
Branch: continulet-jit-3
Changeset: r58263:ee7e755c20c7
Date: 2012-10-19 22:15 +0200
http://bitbucket.org/pypy/pypy/changeset/ee7e755c20c7/
Log: a failing test and I *think* a correct behavior
diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -753,8 +753,7 @@
jfdescr = jfdescrbox.getref_base()
descr = cpu.jitframe_cast_jfdescr_to_descr(jfdescr)
if not descr:
- XXX # shall we simply force and abort here??? this is an equivalent
- # of sys._getframe()
+ raise SwitchToBlackhole(Counters.ABORT_ESCAPE)
resume.rebuild_virtualizable_from_resumedata(self.metainterp, descr,
vinfo, box, jfbox)
self._opimpl_setfield_gc_any(box, vinfo.jit_frame_descr,
diff --git a/pypy/jit/metainterp/test/test_recursive.py
b/pypy/jit/metainterp/test/test_recursive.py
--- a/pypy/jit/metainterp/test/test_recursive.py
+++ b/pypy/jit/metainterp/test/test_recursive.py
@@ -958,7 +958,7 @@
policy=StopAtXPolicy(change))
assert res == main(0)
- def test_call_assembler_two_virtualizables(self):
+ def test_call_assembler_force_from_inside(self):
class Frame(object):
_virtualizable2_ = ['thing']
@@ -988,6 +988,37 @@
res = self.meta_interp(main, [], inline=True)
assert res == main()
+ def test_call_assembler_two_virtualizables(self):
+ class Frame(object):
+ _virtualizable2_ = ['thing']
+
+ def __init__(self, thing):
+ self.thing = thing
+
+ driver = JitDriver(greens = ['codeno'],
+ reds = ['i', 'frame', 'frames'],
+ virtualizables = ['frame'])
+
+ def portal(codeno, frame, frames):
+ i = 0
+ while i < 10:
+ driver.jit_merge_point(i=i, frame=frame, codeno=codeno,
+ frames=frames)
+ frame.thing = frame.thing + 1
+ if codeno == 0:
+ no = (i % 2)
+ newframe = frames[no]
+ frame.thing += portal(no + 1, newframe, None)
+ i += 1
+ return frame.thing
+
+ def main():
+ frames = [Frame(1), Frame(2)]
+ return portal(0, Frame(0), frames)
+
+ res = self.meta_interp(main, [], inline=True)
+ assert res == main()
+
def test_assembler_call_red_args(self):
driver = JitDriver(greens = ['codeno'], reds = ['i', 'k'],
get_printable_location = lambda codeno :
str(codeno))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit