[pypy-commit] pypy arm-backend-2: fixes to emit_call and call_reaquire_gil

bivab noreply at buildbot.pypy.org
Thu Dec 29 09:57:20 CET 2011


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r50939:aa7017a83625
Date: 2011-12-23 17:30 +0100
http://bitbucket.org/pypy/pypy/changeset/aa7017a83625/

Log:	fixes to emit_call and call_reaquire_gil

diff --git a/pypy/jit/backend/arm/opassembler.py b/pypy/jit/backend/arm/opassembler.py
--- a/pypy/jit/backend/arm/opassembler.py
+++ b/pypy/jit/backend/arm/opassembler.py
@@ -367,10 +367,10 @@
         self.gen_func_epilog()
         return fcond
 
-    def emit_op_call(self, op, args, regalloc, fcond, force_index=-1):
+    def emit_op_call(self, op, args, regalloc, fcond, force_index=NO_FORCE_INDEX):
         adr = args[0].value
         arglist = op.getarglist()[1:]
-        if force_index == -1:
+        if force_index == NO_FORCE_INDEX:
             force_index = self.write_new_force_index()
         cond =  self._emit_call(force_index, adr, arglist, 
                                     regalloc, fcond, op.result)
@@ -1122,15 +1122,18 @@
     def call_reacquire_gil(self, gcrootmap, save_loc, fcond):
         # save the previous result into the stack temporarily.
         # XXX like with call_release_gil(), we assume that we don't need
-        # to save vfp regs in this case.
+        # to save vfp regs in this case. Besides the result location
         regs_to_save = []
+        vfp_regs_to_save = []
         if save_loc.is_reg():
             regs_to_save.append(save_loc)
+        if save_loc.is_vfp_reg():
+            vfp_regs_to_save.append(save_loc)
         # call the reopenstack() function (also reacquiring the GIL)
-        if len(regs_to_save) == 1:
+        if len(regs_to_save) % 2 != 1:
             regs_to_save.append(r.ip) # for alingment
         assert gcrootmap.is_shadow_stack
-        with saved_registers(self.mc, regs_to_save):
+        with saved_registers(self.mc, regs_to_save, vfp_regs_to_save):
             self._emit_call(NO_FORCE_INDEX, self.reacqgil_addr, [], self._regalloc, fcond)
 
     def write_new_force_index(self):
diff --git a/pypy/jit/backend/arm/regalloc.py b/pypy/jit/backend/arm/regalloc.py
--- a/pypy/jit/backend/arm/regalloc.py
+++ b/pypy/jit/backend/arm/regalloc.py
@@ -1034,7 +1034,11 @@
         self.assembler.emit_op_call(op, args, self, fcond, fail_index)
         # then reopen the stack
         if gcrootmap:
-            self.assembler.call_reacquire_gil(gcrootmap, r.r0, fcond)
+            if op.result:
+                result_loc = self.call_result_location(op.result)
+            else:
+                result_loc = None
+            self.assembler.call_reacquire_gil(gcrootmap, result_loc, fcond)
         locs = self._prepare_guard(guard_op)
         return locs
 


More information about the pypy-commit mailing list