[pypy-svn] r41056 - in pypy/dist/pypy: module/pypyjit objspace/std
pedronis at codespeak.net
pedronis at codespeak.net
Thu Mar 22 14:51:12 CET 2007
Author: pedronis
Date: Thu Mar 22 14:51:10 2007
New Revision: 41056
Modified:
pypy/dist/pypy/module/pypyjit/newbool.py
pypy/dist/pypy/module/pypyjit/portal.py
pypy/dist/pypy/objspace/std/objspace.py
Log:
(pedronis, arigo and arre around)
see is_true, use the logic in newbool.py for the timeshifting of space.newbool(flag).
Modified: pypy/dist/pypy/module/pypyjit/newbool.py
==============================================================================
--- pypy/dist/pypy/module/pypyjit/newbool.py (original)
+++ pypy/dist/pypy/module/pypyjit/newbool.py Thu Mar 22 14:51:10 2007
@@ -50,7 +50,7 @@
vbool.ownbox = box
return vbool
- def metafunc(self, jitstate, valuebox):
+ def metafunc(self, jitstate, spacevoid, valuebox):
vbool = self.vboolfactory()
vbool.valuebox = valuebox
return vbool.ownbox
@@ -172,6 +172,7 @@
def exactmatch(self, vstruct, outgoingvarboxes, memo):
# XXX code duplication with rcontainer...
+ assert isinstance(vstruct, rcontainer.VirtualContainer)
contmemo = memo.containers
if self in contmemo:
ok = vstruct is contmemo[self]
Modified: pypy/dist/pypy/module/pypyjit/portal.py
==============================================================================
--- pypy/dist/pypy/module/pypyjit/portal.py (original)
+++ pypy/dist/pypy/module/pypyjit/portal.py Thu Mar 22 14:51:10 2007
@@ -1,13 +1,14 @@
from pypy.module.pypyjit.interp_jit import PORTAL
+from pypy.module.pypyjit.newbool import NewBoolDesc
from pypy.translator.translator import graphof
from pypy.annotation.specialize import getuniquenondirectgraph
from pypy.jit.hintannotator.annotator import HintAnnotatorPolicy
class PyPyHintAnnotatorPolicy(HintAnnotatorPolicy):
+ novirtualcontainer = True
+ oopspec = True
def __init__(self, timeshift_graphs):
- HintAnnotatorPolicy.__init__(self, novirtualcontainer = True,
- oopspec = True)
self.timeshift_graphs = timeshift_graphs
def look_inside_graph(self, graph):
@@ -112,8 +113,16 @@
for i in range(1, len(path)):
seefunc(path[i-1], path[i])
- def dontsee(func):
- result_graphs[_graph(func)] = False
+ def seegraph(func, look=True):
+ graph = _graph(func)
+ if look:
+ extra = ""
+ if look != True:
+ extra = " substituted with %s" % look
+ log('including graph %s%s' % (graph, extra))
+ else:
+ log('excluding graph %s' % (graph,))
+ result_graphs[graph] = look
def seebinary(opname):
name2 = name1 = opname[:3].lower()
@@ -148,7 +157,8 @@
descr_impl = getattr(pypy.objspace.descroperation.DescrOperation, name)
seepath(pypy.interpreter.pyframe.PyFrame.COMPARE_OP,
descr_impl,
- getattr(pypy.objspace.std.intobject, name +'__Int_Int'))
+ getattr(pypy.objspace.std.intobject, name +'__Int_Int'),
+ pypy.objspace.std.Space.newbool)
seepath(descr_impl,
pypy.objspace.std.typeobject.W_TypeObject.is_heaptype)
@@ -173,9 +183,15 @@
pypy.objspace.std.Space.gettypeobject)
seepath(pypy.objspace.descroperation.DescrOperation.add,
pypy.objspace.std.Space.is_w)
- dontsee(pypy.interpreter.pyframe.PyFrame.execute_frame)
+ seegraph(pypy.interpreter.pyframe.PyFrame.execute_frame, False)
# --------------------
-
+ # special timeshifting logic for newbool
+ seegraph(pypy.objspace.std.Space.newbool, NewBoolDesc)
+ seepath(pypy.interpreter.pyframe.PyFrame.JUMP_IF_TRUE,
+ pypy.objspace.std.Space.is_true)
+ seepath(pypy.interpreter.pyframe.PyFrame.JUMP_IF_FALSE,
+ pypy.objspace.std.Space.is_true)
+
return result_graphs
Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py (original)
+++ pypy/dist/pypy/objspace/std/objspace.py Thu Mar 22 14:51:10 2007
@@ -549,6 +549,8 @@
return w_one is w_two
def is_true(self, w_obj):
+ if isinstance(w_obj, W_BoolObject):
+ return w_obj.boolval
if type(w_obj) is self.DictObjectCls:
return w_obj.len() != 0
else:
More information about the Pypy-commit
mailing list