[pypy-svn] r51338 - in pypy/dist/pypy/jit/codegen/cli: . test
antocuni at codespeak.net
antocuni at codespeak.net
Fri Feb 8 16:17:22 CET 2008
Author: antocuni
Date: Fri Feb 8 16:17:21 2008
New Revision: 51338
Modified:
pypy/dist/pypy/jit/codegen/cli/rgenop.py
pypy/dist/pypy/jit/codegen/cli/test/test_rgenop.py
Log:
test_goto_* pass
Modified: pypy/dist/pypy/jit/codegen/cli/rgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/cli/rgenop.py (original)
+++ pypy/dist/pypy/jit/codegen/cli/rgenop.py Fri Feb 8 16:17:21 2008
@@ -1,7 +1,7 @@
from pypy.tool.pairtype import extendabletype
from pypy.rpython.ootypesystem import ootype
from pypy.rlib.objectmodel import specialize
-from pypy.jit.codegen.model import AbstractRGenOp, GenBuilder
+from pypy.jit.codegen.model import AbstractRGenOp, GenBuilder, GenLabel
from pypy.jit.codegen.model import GenVarOrConst, GenVar, GenConst, CodeGenSwitch
from pypy.jit.codegen.cli import operation as ops
from pypy.translator.cli.dotnet import CLR, typeof, new_array, clidowncast
@@ -121,6 +121,12 @@
assert isinstance(T, ootype.OOType)
return ootype.oodowncast(T, self.obj)
+class Label(GenLabel):
+ def __init__(self, label, inputargs_gv):
+ self.label = label
+ self.inputargs_gv = inputargs_gv
+
+
class RCliGenOp(AbstractRGenOp):
def __init__(self):
@@ -194,6 +200,15 @@
self.il.Emit(OpCodes.Ret)
self.isOpen = False
+ def finish_and_goto(self, outputargs_gv, target):
+ inputargs_gv = target.inputargs_gv
+ assert len(inputargs_gv) == len(outputargs_gv)
+ for i in range(len(outputargs_gv)):
+ outputargs_gv[i].load(self.il)
+ inputargs_gv[i].store(self.il)
+ self.il.Emit(OpCodes.Br, target.label)
+ self.isOpen = False
+
def end(self):
delegate_type = sigtoken2clitype(self.sigtoken)
myfunc = self.meth.CreateDelegate(delegate_type)
@@ -206,7 +221,7 @@
args_gv[i] = op.gv_res()
label = self.il.DefineLabel()
self.il.MarkLabel(label)
- return label
+ return Label(label, args_gv)
def _jump_if(self, gv_condition, opcode):
label = self.il.DefineLabel()
@@ -232,3 +247,10 @@
assert not self.parent.isOpen
self.isOpen = True
self.il.MarkLabel(self.label)
+
+ @specialize.arg(1)
+ def genop2(self, opname, gv_arg1, gv_arg2):
+ # XXX: this only serves to mask a bug in gencli which I don't
+ # feel like fixing now. Try to uncomment this and run
+ # test_goto_compile to see why it fails
+ return Builder.genop2(self, opname, gv_arg1, gv_arg2)
Modified: pypy/dist/pypy/jit/codegen/cli/test/test_rgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/cli/test/test_rgenop.py (original)
+++ pypy/dist/pypy/jit/codegen/cli/test/test_rgenop.py Fri Feb 8 16:17:21 2008
@@ -13,6 +13,7 @@
'test_hide_and_reveal_p',
'test_largedummy_direct', # _compile works if we set a higher maxstack
'test_branching',
+ 'test_goto',
]
for p in prefixes:
More information about the Pypy-commit
mailing list