[pypy-svn] r53651 - in pypy/branch/jit-hotpath/pypy/jit: codegen/llgraph rainbow rainbow/test

antocuni at codespeak.net antocuni at codespeak.net
Thu Apr 10 11:22:29 CEST 2008


Author: antocuni
Date: Thu Apr 10 11:22:27 2008
New Revision: 53651

Modified:
   pypy/branch/jit-hotpath/pypy/jit/codegen/llgraph/llimpl.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/codewriter.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py
Log:
test_simple_indirect_call & co. pass.  To compute the greenkey for
static methods, we use their ooidentityhash



Modified: pypy/branch/jit-hotpath/pypy/jit/codegen/llgraph/llimpl.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/codegen/llgraph/llimpl.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/codegen/llgraph/llimpl.py	Thu Apr 10 11:22:27 2008
@@ -258,6 +258,10 @@
         return ootype._static_meth(T, graph=fn.graph, _callable=fn._callable)
     else:
         T1 = lltype.typeOf(value)
+        if isinstance(T1, ootype.OOType) and T is ootype.Signed:
+            obj = ootype.cast_to_object(value)
+            return ootype.ooidentityhash(obj)
+        
         if T1 is llmemory.Address:
             value = llmemory.cast_adr_to_int(value)
         elif isinstance(T1, lltype.Ptr):

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/codewriter.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/codewriter.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/codewriter.py	Thu Apr 10 11:22:27 2008
@@ -147,8 +147,9 @@
         keys = []
         values = []
         for graph, tsgraph in graph2tsgraph:
-            fnptr    = codewriter.rtyper.getcallable(graph)
-            keys.append(llmemory.cast_ptr_to_adr(fnptr))
+            fnptr = codewriter.rtyper.getcallable(graph)
+            fnaddress = codewriter.cast_fnptr_to_root(fnptr)
+            keys.append(fnaddress)
             values.append(codewriter.get_jitcode(tsgraph))
         # arbitrarily use the last graph to make the colororder -
         # normalization should ensure that all colors are the same
@@ -195,6 +196,9 @@
     def create_interpreter(self, RGenOp):
         raise NotImplementedError
 
+    def cast_fnptr_to_root(self, fnptr):
+        raise NotImplementedError
+
     def sharelist(self, name):
         lst = getattr(self, name)
         # 'lst' is typically a list of descs or low-level pointers.
@@ -1563,6 +1567,9 @@
     ExceptionDesc = exception.LLTypeExceptionDesc
     StructTypeDesc = rcontainer.StructTypeDesc
 
+    def cast_fnptr_to_root(self, fnptr):
+        return llmemory.cast_ptr_to_adr(fnptr)
+
     def create_interpreter(self, RGenOp):
         return LLTypeJitInterpreter(self.exceptiondesc, RGenOp)
 
@@ -1596,7 +1603,10 @@
 
     ExceptionDesc = exception.OOTypeExceptionDesc
     StructTypeDesc = rcontainer.InstanceTypeDesc
-    
+
+    def cast_fnptr_to_root(self, fnptr):
+        return ootype.cast_to_object(fnptr)
+
     def create_interpreter(self, RGenOp):
         return OOTypeJitInterpreter(self.exceptiondesc, RGenOp)
 

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py	Thu Apr 10 11:22:27 2008
@@ -656,7 +656,7 @@
     def opimpl_indirect_call_const(self, greenargs, redargs,
                                       funcptrbox, callset):
         gv = funcptrbox.getgenvar(self.jitstate)
-        addr = gv.revealconst(llmemory.Address)
+        addr = gv.revealconst(self.ts.ROOT_TYPE)
         bytecode = callset.bytecode_for_address(addr)
         self.run(self.jitstate, bytecode, greenargs, redargs,
                  start_bytecode_loop=False)

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_interpreter.py	Thu Apr 10 11:22:27 2008
@@ -2332,9 +2332,6 @@
     test_red_varsized_struct = _skip
     test_array_of_voids = _skip
     test_compile_time_const_tuple = _skip    # needs vdict
-    test_simple_indirect_call = _skip
-    test_normalize_indirect_call = _skip
-    test_normalize_indirect_call_more = _skip
     test_green_char_at_merge = _skip
     test_self_referential_structures = _skip
     test_indirect_red_call = _skip



More information about the Pypy-commit mailing list