[pypy-svn] r62109 - pypy/branch/pyjitpl5/pypy/jit/metainterp
arigo at codespeak.net
arigo at codespeak.net
Tue Feb 24 15:11:39 CET 2009
Author: arigo
Date: Tue Feb 24 15:11:38 2009
New Revision: 62109
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
Log:
Re-add the optimization of not including in the liveboxes
of guard_false/guard_true the box that is being switched on.
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/history.py Tue Feb 24 15:11:38 2009
@@ -134,6 +134,9 @@
def _getrepr_(self):
return self.value
+CONST_FALSE = ConstInt(0)
+CONST_TRUE = ConstInt(1)
+
class ConstAddr(Const): # only for constants built before translation
type = 'int'
ever_seen = False
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py Tue Feb 24 15:11:38 2009
@@ -263,11 +263,14 @@
currentpc = self.pc
targetpc = target
opname = "guard_true"
+ const_if_fail = history.CONST_FALSE
else:
currentpc = target
targetpc = self.pc
opname = "guard_false"
- self.generate_guard(targetpc, opname, box, ignore_box=switchcase)
+ const_if_fail = history.CONST_TRUE
+ self.generate_guard(targetpc, opname, box, ignore_box=box,
+ const_if_fail=const_if_fail)
self.pc = currentpc
@arguments("orgpc", "box", "intargs", "jumptargets")
@@ -575,7 +578,8 @@
if stop:
break
- def generate_guard(self, pc, opname, box, extraargs=[], ignore_box=None):
+ def generate_guard(self, pc, opname, box, extraargs=[], ignore_box=None,
+ const_if_fail=None):
if isinstance(box, Const): # no need for a guard
return
if isinstance(self.metainterp.history, history.BlackHole):
@@ -583,8 +587,12 @@
liveboxes = []
for frame in self.metainterp.framestack:
for framebox in frame.env:
+ assert framebox is not None
if framebox is not ignore_box:
liveboxes.append(framebox)
+ else:
+ assert const_if_fail is not None
+ liveboxes.append(const_if_fail)
if box is not None:
extraargs = [box] + extraargs
guard_op = self.metainterp.history.record(opname, extraargs, [],
More information about the Pypy-commit
mailing list