[pypy-commit] pypy fix-sre-problems: check for trace tag overflow more systematically (thanks Armin)

cfbolz pypy.commits at gmail.com
Wed Mar 28 05:35:00 EDT 2018


Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: fix-sre-problems
Changeset: r94157:0d7163be06ae
Date: 2018-03-28 11:32 +0200
http://bitbucket.org/pypy/pypy/changeset/0d7163be06ae/

Log:	check for trace tag overflow more systematically (thanks Armin)

diff --git a/rpython/jit/metainterp/opencoder.py b/rpython/jit/metainterp/opencoder.py
--- a/rpython/jit/metainterp/opencoder.py
+++ b/rpython/jit/metainterp/opencoder.py
@@ -299,10 +299,9 @@
         self._ops[self._pos] = rffi.cast(model.STORAGE_TP, v)
         self._pos += 1
 
-    def tracing_done(self, abandoned_trace=False):
+    def tracing_done(self):
         from rpython.rlib.debug import debug_start, debug_stop, debug_print
-        if not abandoned_trace:
-            assert not self.tag_overflow
+        assert not self.tag_overflow
 
         self._bigints_dict = {}
         self._refs_dict = llhelper.new_ref_dict_3()
diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -2387,7 +2387,6 @@
         if (self.history.length() > warmrunnerstate.trace_limit or
                 self.history.trace_tag_overflow()):
             jd_sd, greenkey_of_huge_function = self.find_biggest_function()
-            self.history.trace.tracing_done(abandoned_trace=True)
             self.staticdata.stats.record_aborted(greenkey_of_huge_function)
             self.portal_trace_positions = None
             if greenkey_of_huge_function is not None:
@@ -2690,8 +2689,8 @@
                      try_disabling_unroll=False, exported_state=None):
         num_green_args = self.jitdriver_sd.num_green_args
         greenkey = original_boxes[:num_green_args]
-        if self.trace_tag_overflow():
-            raise SwitchToBlackhole(Counter.ABORT_TOO_LONG)
+        if self.history.trace_tag_overflow():
+            raise SwitchToBlackhole(Counters.ABORT_TOO_LONG)
         self.history.trace.tracing_done()
         if not self.partial_trace:
             ptoken = self.get_procedure_token(greenkey)
@@ -2745,8 +2744,8 @@
         self.history.record(rop.JUMP, live_arg_boxes[num_green_args:], None,
                             descr=target_jitcell_token)
         self.history.ends_with_jump = True
-        if self.trace_tag_overflow():
-            raise SwitchToBlackhole(Counter.ABORT_TOO_LONG)
+        if self.history.trace_tag_overflow():
+            raise SwitchToBlackhole(Counters.ABORT_TOO_LONG)
         self.history.trace.tracing_done()
         try:
             target_token = compile.compile_trace(self, self.resumekey,
@@ -2781,8 +2780,8 @@
             assert False
         # FIXME: can we call compile_trace?
         self.history.record(rop.FINISH, exits, None, descr=token)
-        if self.trace_tag_overflow():
-            raise SwitchToBlackhole(Counter.ABORT_TOO_LONG)
+        if self.history.trace_tag_overflow():
+            raise SwitchToBlackhole(Counters.ABORT_TOO_LONG)
         self.history.trace.tracing_done()
         target_token = compile.compile_trace(self, self.resumekey, exits)
         if target_token is not token:
@@ -2809,8 +2808,8 @@
         sd = self.staticdata
         token = sd.exit_frame_with_exception_descr_ref
         self.history.record(rop.FINISH, [valuebox], None, descr=token)
-        if self.trace_tag_overflow():
-            raise SwitchToBlackhole(Counter.ABORT_TOO_LONG)
+        if self.history.trace_tag_overflow():
+            raise SwitchToBlackhole(Counters.ABORT_TOO_LONG)
         self.history.trace.tracing_done()
         target_token = compile.compile_trace(self, self.resumekey, [valuebox])
         if target_token is not token:


More information about the pypy-commit mailing list