[pypy-svn] r68494 - in pypy/branch/gc-hash/pypy/jit/metainterp: . test

arigo at codespeak.net arigo at codespeak.net
Thu Oct 15 16:21:46 CEST 2009


Author: arigo
Date: Thu Oct 15 16:21:46 2009
New Revision: 68494

Modified:
   pypy/branch/gc-hash/pypy/jit/metainterp/test/test_compile.py
   pypy/branch/gc-hash/pypy/jit/metainterp/test/test_loop.py
   pypy/branch/gc-hash/pypy/jit/metainterp/test/test_typesystem.py
   pypy/branch/gc-hash/pypy/jit/metainterp/typesystem.py
Log:
Aaaaargh.  This translation bug took a while to
figure out.  It's because these two functions are
called 'll_*' and we are in a mixlevelannotator.
Baaaaah.


Modified: pypy/branch/gc-hash/pypy/jit/metainterp/test/test_compile.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/test/test_compile.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/test/test_compile.py	Thu Oct 15 16:21:46 2009
@@ -1,7 +1,7 @@
 from pypy.jit.metainterp.history import LoopToken, ConstInt, History, Stats
 from pypy.jit.metainterp.specnode import NotSpecNode, ConstantSpecNode
 from pypy.jit.metainterp.compile import insert_loop_token, compile_new_loop
-from pypy.jit.metainterp import optimize, jitprof
+from pypy.jit.metainterp import optimize, jitprof, typesystem
 from pypy.jit.metainterp.test.oparser import parse
 from pypy.jit.metainterp.test.test_optimizefindnode import LLtypeMixin
 
@@ -26,6 +26,7 @@
 
 
 class FakeCPU:
+    ts = typesystem.llhelper
     def __init__(self):
         self.seen = []
     def compile_loop(self, inputargs, operations, token):

Modified: pypy/branch/gc-hash/pypy/jit/metainterp/test/test_loop.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/test/test_loop.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/test/test_loop.py	Thu Oct 15 16:21:46 2009
@@ -1,5 +1,6 @@
 import py
 from pypy.rlib.jit import JitDriver, OPTIMIZER_SIMPLE, OPTIMIZER_FULL
+from pypy.rlib.objectmodel import compute_hash
 from pypy.jit.metainterp.warmspot import ll_meta_interp, get_stats
 from pypy.rpython.lltypesystem import lltype
 from pypy.jit.metainterp.test.test_basic import LLJitMixin, OOJitMixin
@@ -349,7 +350,7 @@
                 myjitdriver.jit_merge_point(n=n, x=x)
                 x += unichr(n)
                 n -= 1
-            return hash(x)
+            return compute_hash(x)
         expected = self.run_directly(f, [100])
         res = self.meta_interp(f, [100])
         assert res == expected
@@ -363,7 +364,7 @@
                 myjitdriver.jit_merge_point(n=n, x=x)
                 x += chr(n)
                 n -= 1
-            return hash(x)
+            return compute_hash(x)
         expected = self.run_directly(f, [100])
         res = self.meta_interp(f, [100])
         assert res == expected

Modified: pypy/branch/gc-hash/pypy/jit/metainterp/test/test_typesystem.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/test/test_typesystem.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/test/test_typesystem.py	Thu Oct 15 16:21:46 2009
@@ -9,13 +9,13 @@
         d = self.helper.new_ref_dict()
         ref1 = self.fresh_ref()
         ref2 = self.fresh_ref()
-        ref3 = self.null_ref()
+        ref3 = self.fresh_ref()
         d[ref1] = 123
         d[ref2] = 456
         d[ref3] = 789
         ref1b = self.duplicate_ref(ref1)
         ref2b = self.duplicate_ref(ref2)
-        ref3b = self.null_ref()
+        ref3b = self.duplicate_ref(ref3)
         assert d[ref1b] == 123
         assert d[ref2b] == 456
         assert d[ref3b] == 789

Modified: pypy/branch/gc-hash/pypy/jit/metainterp/typesystem.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/typesystem.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/typesystem.py	Thu Oct 15 16:21:46 2009
@@ -118,9 +118,9 @@
     # It is an r_dict on lltype.  Two copies, to avoid conflicts with
     # the value type.  Note that NULL is not allowed as a key.
     def new_ref_dict(self):
-        return r_dict(ll_rd_eq, ll_rd_hash)
+        return r_dict(rd_eq, rd_hash)
     def new_ref_dict_2(self):
-        return r_dict(ll_rd_eq, ll_rd_hash)
+        return r_dict(rd_eq, rd_hash)
 
     def cast_vtable_to_hashable(self, cpu, ptr):
         adr = llmemory.cast_ptr_to_adr(ptr)
@@ -137,10 +137,10 @@
     def getaddr_for_box(self, cpu, box):
         return box.getaddr(cpu)
 
-def ll_rd_eq(ref1, ref2):
+def rd_eq(ref1, ref2):
     return ref1 == ref2
 
-def ll_rd_hash(ref):
+def rd_hash(ref):
     assert ref
     return lltype.identityhash(ref)
 



More information about the Pypy-commit mailing list