[pypy-svn] r62201 - in pypy/branch/pyjitpl5/pypy/jit: backend/llgraph metainterp metainterp/test
arigo at codespeak.net
arigo at codespeak.net
Fri Feb 27 09:32:15 CET 2009
Author: arigo
Date: Fri Feb 27 09:32:13 2009
New Revision: 62201
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_loop.py
Log:
Allow can_enter_jit to be placed outside the portal.
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py Fri Feb 27 09:32:13 2009
@@ -110,6 +110,10 @@
llimpl.frame_add_int(frame, box.value)
elif isinstance(box, history.BoxPtr):
llimpl.frame_add_ptr(frame, box.value)
+ elif isinstance(box, history.ConstInt):
+ llimpl.frame_add_int(frame, box.value)
+ elif isinstance(box, history.ConstPtr):
+ llimpl.frame_add_ptr(frame, box.value)
else:
raise Exception("bad box in valueboxes: %r" % (box,))
return self.loop(frame)
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py Fri Feb 27 09:32:13 2009
@@ -621,8 +621,8 @@
self.var_position(op.args[3]))
def serialize_op_jit_marker(self, op):
- assert self.portal, "jit_marker in non-main graph!"
if op.args[0].value == 'jit_merge_point':
+ assert self.portal, "jit_merge_point in non-main graph!"
self.emit('jit_merge_point')
assert ([self.var_position(i) for i in op.args[2:]] ==
range(0, 2*(len(op.args) - 2), 2))
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_loop.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_loop.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_loop.py Fri Feb 27 09:32:13 2009
@@ -398,3 +398,24 @@
# XXX maybe later optimize guard_value away
self.check_loops({'merge_point' : 1, 'int_add' : 6, 'int_gt' : 1,
'guard_false' : 1, 'jump' : 1, 'guard_value' : 3})
+
+ def test_can_enter_jit_outside_main_loop(self):
+ myjitdriver = JitDriver(greens=[], reds=['i', 'j', 'a'])
+ def done(a, j):
+ myjitdriver.can_enter_jit(i=0, j=j, a=a)
+ def main_interpreter_loop(a):
+ i = j = 0
+ while True:
+ myjitdriver.jit_merge_point(i=i, j=j, a=a)
+ i += 1
+ j += 3
+ if i >= 10:
+ a -= 1
+ if not a:
+ break
+ i = 0
+ done(a, j)
+ return j
+ assert main_interpreter_loop(5) == 5 * 10 * 3
+ res = self.meta_interp(main_interpreter_loop, [5])
+ assert res == 5 * 10 * 3
More information about the Pypy-commit
mailing list