[pypy-svn] r67145 - in pypy/branch/pyjitpl5-constspecnode/pypy/jit/metainterp: . test
antocuni at codespeak.net
antocuni at codespeak.net
Mon Aug 24 11:51:47 CEST 2009
Author: antocuni
Date: Mon Aug 24 11:51:46 2009
New Revision: 67145
Modified:
pypy/branch/pyjitpl5-constspecnode/pypy/jit/metainterp/optimizefindnode.py
pypy/branch/pyjitpl5-constspecnode/pypy/jit/metainterp/test/test_optimizefindnode.py
Log:
(iko, antocuni) implement bridge support for ConstantSpecNode
Modified: pypy/branch/pyjitpl5-constspecnode/pypy/jit/metainterp/optimizefindnode.py
==============================================================================
--- pypy/branch/pyjitpl5-constspecnode/pypy/jit/metainterp/optimizefindnode.py (original)
+++ pypy/branch/pyjitpl5-constspecnode/pypy/jit/metainterp/optimizefindnode.py Mon Aug 24 11:51:46 2009
@@ -384,6 +384,14 @@
def matches_instance_node(self, exitnode):
return True
+class __extend__(ConstantSpecNode):
+ def make_instance_node(self):
+ raise AssertionError, "not implemented (but not used actually)"
+ def matches_instance_node(self, exitnode):
+ if exitnode.knownvaluebox is None:
+ return False
+ return self.constbox.equals(exitnode.knownvaluebox)
+
class __extend__(VirtualInstanceSpecNode):
def make_instance_node(self):
instnode = InstanceNode()
Modified: pypy/branch/pyjitpl5-constspecnode/pypy/jit/metainterp/test/test_optimizefindnode.py
==============================================================================
--- pypy/branch/pyjitpl5-constspecnode/pypy/jit/metainterp/test/test_optimizefindnode.py (original)
+++ pypy/branch/pyjitpl5-constspecnode/pypy/jit/metainterp/test/test_optimizefindnode.py Mon Aug 24 11:51:46 2009
@@ -52,6 +52,7 @@
node = lltype.malloc(NODE)
nodebox = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, node))
myptr = nodebox.value
+ myptr2 = lltype.cast_opaque_ptr(llmemory.GCREF, lltype.malloc(NODE))
nodebox2 = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, node))
nodesize = cpu.sizeof(NODE)
nodesize2 = cpu.sizeof(NODE2)
@@ -90,6 +91,7 @@
node = ootype.new(NODE)
nodebox = BoxObj(ootype.cast_to_object(node))
myptr = nodebox.value
+ myptr2 = ootype.cast_to_object(ootype.new(NODE))
nodebox2 = BoxObj(ootype.cast_to_object(node))
valuedescr = cpu.fielddescrof(NODE, 'value')
nextdescr = cpu.fielddescrof(NODE, 'next')
@@ -692,6 +694,17 @@
"""
self.find_bridge(ops, 'Not', 'Not')
+ def test_bridge_simple_constant(self):
+ ops = """
+ [p0]
+ guard_value(p0, ConstPtr(myptr))
+ fail()
+ jump(p0)
+ """
+ self.find_bridge(ops, 'Not', 'Not')
+ self.find_bridge(ops, 'Not', 'Constant(myptr)')
+ self.find_bridge(ops, 'Not', 'Constant(myptr2)', mismatch=True)
+
def test_bridge_simple_virtual_1(self):
ops = """
[i0]
More information about the Pypy-commit
mailing list