[pypy-commit] pypy ppc-jit-backend: (bivab, hager): Make function descriptor in case of 64 bit for the generated machine code.

hager noreply at buildbot.pypy.org
Tue Nov 8 17:30:30 CET 2011


Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r48955:dda7336a6e6d
Date: 2011-11-08 08:30 -0800
http://bitbucket.org/pypy/pypy/changeset/dda7336a6e6d/

Log:	(bivab, hager): Make function descriptor in case of 64 bit for the
	generated machine code.

diff --git a/pypy/jit/backend/ppc/ppcgen/codebuilder.py b/pypy/jit/backend/ppc/ppcgen/codebuilder.py
--- a/pypy/jit/backend/ppc/ppcgen/codebuilder.py
+++ b/pypy/jit/backend/ppc/ppcgen/codebuilder.py
@@ -1002,6 +1002,16 @@
         self.writechar(chr((word >> 8) & 0xFF))
         self.writechar(chr(word & 0xFF))
 
+    def write64(self, word):
+        self.writechar(chr((word >> 56) & 0xFF))
+        self.writechar(chr((word >> 48) & 0xFF))
+        self.writechar(chr((word >> 40) & 0xFF))
+        self.writechar(chr((word >> 32) & 0xFF))
+        self.writechar(chr((word >> 24) & 0xFF))
+        self.writechar(chr((word >> 16) & 0xFF))
+        self.writechar(chr((word >> 8) & 0xFF))
+        self.writechar(chr(word & 0xFF))
+
     def currpos(self):
         return self.get_rel_pos()
 
diff --git a/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py b/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py
--- a/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py
+++ b/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py
@@ -410,7 +410,11 @@
         self.write_pending_failure_recoveries()
         loop_start = self.materialize_loop(looptoken, False)
         looptoken._ppc_bootstrap_code = loop_start
-        looptoken.ppc_code = loop_start + start_pos
+        real_start = loop_start + start_pos
+        if IS_PPC_32:
+            looptoken.ppc_code = real_start
+        else:
+            looptoken.ppc_code = self.gen_64_bit_func_descr(real_start)
         self.process_pending_guards(loop_start)
         self._teardown()
 
@@ -516,6 +520,14 @@
             regalloc.possibly_free_vars_for_op(op)
             regalloc._check_invariants()
 
+    def gen_64_bit_func_descr(self, start_addr):
+        mc = PPCBuilder()
+        mc.write64(start_addr)
+        mc.write64(0)
+        mc.write64(0)
+        return mc.materialize(self.cpu.asmmemmgr, [], 
+                              self.cpu.gc_ll_descr.gcrootmap)
+
     def compute_frame_depth(self, regalloc):
         frame_depth = (GPR_SAVE_AREA                        # GPR space
                        + WORD                               # FORCE INDEX


More information about the pypy-commit mailing list