[pypy-commit] pypy jit-optimizeopt-cleanups: kill the now obsolete dryrun
hakanardo
noreply at buildbot.pypy.org
Thu Sep 22 19:19:11 CEST 2011
Author: Hakan Ardo <hakan at debian.org>
Branch: jit-optimizeopt-cleanups
Changeset: r47399:77e7b10d2e1c
Date: 2011-09-22 19:18 +0200
http://bitbucket.org/pypy/pypy/changeset/77e7b10d2e1c/
Log: kill the now obsolete dryrun
diff --git a/pypy/jit/metainterp/optimizeopt/optimizer.py b/pypy/jit/metainterp/optimizeopt/optimizer.py
--- a/pypy/jit/metainterp/optimizeopt/optimizer.py
+++ b/pypy/jit/metainterp/optimizeopt/optimizer.py
@@ -251,12 +251,6 @@
def emit_operation(self, op):
self.next_optimization.propagate_forward(op)
- def test_emittable(self, op):
- return self.is_emittable(op)
-
- def is_emittable(self, op):
- return self.next_optimization.test_emittable(op)
-
# FIXME: Move some of these here?
def getvalue(self, box):
return self.optimizer.getvalue(box)
@@ -498,9 +492,6 @@
self.producer[op.result] = op
dispatch_opt(self, op)
- def test_emittable(self, op):
- return True
-
def emit_operation(self, op):
if op.returns_bool_result():
self.bool_boxes[self.getvalue(op.result)] = None
diff --git a/pypy/jit/metainterp/optimizeopt/rewrite.py b/pypy/jit/metainterp/optimizeopt/rewrite.py
--- a/pypy/jit/metainterp/optimizeopt/rewrite.py
+++ b/pypy/jit/metainterp/optimizeopt/rewrite.py
@@ -31,19 +31,6 @@
dispatch_opt(self, op)
- def test_emittable(self, op):
- opnum = op.getopnum()
- for value, cls, func in optimize_guards:
- if opnum == value:
- assert isinstance(op, cls)
- try:
- func(self, op, dryrun=True)
- return self.is_emittable(op)
- except InvalidLoop:
- return False
- return self.is_emittable(op)
-
-
def try_boolinvers(self, op, targs):
oldop = self.optimizer.pure_operations.get(targs, None)
if oldop is not None and oldop.getdescr() is op.getdescr():
@@ -247,7 +234,7 @@
self.emit_operation(ResOperation(rop.CALL, args, op.result,
op.getdescr()))
- def optimize_guard(self, op, constbox, emit_operation=True, dryrun=False):
+ def optimize_guard(self, op, constbox, emit_operation=True):
value = self.getvalue(op.getarg(0))
if value.is_constant():
box = value.box
@@ -255,36 +242,33 @@
if not box.same_constant(constbox):
raise InvalidLoop
return
- if dryrun: return
if emit_operation:
self.emit_operation(op)
value.make_constant(constbox)
self.optimizer.turned_constant(value)
- def optimize_GUARD_ISNULL(self, op, dryrun=False):
+ def optimize_GUARD_ISNULL(self, op):
value = self.getvalue(op.getarg(0))
if value.is_null():
return
elif value.is_nonnull():
raise InvalidLoop
- if dryrun: return
self.emit_operation(op)
value.make_constant(self.optimizer.cpu.ts.CONST_NULL)
- def optimize_GUARD_NONNULL(self, op, dryrun=False):
+ def optimize_GUARD_NONNULL(self, op):
value = self.getvalue(op.getarg(0))
if value.is_nonnull():
return
elif value.is_null():
raise InvalidLoop
- if dryrun: return
self.emit_operation(op)
value.make_nonnull(len(self.optimizer.newoperations) - 1)
- def optimize_GUARD_VALUE(self, op, dryrun=False):
+ def optimize_GUARD_VALUE(self, op):
value = self.getvalue(op.getarg(0))
emit_operation = True
- if not dryrun and value.last_guard_index != -1:
+ if value.last_guard_index != -1:
# there already has been a guard_nonnull or guard_class or
# guard_nonnull_class on this value, which is rather silly.
# replace the original guard with a guard_value
@@ -302,15 +286,15 @@
emit_operation = False
constbox = op.getarg(1)
assert isinstance(constbox, Const)
- self.optimize_guard(op, constbox, emit_operation, dryrun)
+ self.optimize_guard(op, constbox, emit_operation)
- def optimize_GUARD_TRUE(self, op, dryrun=False):
- self.optimize_guard(op, CONST_1, dryrun=dryrun)
+ def optimize_GUARD_TRUE(self, op):
+ self.optimize_guard(op, CONST_1)
- def optimize_GUARD_FALSE(self, op, dryrun=False):
- self.optimize_guard(op, CONST_0, dryrun=dryrun)
+ def optimize_GUARD_FALSE(self, op):
+ self.optimize_guard(op, CONST_0)
- def optimize_GUARD_CLASS(self, op, dryrun=False):
+ def optimize_GUARD_CLASS(self, op):
value = self.getvalue(op.getarg(0))
expectedclassbox = op.getarg(1)
assert isinstance(expectedclassbox, Const)
@@ -319,7 +303,6 @@
if realclassbox.same_constant(expectedclassbox):
return
raise InvalidLoop
- if dryrun: return
emit_operation = True
if value.last_guard_index != -1:
# there already has been a guard_nonnull or guard_class or
@@ -345,12 +328,13 @@
last_guard_index = value.last_guard_index
value.make_constant_class(expectedclassbox, last_guard_index)
- def optimize_GUARD_NONNULL_CLASS(self, op, dryrun=False):
- self.optimize_GUARD_NONNULL(op, True)
- self.optimize_GUARD_CLASS(op, dryrun)
+ def optimize_GUARD_NONNULL_CLASS(self, op):
+ value = self.getvalue(op.getarg(0))
+ if value.is_null():
+ raise InvalidLoop
+ self.optimize_GUARD_CLASS(op)
- def optimize_GUARD_NO_EXCEPTION(self, op, dryrun=False):
- if dryrun: return
+ def optimize_GUARD_NO_EXCEPTION(self, op):
if not self.optimizer.exception_might_have_happened:
return
self.emit_operation(op)
diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py b/pypy/jit/metainterp/optimizeopt/unroll.py
--- a/pypy/jit/metainterp/optimizeopt/unroll.py
+++ b/pypy/jit/metainterp/optimizeopt/unroll.py
@@ -483,11 +483,6 @@
if op.getopnum() == rop.JUMP:
loop_token = op.getdescr()
assert isinstance(loop_token, LoopToken)
- # FIXME: Use a tree, similar to the tree formed by the full
- # preamble and it's bridges, instead of a list to save time and
- # memory. This should also allow better behaviour in
- # situations that the is_emittable() chain currently cant
- # handle and the inlining fails unexpectedly belwo.
short = loop_token.short_preamble
if short:
args = op.getarglist()
More information about the pypy-commit
mailing list