[pypy-svn] r64650 - in pypy/branch/pyjitpl5-simplify/pypy: jit/metainterp jit/metainterp/test rpython/ootypesystem
antocuni at codespeak.net
antocuni at codespeak.net
Fri Apr 24 20:26:44 CEST 2009
Author: antocuni
Date: Fri Apr 24 20:26:41 2009
New Revision: 64650
Modified:
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_warmspot.py
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py
pypy/branch/pyjitpl5-simplify/pypy/rpython/ootypesystem/ooregistry.py
Log:
some rpython fixes to make sure that test_zrpy_send passes
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_warmspot.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_warmspot.py Fri Apr 24 20:26:41 2009
@@ -1,7 +1,17 @@
-from pypy.jit.metainterp.warmspot import ll_meta_interp
+from pypy.jit.metainterp.warmspot import ll_meta_interp, cast_whatever_to_int
from pypy.rlib.jit import JitDriver
from pypy.jit.backend.llgraph import runner
+
+def test_translate_cast_whatever_to_int():
+ from pypy.rpython.test.test_llinterp import interpret
+ from pypy.rpython.lltypesystem import lltype
+ def fn(x):
+ return cast_whatever_to_int(lltype.typeOf(x), x, None)
+ for type_system in ('lltype', 'ootype'):
+ res = interpret(fn, [42], type_system=type_system)
+ assert res == 42
+
class Exit(Exception):
def __init__(self, result):
self.result = result
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py Fri Apr 24 20:26:41 2009
@@ -400,7 +400,7 @@
if isinstance(TYPE, lltype.Ptr):
# XXX moving GCs...?
return cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(x))
- elif TYPE in (ootype.String, ootype.Unicode):
+ elif TYPE is ootype.String or TYPE is ootype.Unicode:
return ootype.oohash(x)
elif isinstance(TYPE, ootype.OOType):
return ootype.ooidentityhash(x)
Modified: pypy/branch/pyjitpl5-simplify/pypy/rpython/ootypesystem/ooregistry.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/rpython/ootypesystem/ooregistry.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/rpython/ootypesystem/ooregistry.py Fri Apr 24 20:26:41 2009
@@ -87,9 +87,10 @@
_about_ = ootype.oohash
def compute_result_annotation(self, str_s):
- assert isinstance(str_s, annmodel.SomeOOInstance)\
- and (str_s.ootype is ootype.String or
- str_s.ootype is ootype.Unicode)
+ if not (isinstance(str_s, annmodel.SomeOOInstance)
+ and (str_s.ootype is ootype.String or
+ str_s.ootype is ootype.Unicode)):
+ return annmodel.s_ImpossibleValue
return annmodel.SomeInteger()
def specialize_call(self, hop):
More information about the Pypy-commit
mailing list