Author: Armin Rigo <[email protected]>
Branch: shadowstack-again
Changeset: r71601:fa7c09e2791f
Date: 2014-05-20 15:51 +0200
http://bitbucket.org/pypy/pypy/changeset/fa7c09e2791f/
Log: Small fixes until some tests of test_newgc pass again
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
@@ -8,6 +8,7 @@
from rpython.rtyper import rmodel
from rpython.rtyper.annlowlevel import llhelper
from rpython.rtyper.lltypesystem import lltype, llmemory
+from rpython.rtyper.lltypesystem.lloperation import llop
from rpython.rtyper.llannotation import SomeAddress
from rpython.memory.gctransform.framework import (
BaseFrameworkGCTransformer, BaseRootWalker, sizeofaddr)
@@ -85,6 +86,7 @@
BaseRootWalker.setup_root_walker(self)
def walk_stack_roots(self, collect_stack_root):
+ llop.gc_stack_top(lltype.Void)
gcdata = self.gcdata
self.rootstackhook(collect_stack_root,
gcdata.root_stack_base, gcdata.root_stack_top)
@@ -317,6 +319,7 @@
self.gcdata.root_stack_base = self.unused_full_stack
self.gcdata.root_stack_top = self.unused_full_stack
self.unused_full_stack = llmemory.NULL
+ llop.gc_stack_bottom(lltype.Void)
def _cleanup(self, shadowstackref):
shadowstackref.base = llmemory.NULL
diff --git a/rpython/rtyper/lltypesystem/lloperation.py
b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -507,6 +507,7 @@
# see translator/c/src/mem.h for the valid indices
'gc_asmgcroot_static': LLOp(sideeffects=False),
'gc_stack_bottom': LLOp(canrun=True),
+ 'gc_stack_top': LLOp(canrun=True),
# for stacklet+asmgcroot support
'gc_detach_callback_pieces': LLOp(),
diff --git a/rpython/translator/c/gc.py b/rpython/translator/c/gc.py
--- a/rpython/translator/c/gc.py
+++ b/rpython/translator/c/gc.py
@@ -431,6 +431,12 @@
raise AssertionError(subopnum)
return ' '.join(parts)
+ def OP_GC_STACK_BOTTOM(self, funcgen, op):
+ return 'pypy_asm_stack_bottom();'
+
+ def OP_GC_STACK_TOP(self, funcgen, op):
+ return 'pypy_asm_stack_top();'
+
class ShadowStackFrameworkGcPolicy(BasicFrameworkGcPolicy):
def gettransformer(self):
@@ -469,9 +475,6 @@
def GC_KEEPALIVE(self, funcgen, v):
return 'pypy_asm_keepalive(%s);' % funcgen.expr(v)
- def OP_GC_STACK_BOTTOM(self, funcgen, op):
- return 'pypy_asm_stack_bottom();'
-
name_to_gcpolicy = {
'boehm': BoehmGcPolicy,
diff --git a/rpython/translator/c/src/entrypoint.c
b/rpython/translator/c/src/entrypoint.c
--- a/rpython/translator/c/src/entrypoint.c
+++ b/rpython/translator/c/src/entrypoint.c
@@ -36,6 +36,7 @@
pypy_g_rpython_rtyper_lltypesystem_rffi_StackCounter.sc_inst_stacks_counter++;
#endif
instrument_setup();
+ pypy_asm_stack_bottom();
#ifndef MS_WINDOWS
/* this message does no longer apply to win64 :-) */
@@ -49,7 +50,6 @@
errmsg = RPython_StartupCode();
if (errmsg) goto error;
- pypy_asm_stack_bottom();
list = _RPyListOfString_New(argc);
if (RPyExceptionOccurred()) goto memory_out;
for (i=0; i<argc; i++) {
diff --git a/rpython/translator/c/src/mem.h b/rpython/translator/c/src/mem.h
--- a/rpython/translator/c/src/mem.h
+++ b/rpython/translator/c/src/mem.h
@@ -214,8 +214,15 @@
static inline void pypy_asm_stack_bottom(void)
{
- abort();
+ void *s =
pypy_g_rpython_memory_gctypelayout_GCData.gcd_inst_root_stack_top;
+ rpy_shadowstack = (struct rpy_shadowstack_s *)s;
}
+static inline void pypy_asm_stack_top(void)
+{
+ void *s = rpy_shadowstack;
+ pypy_g_rpython_memory_gctypelayout_GCData.gcd_inst_root_stack_top = s;
+}
+
#endif
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit