[pypy-svn] r65069 - in pypy/branch/pyjitpl5/pypy/jit/metainterp: . test
antocuni at codespeak.net
antocuni at codespeak.net
Tue May 5 20:48:08 CEST 2009
Author: antocuni
Date: Tue May 5 20:48:04 2009
New Revision: 65069
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/executor.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/resoperation.py
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_basic.py
Log:
implement ooidentityhash
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/executor.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/executor.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/executor.py Tue May 5 20:48:04 2009
@@ -3,6 +3,7 @@
import py
from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.ootypesystem import ootype
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rlib.rarithmetic import ovfcheck, r_uint, intmask
from pypy.jit.metainterp.history import BoxInt, ConstInt, check_descr
@@ -145,6 +146,10 @@
x = args[0].getobj() != args[1].getobj()
return ConstInt(x)
+def do_ooidentityhash(cpu, args, descr=None):
+ obj = args[0].getobj()
+ return ConstInt(ootype.ooidentityhash(obj))
+
# ----------
# the following operations just delegate to the cpu:
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py Tue May 5 20:48:04 2009
@@ -367,6 +367,10 @@
def opimpl_instanceof(self, box, typedescr):
self.execute(rop.INSTANCEOF, [box], descr=typedescr)
+ @arguments("box")
+ def opimpl_ooidentityhash(self, box):
+ self.execute(rop.OOIDENTITYHASH, [box], descr=None)
+
@arguments("descr", "box")
def opimpl_new_array(self, itemsize, countbox):
self.execute(rop.NEW_ARRAY, [countbox], descr=itemsize)
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/resoperation.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/resoperation.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/resoperation.py Tue May 5 20:48:04 2009
@@ -154,6 +154,7 @@
UNICODEGETITEM = 84
#
# ootype operations
+ OOIDENTITYHASH = 85
INSTANCEOF = 86
OOSEND_PURE = 87
#
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_basic.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_basic.py Tue May 5 20:48:04 2009
@@ -606,6 +606,14 @@
# translation?
assert res == ootype.oohash(ootype.oostring(5, -1))
+ def test_ooidentityhash(self):
+ def f():
+ s1 = ootype.oostring(5, -1)
+ s2 = ootype.oostring(6, -1)
+ return ootype.ooidentityhash(s1) == ootype.ooidentityhash(s2)
+ res = self.interp_operations(f, [])
+ assert not res
+
def test_oois(self):
A = ootype.Instance("A", ootype.ROOT)
def f(n):
More information about the Pypy-commit
mailing list