[pypy-svn] r33221 - in pypy/dist/pypy/jit/codegen/ppc: . test
mwh at codespeak.net
mwh at codespeak.net
Thu Oct 12 12:44:31 CEST 2006
Author: mwh
Date: Thu Oct 12 12:44:29 2006
New Revision: 33221
Modified:
pypy/dist/pypy/jit/codegen/ppc/rppcgenop.py
pypy/dist/pypy/jit/codegen/ppc/test/test_rppcgenop.py
Log:
comment out some unimplemented cases for the annotators sake, add a test of
compiling ppc codegen stuff
Modified: pypy/dist/pypy/jit/codegen/ppc/rppcgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/ppc/rppcgenop.py (original)
+++ pypy/dist/pypy/jit/codegen/ppc/rppcgenop.py Thu Oct 12 12:44:29 2006
@@ -190,10 +190,10 @@
T = lltype.typeOf(llvalue)
if isinstance(T, lltype.Primitive):
return IntConst(lltype.cast_primitive(lltype.Signed, llvalue))
- elif T is llmemory.Address:
- return AddrConst(llvalue)
- elif isinstance(T, lltype.Ptr):
- return AddrConst(llmemory.cast_ptr_to_adr(llvalue))
+## elif T is llmemory.Address:
+## return AddrConst(llvalue)
+## elif isinstance(T, lltype.Ptr):
+## return AddrConst(llmemory.cast_ptr_to_adr(llvalue))
else:
assert 0, "XXX not implemented"
Modified: pypy/dist/pypy/jit/codegen/ppc/test/test_rppcgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/ppc/test/test_rppcgenop.py (original)
+++ pypy/dist/pypy/jit/codegen/ppc/test/test_rppcgenop.py Thu Oct 12 12:44:29 2006
@@ -1,6 +1,16 @@
from pypy.jit.codegen.ppc.rppcgenop import RPPCGenOp
from ctypes import c_void_p, cast, CFUNCTYPE, c_int
from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.objectmodel import keepalive_until_here
+from pypy.rpython.annlowlevel import MixLevelAnnotatorPolicy
+from pypy.translator.c.test.test_genc import compile
+
+from ctypes import c_void_p, cast, CFUNCTYPE, c_int
+
+# XXX clean up
+class PseudoAnnhelper(object):
+ rtyper = None
+GENOP_POLICY = MixLevelAnnotatorPolicy(PseudoAnnhelper())
import py
FUNC = lltype.FuncType([lltype.Signed], lltype.Signed)
@@ -15,10 +25,23 @@
return gv_add_one
def test_adder_direct():
- #py.test.skip("no way hosay")
rgenop = RPPCGenOp()
gv_add_5 = make_adder(rgenop, 5)
print gv_add_5.value
fnptr = cast(c_void_p(gv_add_5.value), CFUNCTYPE(c_int, c_int))
res = fnptr(37)
assert res == 42
+
+def runner(x, y):
+ rgenop = RPPCGenOp()
+ gv_add_x = make_adder(rgenop, x)
+ add_x = gv_add_x.revealconst(lltype.Ptr(FUNC))
+ res = add_x(y)
+ keepalive_until_here(rgenop) # to keep the code blocks alive
+ return res
+
+def test_adder_compile():
+ fn = compile(runner, [int, int], annotatorpolicy=GENOP_POLICY,
+ gcpolicy='boehm')
+ res = fn(9080983, -9080941)
+ assert res == 42
More information about the Pypy-commit
mailing list