[pypy-svn] r62197 - in pypy/branch/pyjitpl5/pypy: jit/backend/llgraph jit/metainterp jit/metainterp/test jit/tl module/pypyjit rpython
arigo at codespeak.net
arigo at codespeak.net
Thu Feb 26 18:45:41 CET 2009
Author: arigo
Date: Thu Feb 26 18:45:40 2009
New Revision: 62197
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py
pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/policy.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_basic.py
pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit.py
pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit_child.py
pypy/branch/pyjitpl5/pypy/module/pypyjit/portal.py
pypy/branch/pyjitpl5/pypy/rpython/llinterp.py
Log:
- Some progress in translating PyPy.
- Support for low-level ops of creating, reading
and writing a GcArray.
- Fixes of llinterp to let ExtendedLLFrame calls
create non-ExtendedLLFrames.
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/llimpl.py Thu Feb 26 18:45:40 2009
@@ -65,6 +65,7 @@
'bool_not' : (('bool',), 'bool'),
'new_with_vtable' : (('int', 'ptr'), 'ptr'),
'new' : (('int',), 'ptr'),
+ 'new_array' : (('int', 'int'), 'ptr'),
'oononnull' : (('ptr',), 'bool'),
'ooisnull' : (('ptr',), 'bool'),
'oois' : (('ptr', 'ptr'), 'bool'),
@@ -73,6 +74,8 @@
'getfield_gc' : (('ptr', 'fieldname'), 'intorptr'),
'setfield_raw' : (('ptr', 'fieldname', 'intorptr'), None),
'getfield_raw' : (('ptr', 'fieldname'), 'intorptr'),
+ 'setarrayitem_gc' : (('ptr', 'int', 'int', 'intorptr'), None),
+ 'getarrayitem_gc' : (('ptr', 'int', 'int'), 'intorptr'),
'call_ptr' : (('ptr', 'varargs'), 'ptr'),
'call__4' : (('ptr', 'varargs'), 'int'),
'call_void' : (('ptr', 'varargs'), None),
@@ -558,6 +561,11 @@
class ExtendedLLFrame(LLFrame):
+ def newsubframe(self, graph, args):
+ # the default implementation would also create an ExtendedLLFrame,
+ # but we don't want this to occur in our case
+ return LLFrame(graph, args, self.llinterpreter)
+
def op_return(self, value=None):
if self.last_exception is None:
raise ExecutionReturned(value)
@@ -668,6 +676,10 @@
self.op_setfield_gc(ptr, 2, vtable)
return ptr
+ def op_new_array(self, arraydesc, count):
+ ITEMTYPE = symbolic.Size2Type[arraydesc/2]
+ return lltype.malloc(lltype.GcArray(ITEMTYPE), count)
+
def op_getfield_gc(self, ptr, fielddesc):
STRUCT, fieldname = symbolic.TokenToField[fielddesc/2]
ptr = lltype.cast_opaque_ptr(lltype.Ptr(STRUCT), ptr)
@@ -679,22 +691,26 @@
lltype.Ptr(STRUCT))
return getattr(ptr, fieldname)
+ def _cast_newvalue(self, desc, TYPE, newvalue):
+ if desc % 2:
+ newvalue = lltype.cast_opaque_ptr(TYPE, newvalue)
+ else:
+ if isinstance(TYPE, lltype.Ptr):
+ assert TYPE.TO._gckind == 'raw'
+ newvalue = llmemory.cast_adr_to_ptr(
+ cast_int_to_adr(self.memocast, newvalue),
+ TYPE)
+ elif TYPE == llmemory.Address:
+ newvalue = cast_int_to_adr(self.memocast, newvalue)
+ return newvalue
+
def op_setfield_gc(self, ptr, fielddesc, newvalue):
offset = fielddesc/2
STRUCT, fieldname = symbolic.TokenToField[offset]
if lltype.typeOf(ptr) == llmemory.GCREF:
ptr = lltype.cast_opaque_ptr(lltype.Ptr(STRUCT), ptr)
FIELDTYPE = getattr(STRUCT, fieldname)
- if fielddesc % 2:
- newvalue = lltype.cast_opaque_ptr(FIELDTYPE, newvalue)
- else:
- if isinstance(FIELDTYPE, lltype.Ptr):
- assert FIELDTYPE.TO._gckind == 'raw'
- newvalue = llmemory.cast_adr_to_ptr(
- cast_int_to_adr(self.memocast, newvalue),
- FIELDTYPE)
- elif FIELDTYPE == llmemory.Address:
- newvalue = cast_int_to_adr(self.memocast, newvalue)
+ newvalue = self._cast_newvalue(fielddesc, FIELDTYPE, newvalue)
setattr(ptr, fieldname, newvalue)
def op_setfield_raw(self, intval, fielddesc, newvalue):
@@ -702,6 +718,16 @@
lltype.Ptr(STRUCT))
self.op_setfield_gc(ptr, fielddesc, newvalue)
+ def op_getarrayitem_gc(self, array, arraydesc, index):
+ array = array._obj.container
+ return array.getitem(index)
+
+ def op_setarrayitem_gc(self, array, arraydesc, index, newvalue):
+ ITEMTYPE = symbolic.Size2Type[arraydesc/2]
+ array = array._obj.container
+ newvalue = self._cast_newvalue(arraydesc, ITEMTYPE, newvalue)
+ array.setitem(index, newvalue)
+
def op_ooisnull(self, ptr):
if lltype.typeOf(ptr) != llmemory.GCREF:
ptr = cast_int_to_adr(self.memocast, ptr)
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/llgraph/runner.py Thu Feb 26 18:45:40 2009
@@ -253,6 +253,17 @@
return ofs*2 + bit
@staticmethod
+ def arraydescrof(A):
+ assert isinstance(A, lltype.GcArray)
+ size = symbolic.get_size(A.OF)
+ token = history.getkind(A.OF)
+ if token == 'ptr':
+ bit = 1
+ else:
+ bit = 0
+ return size*2 + bit
+
+ @staticmethod
def typefor(fielddesc):
if fielddesc % 2:
return 'ptr'
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/codewriter.py Thu Feb 26 18:45:40 2009
@@ -214,6 +214,7 @@
self.portal = portal
self.bytecode = self.codewriter.get_jitcode(graph)
if not codewriter.policy.look_inside_graph(graph):
+ assert not portal, "portal has been hidden!"
graph = make_calling_stub(codewriter.rtyper, graph)
self.graph = graph
@@ -499,17 +500,23 @@
# store the vtable as an address -- that's fine, because the
# GC doesn't need to follow them
self.emit('new_with_vtable',
- self.cpu.sizeof(STRUCT),
+ self.const_position(self.cpu.sizeof(STRUCT)),
self.const_position(vtable))
else:
- self.emit('new', self.cpu.sizeof(STRUCT))
+ self.emit('new', self.const_position(self.cpu.sizeof(STRUCT)))
self.register_var(op.result)
def serialize_op_malloc_varsize(self, op):
- # XXX strings only for now
- assert op.args[0].value == rstr.STR
assert op.args[1].value == {'flavor': 'gc'}
- self.emit('newstr', self.var_position(op.args[2]))
+ if op.args[0].value == rstr.STR:
+ self.emit('newstr', self.var_position(op.args[2]))
+ else:
+ # XXX only strings or simple arrays for now
+ ARRAY = op.args[0].value
+ arraydescr = self.cpu.arraydescrof(ARRAY)
+ self.emit('new_array')
+ self.emit(self.const_position(arraydescr))
+ self.emit(self.var_position(op.args[2]))
self.register_var(op.result)
def serialize_op_zero_gc_pointers_inside(self, op):
@@ -535,7 +542,7 @@
self.emit(self.var_position(v_inst))
offset = self.cpu.fielddescrof(v_inst.concretetype.TO,
c_fieldname.value)
- self.emit(offset)
+ self.emit(self.const_position(offset))
self.register_var(op.result)
#self._eventualy_builtin(op.result)
@@ -553,7 +560,7 @@
self.emit(self.var_position(v_inst))
offset = self.cpu.fielddescrof(v_inst.concretetype.TO,
c_fieldname.value)
- self.emit(offset)
+ self.emit(self.const_position(offset))
self.emit(self.var_position(v_value))
def is_typeptr_getset(self, op):
@@ -566,6 +573,26 @@
self.emit('guard_class', self.var_position(op.args[0]))
self.register_var(op.result)
+ def serialize_op_getarrayitem(self, op):
+ ARRAY = op.args[0].concretetype.TO
+ assert ARRAY._gckind == 'gc'
+ arraydescr = self.cpu.arraydescrof(ARRAY)
+ self.emit('getarrayitem_gc')
+ self.emit(self.var_position(op.args[0]))
+ self.emit(self.const_position(arraydescr))
+ self.emit(self.var_position(op.args[1]))
+ self.register_var(op.result)
+
+ def serialize_op_setarrayitem(self, op):
+ ARRAY = op.args[0].concretetype.TO
+ assert ARRAY._gckind == 'gc'
+ arraydescr = self.cpu.arraydescrof(ARRAY)
+ self.emit('setarrayitem_gc')
+ self.emit(self.var_position(op.args[0]))
+ self.emit(self.const_position(arraydescr))
+ self.emit(self.var_position(op.args[1]))
+ self.emit(self.var_position(op.args[2]))
+
def serialize_op_getinteriorarraysize(self, op):
# XXX only supports strings for now
assert op.args[0].concretetype == lltype.Ptr(rstr.STR)
@@ -725,7 +752,7 @@
self.emit('guard_nonvirtualized')
self.emit(self.var_position(op.args[0]))
self.emit(self.get_position(virtualizabledesc))
- self.emit(guard_field)
+ self.emit(self.const_position(guard_field))
# ----------
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/policy.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/policy.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/policy.py Thu Feb 26 18:45:40 2009
@@ -2,6 +2,8 @@
class JitPolicy(object):
def look_inside_function(self, func):
+ if hasattr(func, '_look_inside_me_'):
+ return func._look_inside_me_
# explicitly pure functions are always opaque
if getattr(func, '_pure_function_', False):
return False
@@ -29,14 +31,13 @@
return None
def guess_call_kind(self, op):
- targetgraphs = self.graphs_from(op)
- if targetgraphs is None:
- return 'residual'
- if len(targetgraphs) == 1:
- [targetgraph] = targetgraphs
+ if op.opname == 'direct_call':
+ targetgraph = op.args[0].value._obj.graph
if (hasattr(targetgraph, 'func') and
hasattr(targetgraph.func, 'oopspec')):
return 'builtin'
+ if self.graphs_from(op) is None:
+ return 'residual'
return 'regular'
@@ -48,3 +49,93 @@
if func in self.funcs:
return False
return super(StopAtXPolicy, self).look_inside_function(func)
+
+# ____________________________________________________________
+
+from pypy.annotation.specialize import getuniquenondirectgraph
+
+class ManualJitPolicy(JitPolicy):
+ def __init__(self, translator):
+ self.translator = translator
+ self.bookkeeper = translator.annotator.bookkeeper
+ self.enabled_graphs = {}
+ self.fill_seen_graphs()
+
+ def look_inside_graph(self, graph):
+ if self.enabled_graphs.get(graph):
+ return True
+ return super(ManualJitPolicy, self).look_inside_graph(graph)
+
+ def fill_seen_graphs(self):
+ # subclasses should have their own
+ pass
+
+ def _graph(self, func):
+ func = getattr(func, 'im_func', func)
+ desc = self.bookkeeper.getdesc(func)
+ return getuniquenondirectgraph(desc)
+
+ def seefunc(self, fromfunc, *tofuncs):
+ targetgraphs = {}
+ for tofunc in tofuncs:
+ targetgraphs[self._graph(tofunc)] = True
+ graphs = graphs_on_the_path_to(self.translator, self._graph(fromfunc),
+ targetgraphs)
+ for graph in graphs:
+ if graph not in self.enabled_graphs:
+ self.enabled_graphs[graph] = True
+ print '++', graph
+
+ def seepath(self, *path):
+ assert len(path) >= 2
+ for i in range(1, len(path)):
+ self.seefunc(path[i-1], path[i])
+
+ def seegraph(self, func, look=True):
+ graph = self._graph(func)
+ self.enabled_graphs[graph] = look
+ if look:
+ print '++', graph
+ else:
+ print '--', graph
+
+def enumerate_reachable_graphs(translator, startgraph):
+ from pypy.translator.backendopt.support import find_calls_from
+ pending = [(startgraph, None)]
+ yield pending[0]
+ seen = {startgraph: True}
+ while pending:
+ yield None # hack: a separator meaning "length increases now"
+ nextlengthlist = []
+ nextseen = {}
+ for node in pending:
+ head, tail = node
+ for block, callee in find_calls_from(translator, head):
+ if callee not in seen:
+ newnode = callee, node
+ yield newnode
+ nextlengthlist.append(newnode)
+ nextseen[callee] = True
+ pending = nextlengthlist
+ seen.update(nextseen)
+ yield None
+
+def graphs_on_the_path_to(translator, startgraph, targetgraphs):
+ targetgraphs = targetgraphs.copy()
+ result = {}
+ found = {}
+ for node in enumerate_reachable_graphs(translator, startgraph):
+ if node is None: # hack: a separator meaning "length increases now"
+ for graph in found:
+ del targetgraphs[graph]
+ found.clear()
+ if not targetgraphs:
+ return result
+ elif node[0] in targetgraphs:
+ found[node[0]] = True
+ while node is not None:
+ head, tail = node
+ result[head] = True
+ node = tail
+ raise Exception("did not reach all targets:\nmissing %r" % (
+ targetgraphs.keys(),))
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 Thu Feb 26 18:45:40 2009
@@ -293,13 +293,27 @@
self.pc = jumptargets[i]
break
- @arguments("int")
- def opimpl_new(self, size):
- self.execute('new', [ConstInt(size)], 'ptr')
-
- @arguments("int", "constbox")
- def opimpl_new_with_vtable(self, size, vtableref):
- self.execute('new_with_vtable', [ConstInt(size), vtableref], 'ptr')
+ @arguments("constbox")
+ def opimpl_new(self, sizebox):
+ self.execute('new', [sizebox], 'ptr')
+
+ @arguments("constbox", "constbox")
+ def opimpl_new_with_vtable(self, sizebox, vtablebox):
+ self.execute('new_with_vtable', [sizebox, vtablebox], 'ptr')
+
+ @arguments("constbox", "box")
+ def opimpl_new_array(self, itemsizebox, countbox):
+ self.execute('new_array', [itemsizebox, countbox], 'ptr')
+
+ @arguments("box", "constbox", "box")
+ def opimpl_getarrayitem_gc(self, arraybox, arraydesc, indexbox):
+ tp = self.metainterp.cpu.typefor(arraydesc.getint())
+ self.execute('getarrayitem_gc', [arraybox, arraydesc, indexbox], tp)
+
+ @arguments("box", "constbox", "box", "box")
+ def opimpl_setarrayitem_gc(self, arraybox, arraydesc, indexbox, itembox):
+ self.execute('setarrayitem_gc', [arraybox, arraydesc,
+ indexbox, itembox], 'void')
@arguments("box")
def opimpl_ptr_nonzero(self, box):
@@ -318,30 +332,30 @@
self.execute('ooisnot', [box1, box2], 'int', True)
- @arguments("box", "int")
+ @arguments("box", "constbox")
def opimpl_getfield_gc(self, box, fielddesc):
- tp = self.metainterp.cpu.typefor(fielddesc)
- self.execute('getfield_gc', [box, ConstInt(fielddesc)], tp)
- @arguments("box", "int")
+ tp = self.metainterp.cpu.typefor(fielddesc.getint())
+ self.execute('getfield_gc', [box, fielddesc], tp)
+ @arguments("box", "constbox")
def opimpl_getfield_pure_gc(self, box, fielddesc):
- tp = self.metainterp.cpu.typefor(fielddesc)
- self.execute('getfield_gc', [box, ConstInt(fielddesc)], tp, True)
- @arguments("box", "int", "box")
+ tp = self.metainterp.cpu.typefor(fielddesc.getint())
+ self.execute('getfield_gc', [box, fielddesc], tp, True)
+ @arguments("box", "constbox", "box")
def opimpl_setfield_gc(self, box, fielddesc, valuebox):
- self.execute('setfield_gc', [box, ConstInt(fielddesc), valuebox],
+ self.execute('setfield_gc', [box, fielddesc, valuebox],
'void')
- @arguments("box", "int")
+ @arguments("box", "constbox")
def opimpl_getfield_raw(self, box, fielddesc):
- tp = self.metainterp.cpu.typefor(fielddesc)
- self.execute('getfield_raw', [box, ConstInt(fielddesc)], tp)
- @arguments("box", "int")
+ tp = self.metainterp.cpu.typefor(fielddesc.getint())
+ self.execute('getfield_raw', [box, fielddesc], tp)
+ @arguments("box", "constbox")
def opimpl_getfield_pure_raw(self, box, fielddesc):
- tp = self.metainterp.cpu.typefor(fielddesc)
- self.execute('getfield_raw', [box, ConstInt(fielddesc)], tp, True)
- @arguments("box", "int", "box")
+ tp = self.metainterp.cpu.typefor(fielddesc.getint())
+ self.execute('getfield_raw', [box, fielddesc], tp, True)
+ @arguments("box", "constbox", "box")
def opimpl_setfield_raw(self, box, fielddesc, valuebox):
- self.execute('setfield_raw', [box, ConstInt(fielddesc), valuebox],
+ self.execute('setfield_raw', [box, fielddesc, valuebox],
'void')
@arguments("bytecode", "varargs")
@@ -490,11 +504,11 @@
'len', [builtin.len_func, box], 'int')
self.generate_guard(pc, "guard_len", box, [intbox])
- @arguments("orgpc", "box", "virtualizabledesc", "int")
+ @arguments("orgpc", "box", "virtualizabledesc", "constbox")
def opimpl_guard_nonvirtualized(self, pc, box, vdesc, guard_field):
clsbox = self.cls_of_box(box)
op = self.generate_guard(pc, 'guard_nonvirtualized', box,
- [clsbox, ConstInt(guard_field)])
+ [clsbox, guard_field])
if op:
op.desc = vdesc
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_basic.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_basic.py Thu Feb 26 18:45:40 2009
@@ -217,6 +217,12 @@
res = self.meta_interp(f, [55])
assert res == -1
+ def test_format(self):
+ def f(n):
+ return len("<%d>" % n)
+ res = self.interp_operations(f, [421])
+ assert res == 5
+
class TestOOtype(BasicTests, OOJitMixin):
pass
Modified: pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit.py Thu Feb 26 18:45:40 2009
@@ -55,7 +55,10 @@
child_pid = os.fork()
if child_pid == 0:
break
- os.waitpid(child_pid, 0)
+ try:
+ os.waitpid(child_pid, 0)
+ except KeyboardInterrupt:
+ pass
print '-' * 79
print 'Child process finished, press Enter to restart...'
raw_input()
Modified: pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit_child.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit_child.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/tl/pypyjit_child.py Thu Feb 26 18:45:40 2009
@@ -1,5 +1,6 @@
from pypy.rpython.lltypesystem import lltype
from pypy.jit.metainterp import warmspot
+from pypy.module.pypyjit.portal import PyPyJitPolicy
def run_child(glob, loc):
@@ -12,4 +13,5 @@
interp.heap.malloc_nonmovable = returns_null # XXX
print 'warmspot.jittify_and_run() started...'
- warmspot.jittify_and_run(interp, graph, [])
+ policy = PyPyJitPolicy(interp.typer.annotator.translator)
+ warmspot.jittify_and_run(interp, graph, [], policy=policy)
Modified: pypy/branch/pyjitpl5/pypy/module/pypyjit/portal.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/module/pypyjit/portal.py (original)
+++ pypy/branch/pyjitpl5/pypy/module/pypyjit/portal.py Thu Feb 26 18:45:40 2009
@@ -1,25 +1,23 @@
import pypy
-#from pypy.module.pypyjit.newbool import NewBoolDesc
-from pypy.translator.translator import graphof
-from pypy.annotation.specialize import getuniquenondirectgraph
-from pypy.jit.hintannotator.policy import ManualGraphPolicy
-
-class PyPyHintAnnotatorPolicy(ManualGraphPolicy):
- hotpath = True
-
- def look_inside_graph_of_module(self, graph, func, mod):
- if mod.startswith('pypy.objspace'):
+from pypy.jit.metainterp.policy import ManualJitPolicy
+
+
+class PyPyJitPolicy(ManualJitPolicy):
+
+ def look_inside_function(self, func):
+ mod = func.__module__ or '?'
+ if mod.startswith('pypy.objspace.'):
return False
if '_geninterp_' in func.func_globals: # skip all geninterped stuff
return False
- if mod.startswith('pypy.interpreter.astcompiler'):
+ if mod.startswith('pypy.interpreter.astcompiler.'):
return False
- if mod.startswith('pypy.interpreter.pyparser'):
+ if mod.startswith('pypy.interpreter.pyparser.'):
return False
if mod.startswith('pypy.module.'):
if not mod.startswith('pypy.module.pypyjit.'):
return False
- if mod.startswith('pypy.translator.goal.nanos'):
+ if mod.startswith('pypy.translator.'):
return False
if mod in forbidden_modules:
return False
@@ -27,7 +25,7 @@
return False
if func.__name__.startswith('fastfunc_'):
return False
- return True
+ return super(PyPyJitPolicy, self).look_inside_function(func)
def seebinary(self, opname):
name2 = name1 = opname[:3].lower()
@@ -74,7 +72,7 @@
descr_impl,
pypy.objspace.std.typeobject.W_TypeObject.is_heaptype)
- def fill_timeshift_graphs(self):
+ def fill_seen_graphs(self):
import pypy
# --------------------
@@ -100,18 +98,16 @@
pypy.objspace.std.Space.is_w)
self.seegraph(pypy.interpreter.pyframe.PyFrame.execute_frame, False)
# --------------------
- # special timeshifting logic for newbool
- #self.seegraph(pypy.objspace.std.Space.newbool, NewBoolDesc)
self.seepath(pypy.interpreter.pyframe.PyFrame.JUMP_IF_TRUE,
pypy.objspace.std.Space.is_true)
self.seepath(pypy.interpreter.pyframe.PyFrame.JUMP_IF_FALSE,
pypy.objspace.std.Space.is_true)
#
- self.seepath(pypy.interpreter.pyframe.PyFrame.CALL_FUNCTION,
- pypy.interpreter.function.Function.funccall_valuestack)
- self.seepath(pypy.interpreter.pyframe.PyFrame.CALL_FUNCTION,
- pypy.interpreter.function.Function.funccall_obj_valuestack)
+ #self.seepath(pypy.interpreter.pyframe.PyFrame.CALL_FUNCTION,
+ # pypy.interpreter.function.Function.funccall_valuestack)
+ #self.seepath(pypy.interpreter.pyframe.PyFrame.CALL_FUNCTION,
+ # pypy.interpreter.function.Function.funccall_obj_valuestack)
Modified: pypy/branch/pyjitpl5/pypy/rpython/llinterp.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/llinterp.py (original)
+++ pypy/branch/pyjitpl5/pypy/rpython/llinterp.py Thu Feb 26 18:45:40 2009
@@ -204,6 +204,9 @@
self.curr_operation_index = 0
self.alloca_objects = []
+ def newsubframe(self, graph, args):
+ return self.__class__(graph, args, self.llinterpreter)
+
# _______________________________________________________
# variable setters/getters helpers
@@ -662,7 +665,7 @@
if not lltype.isCompatibleType(T, v.concretetype):
raise TypeError("graph with %r args called with wrong func ptr type: %r" %
(tuple([v.concretetype for v in args_v]), ARGS))
- frame = self.__class__(graph, args, self.llinterpreter)
+ frame = self.newsubframe(graph, args)
return frame.eval()
def op_direct_call(self, f, *args):
@@ -689,7 +692,7 @@
args = []
for inarg, arg in zip(inargs, obj.graph.startblock.inputargs):
args.append(lltype._cast_whatever(arg.concretetype, inarg))
- frame = self.__class__(graph, args, self.llinterpreter)
+ frame = self.newsubframe(graph, args)
result = frame.eval()
from pypy.translator.stackless.frame import storage_type
assert storage_type(lltype.typeOf(result)) == TGT
More information about the Pypy-commit
mailing list