Author: Armin Rigo <[email protected]>
Branch: tealet
Changeset: r45376:cf207cd3f785
Date: 2011-06-11 12:33 +0200
http://bitbucket.org/pypy/pypy/changeset/cf207cd3f785/

Log:    Add an operation to get the address of the shadowstack base pointer,
        in addition to the top.

diff --git a/pypy/rpython/lltypesystem/lloperation.py 
b/pypy/rpython/lltypesystem/lloperation.py
--- a/pypy/rpython/lltypesystem/lloperation.py
+++ b/pypy/rpython/lltypesystem/lloperation.py
@@ -489,6 +489,7 @@
     # ^^^ returns an address of nursery free pointer, for later modifications
     'gc_adr_of_nursery_top' : LLOp(),
     # ^^^ returns an address of pointer, since it can change at runtime
+    'gc_adr_of_root_stack_base': LLOp(),
     'gc_adr_of_root_stack_top': LLOp(),
     # ^^^ returns the address of gcdata.root_stack_top (for shadowstack only)
 
diff --git a/pypy/rpython/memory/gctransform/framework.py 
b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -795,10 +795,15 @@
                              resulttype=llmemory.Address)
         hop.genop('adr_add', [v_gc_adr, c_ofs], resultvar=op.result)
 
+    def gct_gc_adr_of_root_stack_base(self, hop):
+        self._gc_adr_of_root_stack(hop, 'inst_root_stack_base')
+
     def gct_gc_adr_of_root_stack_top(self, hop):
+        self._gc_adr_of_root_stack(hop, 'inst_root_stack_top')
+
+    def _gc_adr_of_root_stack(self, hop, llattr):
         op = hop.spaceop
-        ofs = llmemory.offsetof(self.c_const_gcdata.concretetype.TO,
-                                'inst_root_stack_top')
+        ofs = llmemory.offsetof(self.c_const_gcdata.concretetype.TO, llattr)
         c_ofs = rmodel.inputconst(lltype.Signed, ofs)
         v_gcdata_adr = hop.genop('cast_ptr_to_adr', [self.c_const_gcdata],
                                  resulttype=llmemory.Address)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to