[pypy-svn] r52009 - in pypy/branch/jit-refactoring/pypy/jit/rainbow: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Sat Mar 1 18:42:45 CET 2008
Author: cfbolz
Date: Sat Mar 1 18:42:44 2008
New Revision: 52009
Modified:
pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py
pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_vlist.py
Log:
support for green indirect calls
Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/codewriter.py Sat Mar 1 18:42:44 2008
@@ -80,6 +80,7 @@
self.graphs = [graph for (graph, tsgraph) in graph2tsgraph]
self.jitcodes = values
+ self.calldesc = CallDesc(codewriter.RGenOp, lltype.typeOf(fnptr))
class BytecodeWriter(object):
@@ -733,6 +734,8 @@
def serialize_op_indirect_call(self, op):
kind, withexc = self.guess_call_kind(op)
+ if kind == "green":
+ return self.handle_green_call(op, withexc, exclude_last=True)
targets = dict(self.graphs_from(op))
fnptrindex = self.serialize_oparg("red", op.args[0])
has_result = (self.varcolor(op.result) != "gray" and
@@ -772,10 +775,11 @@
elif kind == "gray":
self.emit("red_after_direct_call")
else:
- XXX
+ assert 0, "unknown call kind %s" % (kind, )
self.emit(label(("after indirect call", op)))
+
def handle_oopspec_call(self, op, withexc):
from pypy.jit.timeshifter.oop import Index
fnobj = op.args[0].value._obj
@@ -823,17 +827,21 @@
self.emit(self.promotiondesc_position(lltype.Signed))
self.emit(label(("oop_call", op)))
- def handle_green_call(self, op, withexc):
- voidargs = [const.value for const in op.args[1:]
+ def handle_green_call(self, op, withexc, exclude_last=False):
+ if exclude_last:
+ args = op.args[1:-1]
+ else:
+ args = op.args[1:]
+ voidargs = [const.value for const in args
if const.concretetype == lltype.Void]
fnptr = op.args[0]
- pos = self.calldesc_position(lltype.typeOf(fnptr.value), *voidargs)
+ pos = self.calldesc_position(fnptr.concretetype, *voidargs)
func = self.serialize_oparg("green", fnptr)
emitted_args = []
for v in op.args[1:]:
if v.concretetype != lltype.Void:
emitted_args.append(self.serialize_oparg("green", v))
- self.emit("green_direct_call")
+ self.emit("green_call")
self.emit(func, pos)
self.emit(len(emitted_args))
self.emit(*emitted_args)
Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/interpreter.py Sat Mar 1 18:42:44 2008
@@ -525,7 +525,7 @@
self.portalstate.portal_reentry(greenargs, redargs)
@arguments("green", "calldesc", "green_varargs")
- def opimpl_green_direct_call(self, fnptr_gv, calldesc, greenargs):
+ def opimpl_green_call(self, fnptr_gv, calldesc, greenargs):
calldesc.green_call(self, fnptr_gv, greenargs)
@arguments("green_varargs", "red_varargs", "bytecode")
Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_interpreter.py Sat Mar 1 18:42:44 2008
@@ -1445,7 +1445,6 @@
self.check_insns({'direct_call': 1})
def test_indirect_sometimes_residual_pure_but_fixed_red_call(self):
- py.test.skip("not working yet")
def h1(x):
return x-2
def h2(x):
Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_vlist.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_vlist.py (original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_vlist.py Sat Mar 1 18:42:44 2008
@@ -144,7 +144,6 @@
self.check_insns({})
def test_frozen_list_indexerror(self):
- py.test.skip("implement me")
lst = [5, 7, 9]
def ll_function(x):
mylist = hint(lst, deepfreeze=True)
More information about the Pypy-commit
mailing list