David Schneider avatar David Schneider committed 7d1501e

Port a9073815e95a to ARM

Comments (0)

Files changed (1)


     def _emit_call(self, adr, arglocs, fcond=c.AL, resloc=None,
                                             result_info=(-1, -1),
-                                            can_collect=1):
+                                            can_collect=1,
+                                            reload_frame=False):
         if self.cpu.hf_abi:
             stack_args, adr = self._setup_call_hf(adr, arglocs, fcond,
                                             resloc, result_info)
             gcmap = self._regalloc.get_gcmap([r.r0], noregs=noregs)
             self.push_gcmap(self.mc, gcmap, store=True)
         #the actual call
-        #self.mc.BKPT()
         if adr.is_imm():
         elif adr.is_stack():
         if can_collect:
             self._reload_frame_if_necessary(self.mc, can_collect=can_collect)
+        elif reload_frame:
+            self._reload_frame_if_necessary(self.mc)
         return fcond
     def _restore_sp(self, stack_args, fcond):
         resloc = arglocs[0]
         if gcrootmap:
+            noregs = self.cpu.gc_ll_descr.is_shadow_stack()
+            assert noregs
+            gcmap = self._regalloc.get_gcmap([r.r0], noregs=noregs)
+            self.push_gcmap(self.mc, gcmap, store=True)
             self.call_release_gil(gcrootmap, arglocs, regalloc, fcond)
         # do the call
         signed = descr.is_result_signed()
         self._emit_call(adr, callargs, fcond,
-                                    resloc, (size, signed))
+                                    resloc, (size, signed),
+                                    can_collect=0)
         # then reopen the stack
         if gcrootmap:
             self.call_reacquire_gil(gcrootmap, resloc, regalloc, fcond)
         # NOTE: We assume that  the floating point registers won't be modified.
         assert gcrootmap.is_shadow_stack
         with saved_registers(self.mc, regalloc.rm.save_around_call_regs):
-            self._emit_call(imm(self.releasegil_addr), [], fcond)
+            self._emit_call(imm(self.releasegil_addr), [],
+                                        fcond, can_collect=False)
     def call_reacquire_gil(self, gcrootmap, save_loc, regalloc, fcond):
         # save the previous result into the stack temporarily, in case it is in
         assert gcrootmap.is_shadow_stack
         # call the reopenstack() function (also reacquiring the GIL)
         with saved_registers(self.mc, regs_to_save, vfp_regs_to_save):
-            self._emit_call(imm(self.reacqgil_addr), [], fcond)
+            self._emit_call(imm(self.reacqgil_addr), [], fcond,
+                    can_collect=False, reload_frame=True)
     def _store_force_index(self, guard_op):
         faildescr = guard_op.getdescr()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.