[pypy-svn] r58466 - in pypy/branch/oo-jit/pypy: jit/codegen jit/codegen/cli jit/codegen/cli/test jit/rainbow translator/cli
antocuni at codespeak.net
antocuni at codespeak.net
Mon Sep 29 12:00:23 CEST 2008
Author: antocuni
Date: Mon Sep 29 12:00:22 2008
New Revision: 58466
Modified:
pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py
pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py
pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py
pypy/branch/oo-jit/pypy/jit/codegen/model.py
pypy/branch/oo-jit/pypy/jit/rainbow/interpreter.py
pypy/branch/oo-jit/pypy/translator/cli/database.py
Log:
implement genop_instanceof; two tests pass
Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/operation.py Mon Sep 29 12:00:22 2008
@@ -260,6 +260,23 @@
if self.restype() is not None:
self.storeResult()
+class InstanceOf(Operation):
+
+ def __init__(self, meth, gv_obj, alloctoken):
+ self.meth = meth
+ self.gv_obj = gv_obj
+ self.clitype = alloctoken.getCliType()
+
+ def restype(self):
+ return typeof(System.Boolean)
+
+ def emit(self):
+ self.gv_obj.load(self.meth)
+ self.meth.il.Emit(OpCodes.Isinst, self.clitype)
+ self.meth.il.Emit(OpCodes.Ldnull)
+ self.meth.il.Emit(OpCodes.Cgt_Un)
+ self.storeResult()
+
def mark(il, s):
il.Emit(OpCodes.Ldstr, s)
il.Emit(OpCodes.Pop)
Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py Mon Sep 29 12:00:22 2008
@@ -732,6 +732,11 @@
self.appendop(op)
return op.gv_res()
+ def genop_instanceof(self, gv_obj, alloctoken):
+ op = ops.InstanceOf(self.meth, gv_obj, alloctoken)
+ self.appendop(op)
+ return op.gv_res()
+
def enter_next_block(self, args_gv):
seen = {}
for i in range(len(args_gv)):
Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_interpreter.py Mon Sep 29 12:00:22 2008
@@ -106,8 +106,6 @@
def test_freeze_booleffects_correctly(self):
py.test.skip("replay: NotImplementedError")
- test_red_isinstance = skip
- test_red_isinstance_degenerated = skip
test_simple_array = skip
test_arraysize = skip
test_setarrayitem = skip
Modified: pypy/branch/oo-jit/pypy/jit/codegen/model.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/model.py (original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/model.py Mon Sep 29 12:00:22 2008
@@ -98,7 +98,8 @@
## def genop_oosend(self, methtoken, gv_self, args_gv):
## def genop_oononnull(self, gv_obj):
## def genop_ooisnull(self, gv_obj):
-
+## def genop_instanceof(self, gv_obj, alloctoken):
+
## def genop_oogetfield(self, fieldtoken, gv_obj):
## def genop_oosetfield(self, fieldtoken, gv_obj, gv_value):
Modified: pypy/branch/oo-jit/pypy/jit/rainbow/interpreter.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/interpreter.py (original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/interpreter.py Mon Sep 29 12:00:22 2008
@@ -1105,6 +1105,7 @@
@arguments("red", "structtypedesc", returns="red")
def opimpl_red_instanceof(self, objbox, typedesc):
+ assert isinstance(objbox, rvalue.AbstractPtrRedBox)
if objbox.content is None:
return rtimeshift.geninstanceof(self.jitstate, objbox,
typedesc)
Modified: pypy/branch/oo-jit/pypy/translator/cli/database.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/cli/database.py (original)
+++ pypy/branch/oo-jit/pypy/translator/cli/database.py Mon Sep 29 12:00:22 2008
@@ -130,7 +130,7 @@
return name
def class_or_record_name(self, TYPE):
- if isinstance(TYPE, ootype.Instance):
+ if TYPE is not ootype.ROOT and isinstance(TYPE, ootype.Instance):
return self.class_name(TYPE)
elif isinstance(TYPE, ootype.Record):
return self.get_record_name(TYPE)
More information about the Pypy-commit
mailing list