[pypy-commit] pypy clean-exported-state: Fix interaction with forcing virtual state and retracing
sbauman
pypy.commits at gmail.com
Thu Oct 13 10:00:07 EDT 2016
Author: Spenser Bauman <sabauma at gmail.com>
Branch: clean-exported-state
Changeset: r87755:259d7eac6056
Date: 2016-10-13 09:59 -0400
http://bitbucket.org/pypy/pypy/changeset/259d7eac6056/
Log: Fix interaction with forcing virtual state and retracing
Abort optimization when forcing portions of the virtual state
requires modifying an existing short preamble
diff --git a/rpython/jit/metainterp/optimizeopt/shortpreamble.py b/rpython/jit/metainterp/optimizeopt/shortpreamble.py
--- a/rpython/jit/metainterp/optimizeopt/shortpreamble.py
+++ b/rpython/jit/metainterp/optimizeopt/shortpreamble.py
@@ -5,6 +5,7 @@
rop, AbstractResOp, AbstractInputArg
from rpython.jit.metainterp.history import Const, make_hashable_int,\
TreeLoop
+from rpython.jit.metainterp.optimize import InvalidLoop
from rpython.jit.metainterp.optimizeopt import info
class PreambleOp(AbstractResOp):
@@ -494,16 +495,23 @@
self.sb = sb
self.extra_same_as = self.sb.extra_same_as
self.target_token = target_token
+ self.build_inplace = False
def setup(self, jump_args, short, label_args):
self.jump_args = jump_args
self.short = short
self.label_args = label_args
+ self.build_inplace = True
def add_preamble_op(self, preamble_op):
""" Notice that we're actually using the preamble_op, add it to
label and jump
"""
+ # Could this be considered a speculative error?
+ # This check should only fail when trying to jump to an existing trace
+ # by forcing portions of the virtualstate.
+ if not self.build_inplace:
+ raise InvalidLoop("Forcing boxes would modify an existing short preamble")
op = preamble_op.op.get_box_replacement()
if preamble_op.invented_name:
self.extra_same_as.append(op)
diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py
--- a/rpython/jit/metainterp/optimizeopt/unroll.py
+++ b/rpython/jit/metainterp/optimizeopt/unroll.py
@@ -350,6 +350,9 @@
self.optimizer.metainterp_sd.logger_ops.log_short_preamble([],
short_preamble, {})
raise
+ except InvalidLoop:
+ assert force_boxes
+ raise
self.send_extra_operation(jump_op.copy_and_change(rop.JUMP,
args=args + extra,
More information about the pypy-commit
mailing list