[pypy-svn] r59172 - in pypy/branch/oo-jit/pypy/jit: codegen/cli/test timeshifter

antocuni at codespeak.net antocuni at codespeak.net
Fri Oct 17 14:22:32 CEST 2008


Author: antocuni
Date: Fri Oct 17 14:22:31 2008
New Revision: 59172

Added:
   pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_vdict.py   (contents, props changed)
Modified:
   pypy/branch/oo-jit/pypy/jit/timeshifter/vdict.py
Log:
use different hash functions for different ootypes. Add more jit backend tests



Added: pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_vdict.py
==============================================================================
--- (empty file)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_vdict.py	Fri Oct 17 14:22:31 2008
@@ -0,0 +1,10 @@
+import py
+from pypy.jit.rainbow.test.test_vdict import TestOOType as VDictTest
+from pypy.jit.codegen.cli.test.test_gencli_interpreter import CompiledCliMixin
+
+class TestVDictCli(CompiledCliMixin, VDictTest):
+
+    # for the individual tests see
+    # ====> ../../../rainbow/test/test_vdict.py
+
+    pass

Modified: pypy/branch/oo-jit/pypy/jit/timeshifter/vdict.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/timeshifter/vdict.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/timeshifter/vdict.py	Fri Oct 17 14:22:31 2008
@@ -208,7 +208,13 @@
         self.tok_ll_set = RGenOp.methToken(DICT, 'll_set')
 
     def _get_eq_hash(self, DICT):
-        return operator.eq, hash
+        KEY = DICT.KEY
+        eq = operator.eq
+        if KEY in (ootype.String, ootype.Unicode):
+            return eq, ootype.oohash
+        elif KEY in (ootype.Instance, ootype.Record):
+            return eq, ootype.ooidentityhash
+        return eq, hash # work at least for primitive types
 
     def gen_newdict(self, builder, args_gv):
         raise NotImplementedError



More information about the Pypy-commit mailing list