Author: Armin Rigo <[email protected]>
Branch: stacklet
Changeset: r46819:77306aa0ecd3
Date: 2011-08-27 15:31 +0200
http://bitbucket.org/pypy/pypy/changeset/77306aa0ecd3/

Log:    Oups! Missed the fact that root_stack_depth is sometimes overridden
        in tests. This no longer had any effect, leading to huge memory
        requirements...

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
@@ -132,6 +132,7 @@
     return result
 
 class FrameworkGCTransformer(GCTransformer):
+    root_stack_depth = None    # for tests to override
 
     def __init__(self, translator):
         from pypy.rpython.memory.gc.base import choose_gc_from_config
diff --git a/pypy/rpython/memory/gctransform/shadowstack.py 
b/pypy/rpython/memory/gctransform/shadowstack.py
--- a/pypy/rpython/memory/gctransform/shadowstack.py
+++ b/pypy/rpython/memory/gctransform/shadowstack.py
@@ -50,6 +50,9 @@
             self.rootstackhook = default_walk_stack_root
 
         self.shadow_stack_pool = ShadowStackPool(gcdata)
+        rsd = gctransformer.root_stack_depth
+        if rsd is not None:
+            self.shadow_stack_pool.root_stack_depth = rsd
 
     def push_stack(self, addr):
         top = self.incr_stack(1)
@@ -252,7 +255,6 @@
     """
     _alloc_flavor_ = "raw"
     root_stack_depth = 163840
-    root_stack_size = sizeofaddr * root_stack_depth
 
     #MAX = 20  not implemented yet
 
@@ -318,7 +320,8 @@
 
     def _prepare_unused_stack(self):
         if self.unused_full_stack == llmemory.NULL:
-            self.unused_full_stack = llmemory.raw_malloc(self.root_stack_size)
+            root_stack_size = sizeofaddr * self.root_stack_depth
+            self.unused_full_stack = llmemory.raw_malloc(root_stack_size)
             if self.unused_full_stack == llmemory.NULL:
                 raise MemoryError
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to