David Schneider avatar David Schneider committed c2d0282 Merge

merge heads

Comments (0)

Files changed (2)

rpython/jit/backend/llsupport/test/test_gc_integration.py

         # people actually wreck xmm registers
         cpu = self.cpu
         l = []
+        copied_stack = [None]
 
         def before():
+            # put nonsense on the top of shadowstack
+            frame = rffi.cast(JITFRAMEPTR, cpu.gc_ll_descr.gcrootmap.stack[0])
+            assert getmap(frame).count('1') == 7 #
+            copied_stack[0] = cpu.gc_ll_descr.gcrootmap.stack[0]
+            cpu.gc_ll_descr.gcrootmap.stack[0] = 0
             l.append("before")
 
         def after():
+            cpu.gc_ll_descr.gcrootmap.stack[0] = copied_stack[0]
             l.append("after")
 
         invoke_around_extcall(before, after)
 
         def f(frame, x):
             # all the gc pointers are alive p1 -> p7 (but not p0)
-            assert getmap(frame).count('1') == 7 #
             assert x == 1
             return 2
-        
+
         FUNC = lltype.FuncType([JITFRAMEPTR, lltype.Signed], lltype.Signed)
         fptr = llhelper(lltype.Ptr(FUNC), f)
         calldescr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT,
-                                    EffectInfo.MOST_GENERAL)        
+                                    EffectInfo.MOST_GENERAL)
         loop = self.parse("""
         [i0, p1, p2, p3, p4, p5, p6, p7]
         p0 = force_token()

rpython/jit/backend/x86/assembler.py

         self.pending_guard_tokens.append(guard_token)
 
     def genop_call(self, op, arglocs, resloc):
+        return self._genop_call(op, arglocs, resloc)
+
+    def _genop_call(self, op, arglocs, resloc, is_call_release_gil=False):
         from rpython.jit.backend.llsupport.descr import CallDescr
 
         sizeloc = arglocs[0]
         assert isinstance(descr, CallDescr)
 
         stack_max = PASS_ON_MY_FRAME
-        if self._is_asmgcc() and op.getopnum() == rop.CALL_RELEASE_GIL:
-            from rpython.memory.gctransform import asmgcroot
-            stack_max -= asmgcroot.JIT_USE_WORDS
-            can_collect = 3    # asmgcc only: don't write jf_extra_stack_depth,
-                               # and reload ebp from the css
+        if is_call_release_gil:
+            if self._is_asmgcc():
+                from rpython.memory.gctransform import asmgcroot
+                stack_max -= asmgcroot.JIT_USE_WORDS
+                can_collect = 3    # asmgcc only: don't write jf_extra_stack_depth,
+                                   # and reload ebp from the css
+            else:
+                can_collect = 0
         else:
             can_collect = 1
 
         # first, close the stack in the sense of the asmgcc GC root tracker
         gcrootmap = self.cpu.gc_ll_descr.gcrootmap
         if gcrootmap:
+            noregs = self.cpu.gc_ll_descr.is_shadow_stack()
+            gcmap = self._regalloc.get_gcmap([eax], noregs=noregs)
+            self.push_gcmap(self.mc, gcmap, store=True)
             self.call_release_gil(gcrootmap, arglocs)
         # do the call
         self._store_force_index(guard_op)
-        self.genop_call(op, arglocs, result_loc)
+        self._genop_call(op, arglocs, result_loc, is_call_release_gil=True)
         # then reopen the stack
         if gcrootmap:
             self.call_reacquire_gil(gcrootmap, result_loc)
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.