[pypy-svn] r68496 - in pypy/branch/gc-hash/pypy/jit: backend/cli metainterp metainterp/test

arigo at codespeak.net arigo at codespeak.net
Thu Oct 15 16:30:38 CEST 2009


Author: arigo
Date: Thu Oct 15 16:30:38 2009
New Revision: 68496

Modified:
   pypy/branch/gc-hash/pypy/jit/backend/cli/method.py
   pypy/branch/gc-hash/pypy/jit/metainterp/codewriter.py
   pypy/branch/gc-hash/pypy/jit/metainterp/executor.py
   pypy/branch/gc-hash/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/gc-hash/pypy/jit/metainterp/resoperation.py
   pypy/branch/gc-hash/pypy/jit/metainterp/support.py
   pypy/branch/gc-hash/pypy/jit/metainterp/test/test_basic.py
Log:
Kill oohash, and kill most support code for identityhash
(which is now simply a function call to support.py).


Modified: pypy/branch/gc-hash/pypy/jit/backend/cli/method.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/backend/cli/method.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/backend/cli/method.py	Thu Oct 15 16:30:38 2009
@@ -576,9 +576,6 @@
         self.il.Emit(OpCodes.Call, methinfo)
         self.store_result(op)
 
-    def emit_op_ooidentityhash(self, op):
-        raise NotImplementedError
-
     def emit_op_call_impl(self, op):
         descr = op.descr
         assert isinstance(descr, runner.StaticMethDescr)

Modified: pypy/branch/gc-hash/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/codewriter.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/codewriter.py	Thu Oct 15 16:30:38 2009
@@ -1402,7 +1402,7 @@
 
     serialize_op_oostring  = handle_builtin_call
     serialize_op_oounicode = handle_builtin_call
-    serialize_op_oohash    = handle_builtin_call
+    serialize_op_gc_identityhash = handle_builtin_call
 
     # ----------
 

Modified: pypy/branch/gc-hash/pypy/jit/metainterp/executor.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/executor.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/executor.py	Thu Oct 15 16:30:38 2009
@@ -145,10 +145,6 @@
         assert False
     return ConstInt(x)
 
-def do_identityhash(cpu, box1):
-    obj = box1.getref_base()
-    return ConstInt(lltype.identityhash(obj))
-
 def do_subclassof(cpu, box1, box2):
     return ConstInt(cpu.ts.subclassOf(cpu, box1, box2))
 

Modified: pypy/branch/gc-hash/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/pyjitpl.py	Thu Oct 15 16:30:38 2009
@@ -325,10 +325,6 @@
     def opimpl_subclassof(self, box1, box2):
         self.execute(rop.SUBCLASSOF, box1, box2)
 
-    @arguments("box")
-    def opimpl_gc_identityhash(self, box):
-        self.execute(rop.IDENTITYHASH, box)
-
     @arguments("descr", "box")
     def opimpl_new_array(self, itemsize, countbox):
         self.execute_with_descr(rop.NEW_ARRAY, itemsize, countbox)

Modified: pypy/branch/gc-hash/pypy/jit/metainterp/resoperation.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/resoperation.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/resoperation.py	Thu Oct 15 16:30:38 2009
@@ -185,7 +185,6 @@
     'GETARRAYITEM_GC_PURE/2d',
     'UNICODELEN/1',
     'UNICODEGETITEM/2',
-    'IDENTITYHASH/1',
     #
     # ootype operations
     'INSTANCEOF/1d',

Modified: pypy/branch/gc-hash/pypy/jit/metainterp/support.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/support.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/support.py	Thu Oct 15 16:30:38 2009
@@ -134,6 +134,10 @@
 _ll_2_list_getitem_foldable = _ll_2_list_getitem
 _ll_1_list_len_foldable     = _ll_1_list_len
 
+def _ll_1_gc_identityhash(x):
+    return lltype.identityhash(x)
+
+
 class LLtypeHelpers:
 
     # ---------- dict ----------
@@ -268,12 +272,6 @@
     def _ll_1_oounicode_string_foldable(s):
         return ootype.oounicode(s, -1)
 
-    def _ll_1_oohash_string_foldable(s):
-        return ootype.oohash(s)
-
-    def _ll_1_oohash_unicode_foldable(u):
-        return ootype.oohash(u)
-
 # -------------------------------------------------------
 
 def setup_extra_builtin(rtyper, oopspec_name, nb_args):
@@ -334,14 +332,8 @@
         T = ootype.ROOT
     return '%s_%s_foldable' % (op.opname, T._name.lower()), args
 
-def get_oohash_oopspec(op):
-    T = op.args[0].concretetype
-    if T is ootype.String:
-        return 'oohash_string_foldable', op.args
-    elif T is ootype.Unicode:
-        return 'oohash_unicode_foldable', op.args
-    else:
-        raise Exception("oohash() of type %r" % (T,))
+def get_identityhash_oopspec(op):
+    return 'gc_identityhash', op.args
 
 
 RENAMED_ADT_NAME = {
@@ -371,8 +363,8 @@
         return get_call_oopspec_opargs(fnobj, opargs)
     elif op.opname in ('oostring', 'oounicode'):
         return get_oostring_oopspec(op)
-    elif op.opname == 'oohash':
-        return get_oohash_oopspec(op)
+    elif op.opname == 'gc_identityhash':
+        return get_identityhash_oopspec(op)
     else:
         raise ValueError(op.opname)
 

Modified: pypy/branch/gc-hash/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/branch/gc-hash/pypy/jit/metainterp/test/test_basic.py	(original)
+++ pypy/branch/gc-hash/pypy/jit/metainterp/test/test_basic.py	Thu Oct 15 16:30:38 2009
@@ -948,10 +948,10 @@
 class TestOOtype(BasicTests, OOJitMixin):
 
     def test_oohash(self):
-        def f():
-            s = ootype.oostring(5, -1)
+        def f(n):
+            s = ootype.oostring(n, -1)
             return s.ll_hash()
-        res = self.interp_operations(f, [])
+        res = self.interp_operations(f, [5])
         assert res == ootype.oostring(5, -1).ll_hash()
 
     def test_identityhash(self):



More information about the Pypy-commit mailing list