Commits

Sven Hager committed dda7336

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

Comments (0)

Files changed (2)

pypy/jit/backend/ppc/ppcgen/codebuilder.py

         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()
 

pypy/jit/backend/ppc/ppcgen/ppc_assembler.py

         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()
 
             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