Author: Armin Rigo <[email protected]>
Branch: stacklet
Changeset: r46330:7094a412515f
Date: 2011-08-06 18:53 +0200
http://bitbucket.org/pypy/pypy/changeset/7094a412515f/

Log:    Bah, I think that this can be turned into a tail call, bad.

diff --git a/pypy/rlib/_stacklet_asmgcc.py b/pypy/rlib/_stacklet_asmgcc.py
--- a/pypy/rlib/_stacklet_asmgcc.py
+++ b/pypy/rlib/_stacklet_asmgcc.py
@@ -205,9 +205,12 @@
     return h
 
 def _new_runfn(h, arg):
+    set_handle_on_most_recent(h)
+    r = suspendedstacks._runfn(h, suspendedstacks._arg)
     llop.gc_stack_bottom(lltype.Void)   # marker for trackgcroot.py
-    set_handle_on_most_recent(h)
-    return suspendedstacks._runfn(h, suspendedstacks._arg)
+    # ^^^ also, xxx, place it here to prevent the call from being
+    # considered a tail call
+    return r
 
 def _switch_callback():
     h = rstacklet._switch(suspendedstacks._thrd,
diff --git a/pypy/rlib/rstacklet.py b/pypy/rlib/rstacklet.py
--- a/pypy/rlib/rstacklet.py
+++ b/pypy/rlib/rstacklet.py
@@ -1,7 +1,6 @@
 import py
 from pypy.tool.autopath import pypydir
 from pypy.rpython.lltypesystem import lltype, llmemory, rffi
-from pypy.rpython.lltypesystem.lloperation import llop
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.rpython.annlowlevel import llhelper
 
diff --git a/pypy/translator/c/src/mem.h b/pypy/translator/c/src/mem.h
--- a/pypy/translator/c/src/mem.h
+++ b/pypy/translator/c/src/mem.h
@@ -39,8 +39,9 @@
 #define pypy_asm_keepalive(v)  asm volatile ("/* keepalive %0 */" : : \
                                              "g" (v))
 
-/* marker for trackgcroot.py */
-#define pypy_asm_stack_bottom()  asm volatile ("/* GC_STACK_BOTTOM */" : : )
+/* marker for trackgcroot.py, and inhibits tail calls */
+#define pypy_asm_stack_bottom()  asm volatile ("/* GC_STACK_BOTTOM */" : : : \
+                                               "memory")
 
 #define OP_GC_ASMGCROOT_STATIC(i, r)   r =      \
                i == 0 ? (void*)&__gcmapstart :         \
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to