Author: fijal
Branch: vmprof-newstack
Changeset: r80535:f276c700c181
Date: 2015-11-04 09:46 +0000
http://bitbucket.org/pypy/pypy/changeset/f276c700c181/

Log:    don't scan the first item of shadowstack and always use an extra one

diff --git a/rpython/memory/gctransform/shadowstack.py 
b/rpython/memory/gctransform/shadowstack.py
--- a/rpython/memory/gctransform/shadowstack.py
+++ b/rpython/memory/gctransform/shadowstack.py
@@ -76,10 +76,11 @@
         def walk_stack_root(callback, start, end):
             gc = self.gc
             addr = end
+            addr -= sizeofaddr
             while addr != start:
-                addr -= sizeofaddr
                 if gc.points_to_valid_gc_object(addr):
                     callback(gc, addr)
+                addr -= sizeofaddr
         self.rootstackhook = walk_stack_root
 
         self.shadow_stack_pool = ShadowStackPool(gcdata)
@@ -282,7 +283,7 @@
 
     def start_fresh_new_state(self):
         self.gcdata.root_stack_base = self.unused_full_stack
-        self.gcdata.root_stack_top  = self.unused_full_stack
+        self.gcdata.root_stack_top  = self.unused_full_stack + sizeofaddr
         self.unused_full_stack = llmemory.NULL
 
     def _cleanup(self, shadowstackref):
@@ -312,10 +313,11 @@
         obj = llmemory.cast_adr_to_ptr(obj, SHADOWSTACKREFPTR)
         addr = obj.top
         start = obj.base
+        addr -= sizeofaddr
         while addr != start:
+            gc._trace_callback(callback, arg, addr)
             addr -= sizeofaddr
-            gc._trace_callback(callback, arg, addr)
-
+            
     gc = gctransformer.gcdata.gc
     assert not hasattr(gc, 'custom_trace_dispatcher')
     # ^^^ create_custom_trace_funcs() must not run before this
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to