[pypy-svn] pypy jit-unroll-loops: Testing with CALL_LOOPINVARIANT and GUARD_NO_EXCEPTION in short preamble
hakanardo
commits-noreply at bitbucket.org
Tue Jan 4 21:59:47 CET 2011
Author: Hakan Ardo <hakan at debian.org>
Branch: jit-unroll-loops
Changeset: r40400:f342eb27760a
Date: 2011-01-04 21:48 +0100
http://bitbucket.org/pypy/pypy/changeset/f342eb27760a/
Log: Testing with CALL_LOOPINVARIANT and GUARD_NO_EXCEPTION in short
preamble
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
@@ -6,6 +6,7 @@
from pypy.rlib.debug import debug_start, debug_stop, debug_print
from pypy.jit.metainterp.optimizeutil import InvalidLoop, RetraceLoop
from pypy.jit.metainterp.jitexc import JitException
+from pypy.jit.metainterp.history import make_hashable_int
# FIXME: Introduce some VirtualOptimizer super class instead
@@ -255,7 +256,7 @@
loop_ops = loop.operations
boxmap = BoxMap()
- state = ExeState()
+ state = ExeState(self.optimizer)
short_preamble = []
loop_i = preamble_i = 0
while preamble_i < len(preamble_ops):
@@ -330,7 +331,8 @@
return short_preamble
class ExeState(object):
- def __init__(self):
+ def __init__(self, optimizer):
+ self.optimizer = optimizer
self.heap_dirty = False
self.unsafe_getitem = {}
@@ -351,6 +353,16 @@
if descr in self.unsafe_getitem:
return False
return True
+ elif opnum == rop.CALL:
+ arg = op.getarg(0)
+ if isinstance(arg, Const):
+ key = make_hashable_int(arg.getint())
+ resvalue = self.optimizer.loop_invariant_results.get(key, None)
+ if resvalue:
+ return True # This once was CALL_LOOPINVARIANT
+ # FIXME: Can we realy be sure of that?
+ elif opnum == rop.GUARD_NO_EXCEPTION:
+ return True # FIXME: Is this safe?
return False
def update(self, op):
More information about the Pypy-commit
mailing list