diff options
author | Armin Rigo <arigo@tunes.org> | 2011-11-07 16:15:02 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2011-11-07 16:15:02 +0100 |
commit | 21d2d08b7ea22119a7d3716fd9d56145d1f15d73 (patch) | |
tree | a6a1c9fdc7678dc59d56311a8cc2f2c3359bac82 /pypy/jit/metainterp/optimizeopt/optimizer.py | |
parent | Python 2.5 support. (diff) | |
download | pypy-21d2d08b7ea22119a7d3716fd9d56145d1f15d73.tar.gz pypy-21d2d08b7ea22119a7d3716fd9d56145d1f15d73.tar.bz2 pypy-21d2d08b7ea22119a7d3716fd9d56145d1f15d73.zip |
(antocuni, hakan, arigo)
Kill 'exception_might_have_happened' and the 'bridge' boolean
field of Optimizer. Simplify some of the 'posponedop' mess, by
explicitly removing 'guard_no_exception' only if they immediately
follow a removed 'call'. This is detected with a new field
'last_emitted_operation', recording the last operation seen by a
'emit_operation'. Use this too to clean up intbounds overflow
checking.
Diffstat (limited to 'pypy/jit/metainterp/optimizeopt/optimizer.py')
-rw-r--r-- | pypy/jit/metainterp/optimizeopt/optimizer.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pypy/jit/metainterp/optimizeopt/optimizer.py b/pypy/jit/metainterp/optimizeopt/optimizer.py index 5deb08a16a..0c906372e0 100644 --- a/pypy/jit/metainterp/optimizeopt/optimizer.py +++ b/pypy/jit/metainterp/optimizeopt/optimizer.py @@ -6,7 +6,7 @@ from pypy.jit.metainterp.optimizeopt.intutils import IntBound, IntUnbounded, \ IntLowerBound, MININT, MAXINT from pypy.jit.metainterp.optimizeopt.util import (make_dispatcher_method, args_dict) -from pypy.jit.metainterp.resoperation import rop, ResOperation +from pypy.jit.metainterp.resoperation import rop, ResOperation, AbstractResOp from pypy.jit.metainterp.typesystem import llhelper, oohelper from pypy.tool.pairtype import extendabletype from pypy.rlib.debug import debug_start, debug_stop, debug_print @@ -249,6 +249,8 @@ CVAL_ZERO = ConstantValue(CONST_0) CVAL_ZERO_FLOAT = ConstantValue(Const._new(0.0)) llhelper.CVAL_NULLREF = ConstantValue(llhelper.CONST_NULL) oohelper.CVAL_NULLREF = ConstantValue(oohelper.CONST_NULL) +REMOVED = AbstractResOp(None) + class Optimization(object): next_optimization = None @@ -260,6 +262,7 @@ class Optimization(object): raise NotImplementedError def emit_operation(self, op): + self.last_emitted_operation = op self.next_optimization.propagate_forward(op) # FIXME: Move some of these here? @@ -327,13 +330,13 @@ class Optimization(object): def forget_numberings(self, box): self.optimizer.forget_numberings(box) + class Optimizer(Optimization): - def __init__(self, metainterp_sd, loop, optimizations=None, bridge=False): + def __init__(self, metainterp_sd, loop, optimizations=None): self.metainterp_sd = metainterp_sd self.cpu = metainterp_sd.cpu self.loop = loop - self.bridge = bridge self.values = {} self.interned_refs = self.cpu.ts.new_ref_dict() self.interned_ints = {} @@ -341,7 +344,6 @@ class Optimizer(Optimization): self.bool_boxes = {} self.producer = {} self.pendingfields = [] - self.exception_might_have_happened = False self.quasi_immutable_deps = None self.opaque_pointers = {} self.replaces_guard = {} @@ -363,6 +365,7 @@ class Optimizer(Optimization): optimizations[-1].next_optimization = self for o in optimizations: o.optimizer = self + o.last_emitted_operation = None o.setup() else: optimizations = [] @@ -497,7 +500,6 @@ class Optimizer(Optimization): return CVAL_ZERO def propagate_all_forward(self): - self.exception_might_have_happened = self.bridge self.clear_newoperations() for op in self.loop.operations: self.first_optimization.propagate_forward(op) |