[pypy-svn] r55826 - pypy/branch/oo-jit/pypy/jit/rainbow/test
antocuni at codespeak.net
antocuni at codespeak.net
Fri Jun 13 17:15:44 CEST 2008
Author: antocuni
Date: Fri Jun 13 17:15:43 2008
New Revision: 55826
Modified:
pypy/branch/oo-jit/pypy/jit/rainbow/test/test_tlr.py
Log:
port test_tlr to ootype
Modified: pypy/branch/oo-jit/pypy/jit/rainbow/test/test_tlr.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/rainbow/test/test_tlr.py (original)
+++ pypy/branch/oo-jit/pypy/jit/rainbow/test/test_tlr.py Fri Jun 13 17:15:43 2008
@@ -10,19 +10,24 @@
def test_tlr(self):
bytecode = ','.join([str(ord(c)) for c in tlr.SQUARE])
- tlr_interpret = func_with_new_name(tlr.interpret, "tlr_interpret")
to_rstr = self.to_rstr
- # to stick attributes on the new function object, not on tlr.interpret
+
def build_bytecode(s):
result = ''.join([chr(int(t)) for t in s.split(',')])
return to_rstr(result)
- tlr_interpret.convert_arguments = [build_bytecode, int]
- res = self.timeshift_from_portal(tlr_interpret, tlr_interpret, [bytecode, 1764],
+ def ll_function(llbytecode, arg):
+ from pypy.rpython.annlowlevel import hlstr
+ # needed so that both lltype and ootype can index the string with []
+ bytecode = hlstr(llbytecode)
+ return tlr.interpret(bytecode, arg)
+ ll_function.convert_arguments = [build_bytecode, int]
+
+ res = self.timeshift_from_portal(ll_function, tlr.interpret, [bytecode, 1764],
policy=P_OOPSPEC)
assert res == 3111696
- res = self.timeshift_from_portal(tlr_interpret, tlr_interpret, [bytecode, 9],
+ res = self.timeshift_from_portal(ll_function, tlr.interpret, [bytecode, 9],
policy=P_OOPSPEC)
assert res == 81
@@ -30,6 +35,6 @@
type_system = "lltype"
to_rstr = staticmethod(LLSupport.to_rstr)
-##class TestOOType(BaseTestTLR):
-## type_system = "ootype"
-## to_rstr = staticmethod(OOSupport.to_rstr)
+class TestOOType(BaseTestTLR):
+ type_system = "ootype"
+ to_rstr = staticmethod(OOSupport.to_rstr)
More information about the Pypy-commit
mailing list