[pypy-commit] pypy ppc-jit-backend: repair test_ppc.py

hager noreply at buildbot.pypy.org
Wed Feb 8 16:22:21 CET 2012


Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r52237:7e373f1b0a4f
Date: 2012-02-08 16:21 +0100
http://bitbucket.org/pypy/pypy/changeset/7e373f1b0a4f/

Log:	repair test_ppc.py

diff --git a/pypy/jit/backend/ppc/assembler.py b/pypy/jit/backend/ppc/assembler.py
--- a/pypy/jit/backend/ppc/assembler.py
+++ b/pypy/jit/backend/ppc/assembler.py
@@ -64,6 +64,13 @@
     def assemble(self, dump=os.environ.has_key('PPY_DEBUG')):
         c = asmfunc.AsmCode(len(self.insts)*4)
         for i in self.insts:
+            c.emit(i)
+
+    def get_assembler_function(self):
+        c = asmfunc.AsmCode(len(self.insts)*4)
+        for i in self.insts:
+            c.emit(i)
+        return c.get_function()
 
     def get_idescs(cls):
         r = []
diff --git a/pypy/jit/backend/ppc/test/test_ppc.py b/pypy/jit/backend/ppc/test/test_ppc.py
--- a/pypy/jit/backend/ppc/test/test_ppc.py
+++ b/pypy/jit/backend/ppc/test/test_ppc.py
@@ -33,7 +33,8 @@
         def newtest(self):
             a = PPCBuilder()
             test(self, a)
-            f = a.assemble()
+            #f = a.assemble()
+            f = a.get_assembler_function()
             assert f() == expected
         return newtest
     return testmaker
@@ -59,7 +60,7 @@
     def setup_class(cls):
         if autodetect_main_model() not in ["ppc", "ppc64"]: 
             py.test.skip("can't test all of ppcgen on non-PPC!")
-        py.test.xfail("assemble does not return a function any longer, fix tests")
+        #py.test.xfail("assemble does not return a function any longer, fix tests")
 
     """
     Tests are build like this:
@@ -202,7 +203,7 @@
         a.bctr()
         a.blr()
 
-        f = a.assemble()
+        f = a.get_assembler_function()
         assert f() == 65
 
     @asmtest(expected=0)
@@ -263,7 +264,7 @@
         a.load_imm(r10, 0x0000F0F0)
         a.neg(3, 10)
         a.blr()
-        f = a.assemble()
+        f = a.get_assembler_function()
         assert f() == hex_to_signed_int("FFFF0F10")
 
     def test_load_and_store(self):
@@ -284,7 +285,7 @@
         a.lwz(5, 9, 0)
         a.add(3, 4, 5)
         a.blr()
-        f = a.assemble()
+        f = a.get_assembler_function()
         assert f() == word1 + word2
         lltype.free(p, flavor="raw")
 
@@ -297,7 +298,7 @@
 
         a.load_from_addr(r3, addr)
         a.blr()
-        f = a.assemble()
+        f = a.get_assembler_function()
         assert f() == 200
         p[0] = rffi.cast(rffi.LONG, 300)
         assert f() == 300


More information about the pypy-commit mailing list