[pypy-commit] pypy default: Reintroduce a test similar to the previous one, and fix broken code.
arigo
noreply at buildbot.pypy.org
Sun Jan 13 16:37:27 CET 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r60031:73c6c33284b7
Date: 2013-01-13 15:41 +0100
http://bitbucket.org/pypy/pypy/changeset/73c6c33284b7/
Log: Reintroduce a test similar to the previous one, and fix broken code.
diff --git a/pypy/jit/metainterp/test/test_warmspot.py b/pypy/jit/metainterp/test/test_warmspot.py
--- a/pypy/jit/metainterp/test/test_warmspot.py
+++ b/pypy/jit/metainterp/test/test_warmspot.py
@@ -1,6 +1,6 @@
import py
from pypy.jit.metainterp.warmspot import get_stats
-from pypy.rlib.jit import JitDriver, set_param, unroll_safe
+from pypy.rlib.jit import JitDriver, set_param, unroll_safe, jit_callback
from pypy.jit.backend.llgraph import runner
from pypy.jit.metainterp.test.support import LLJitMixin, OOJitMixin
@@ -536,6 +536,24 @@
self.check_trace_count(1)
+ def test_callback_jit_merge_point(self):
+ @jit_callback("testing")
+ def callback(a, b):
+ if a > b:
+ return 1
+ return -1
+
+ def main():
+ total = 0
+ for i in range(10):
+ total += callback(i, 2)
+ return total
+
+ res = self.meta_interp(main, [])
+ assert res == 7 - 3
+ self.check_trace_count(2)
+
+
class TestLLWarmspot(WarmspotTests, LLJitMixin):
CPUClass = runner.LLGraphCPU
type_system = 'lltype'
diff --git a/pypy/jit/metainterp/warmspot.py b/pypy/jit/metainterp/warmspot.py
--- a/pypy/jit/metainterp/warmspot.py
+++ b/pypy/jit/metainterp/warmspot.py
@@ -360,13 +360,7 @@
jd._jit_merge_point_in = graph
args = op.args[2:]
s_binding = self.translator.annotator.binding
- if op.args[1].value.autoreds:
- # _portal_args_s is used only by _make_hook_graph, but for now we
- # declare the various set_jitcell_at, get_printable_location,
- # etc. as incompatible with autoreds
- jd._portal_args_s = None
- else:
- jd._portal_args_s = [s_binding(v) for v in args]
+ jd._portal_args_s = [s_binding(v) for v in args]
graph = copygraph(graph)
[jmpp] = find_jit_merge_points([graph])
graph.startblock = support.split_before_jit_merge_point(*jmpp)
@@ -614,9 +608,10 @@
if func is None:
return None
#
- assert not jitdriver_sd.jitdriver.autoreds, (
- "reds='auto' is not compatible with JitDriver hooks such as "
- "{get,set}_jitcell_at, get_printable_location, confirm_enter_jit, etc.")
+ if not onlygreens:
+ assert not jitdriver_sd.jitdriver.autoreds, (
+ "reds='auto' is not compatible with JitDriver hooks such as "
+ "confirm_enter_jit")
extra_args_s = []
if s_first_arg is not None:
extra_args_s.append(s_first_arg)
More information about the pypy-commit
mailing list