Commits

Armin Rigo  committed ab6b2fd

(fijal mostly, arigo review)

Adapt the logic to the JIT shadowstack code.

  • Participants
  • Parent commits d160dc0
  • Branches stackroot-speedup

Comments (0)

Files changed (2)

File pypy/jit/backend/llsupport/gc.py

 from pypy.jit.backend.llsupport.descr import get_array_descr
 from pypy.jit.backend.llsupport.descr import get_call_descr
 from pypy.jit.backend.llsupport.rewrite import GcRewriterAssembler
-from pypy.rpython.memory.gctransform import asmgcroot
+from pypy.rpython.memory.gctransform import asmgcroot, shadowstack
 
 # ____________________________________________________________
 
             def setcontext(iself, context):
                 iself.context = context
 
-            def nextleft(iself, gc, range_lowest, prev):
+            def nextleft(iself, gc, range_lowest, prev, is_minor):
                 # Return the next valid GC object's address, in right-to-left
                 # order from the shadowstack array.  This usually means just
                 # returning "prev - sizeofaddr", until we reach "range_lowest",
                         # contains a valid pointer
                         while prev != range_lowest:
                             prev -= llmemory.sizeof(llmemory.Address)
-                            if prev.signed[0] == self.MARKER_FRAME:
+                            value = llmemory.cast_adr_to_int(prev.address[0])
+                            # this logic is directly copied from RootIterator
+                            # in shadowstack.py, consult comments there
+                            if value == shadowstack.MARKER_TRACED:
+                                if is_minor:
+                                    return llmemory.NULL
+                                continue
+                            if value == shadowstack.MARKER_NOT_TRACED:
+                                prev.address[0] = rffi.cast(llmemory.Address,
+                                                    shadowstack.MARKER_TRACED)
+                                continue
+                            if value == self.MARKER_FRAME:
                                 break
                             if gc.points_to_valid_gc_object(prev):
                                 return prev

File pypy/rpython/memory/gctransform/shadowstack.py

                     # cannot contain young pointers.
                     if value == MARKER_TRACED:
                         if is_minor:
-                            break
+                            return llmemory.NULL
                         continue     # ignore the marker and continue
                     #
                     # If 'addr' contains MARKER_NOT_TRACED, replace it by