Author: Maciej Fijalkowski <fij...@gmail.com> Branch: better-jit-hooks Changeset: r50994:f7c24c0067c5 Date: 2012-01-03 14:59 +0200 http://bitbucket.org/pypy/pypy/changeset/f7c24c0067c5/
Log: progress - have some more information on on_abort hook, kill some unnecessary clutter diff --git a/pypy/jit/codewriter/policy.py b/pypy/jit/codewriter/policy.py --- a/pypy/jit/codewriter/policy.py +++ b/pypy/jit/codewriter/policy.py @@ -13,6 +13,9 @@ self.supports_floats = False self.supports_longlong = False self.supports_singlefloats = False + if portal is None: + from pypy.rlib.jit import JitPortal + portal = JitPortal() self.portal = portal def set_supports_floats(self, flag): diff --git a/pypy/jit/metainterp/jitdriver.py b/pypy/jit/metainterp/jitdriver.py --- a/pypy/jit/metainterp/jitdriver.py +++ b/pypy/jit/metainterp/jitdriver.py @@ -21,7 +21,6 @@ # self.portal_finishtoken... pypy.jit.metainterp.pyjitpl # self.index ... pypy.jit.codewriter.call # self.mainjitcode ... pypy.jit.codewriter.call - # self.on_compile ... pypy.jit.metainterp.warmstate # These attributes are read by the backend in CALL_ASSEMBLER: # self.assembler_helper_adr 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 @@ -1793,7 +1793,10 @@ def aborted_tracing(self, reason): self.staticdata.profiler.count(reason) debug_print('~~~ ABORTING TRACING') - self.staticdata.warmrunnerdesc.on_abort(reason) + jd_sd = self.jitdriver_sd + greenkey = self.current_merge_points[0][0][:jd_sd.num_green_args] + self.staticdata.warmrunnerdesc.portal.on_abort(reason, jd_sd.jitdriver, + greenkey) self.staticdata.stats.aborted() def blackhole_if_trace_too_long(self): diff --git a/pypy/jit/metainterp/test/test_jitportal.py b/pypy/jit/metainterp/test/test_jitportal.py --- a/pypy/jit/metainterp/test/test_jitportal.py +++ b/pypy/jit/metainterp/test/test_jitportal.py @@ -9,7 +9,9 @@ reasons = [] class MyJitPortal(JitPortal): - def on_abort(self, reason): + def on_abort(self, reason, jitdriver, greenkey): + assert jitdriver is myjitdriver + assert len(greenkey) == 1 reasons.append(reason) portal = MyJitPortal() 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 @@ -206,12 +206,13 @@ vrefinfo = VirtualRefInfo(self) self.codewriter.setup_vrefinfo(vrefinfo) # + self.portal = policy.portal self.make_virtualizable_infos() self.make_exception_classes() self.make_driverhook_graphs() self.make_enter_functions() self.rewrite_jit_merge_points(policy) - self.make_portal_callbacks(policy.portal) + self.portal = policy.portal verbose = False # not self.cpu.translate_support_code self.codewriter.make_jitcodes(verbose=verbose) @@ -425,15 +426,6 @@ for jd in self.jitdrivers_sd: self.make_enter_function(jd) - def make_portal_callbacks(self, portal): - if portal is not None: - def on_abort(reason): - portal.on_abort(reason) - else: - def on_abort(reason): - pass - self.on_abort = on_abort - def make_enter_function(self, jd): from pypy.jit.metainterp.warmstate import WarmEnterState state = WarmEnterState(self, jd) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit