[pypy-commit] pypy default: fix argument and return value handling in call_release_gil and call_reacquire_gil. Fixes test_zrpy_releasegil.py failures

bivab noreply at buildbot.pypy.org
Sat Apr 13 18:13:14 CEST 2013


Author: David Schneider <david.schneider at picle.org>
Branch: 
Changeset: r63314:295a4447f6ba
Date: 2013-04-13 18:12 +0200
http://bitbucket.org/pypy/pypy/changeset/295a4447f6ba/

Log:	fix argument and return value handling in call_release_gil and
	call_reacquire_gil. Fixes test_zrpy_releasegil.py failures

diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py
--- a/rpython/jit/backend/arm/opassembler.py
+++ b/rpython/jit/backend/arm/opassembler.py
@@ -1266,7 +1266,7 @@
         resloc = arglocs[0]
 
         if gcrootmap:
-            self.call_release_gil(gcrootmap, arglocs, fcond)
+            self.call_release_gil(gcrootmap, arglocs, regalloc, fcond)
         # do the call
         self._store_force_index(guard_op)
         #
@@ -1278,37 +1278,32 @@
                                     resloc, (size, signed))
         # then reopen the stack
         if gcrootmap:
-            self.call_reacquire_gil(gcrootmap, resloc, fcond)
+            self.call_reacquire_gil(gcrootmap, resloc, regalloc, fcond)
 
         self._emit_guard_may_force(guard_op, arglocs[numargs+1:], numargs)
         return fcond
 
-    def call_release_gil(self, gcrootmap, save_registers, fcond):
-        # First, we need to save away the registers listed in
-        # 'save_registers' that are not callee-save.
+    def call_release_gil(self, gcrootmap, save_registers, regalloc, fcond):
+        # Save caller saved registers and do the call
         # NOTE: We assume that  the floating point registers won't be modified.
-        regs_to_save = []
-        for reg in self._regalloc.rm.save_around_call_regs:
-            if reg in save_registers:
-                regs_to_save.append(reg)
         assert gcrootmap.is_shadow_stack
-        with saved_registers(self.mc, regs_to_save):
+        with saved_registers(self.mc, regalloc.rm.save_around_call_regs):
             self._emit_call(imm(self.releasegil_addr), [], fcond)
 
-    def call_reacquire_gil(self, gcrootmap, save_loc, fcond):
-        # save the previous result into the stack temporarily.
+    def call_reacquire_gil(self, gcrootmap, save_loc, regalloc, fcond):
+	# save the previous result into the stack temporarily, in case it is in
+	# a caller saved register.
         # NOTE: like with call_release_gil(), we assume that we don't need to
         # save vfp regs in this case. Besides the result location
         regs_to_save = []
         vfp_regs_to_save = []
-        if save_loc.is_reg():
+        if save_loc and save_loc in regalloc.rm.save_around_call_regs:
             regs_to_save.append(save_loc)
-        if save_loc.is_vfp_reg():
+            regs_to_save.append(r.ip)  # for alingment
+        elif save_loc and save_loc in regalloc.vfprm.save_around_call_regs:
             vfp_regs_to_save.append(save_loc)
+        assert gcrootmap.is_shadow_stack
         # call the reopenstack() function (also reacquiring the GIL)
-        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, vfp_regs_to_save):
             self._emit_call(imm(self.reacqgil_addr), [], fcond)
 


More information about the pypy-commit mailing list