[pypy-commit] pypy vmprof-newstack: fixes, does not work untranslated but should mostly work translated

fijal noreply at buildbot.pypy.org
Sat Nov 7 10:32:04 EST 2015


Author: fijal
Branch: vmprof-newstack
Changeset: r80577:c7ff25c0c06e
Date: 2015-11-07 15:32 +0000
http://bitbucket.org/pypy/pypy/changeset/c7ff25c0c06e/

Log:	fixes, does not work untranslated but should mostly work translated

diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py
--- a/rpython/rlib/rvmprof/cintf.py
+++ b/rpython/rlib/rvmprof/cintf.py
@@ -11,16 +11,14 @@
 class VMProfPlatformUnsupported(Exception):
     pass
 
+ROOT = py.path.local(rpythonroot).join('rpython', 'rlib', 'rvmprof')
+SRC = ROOT.join('src')
+
 def setup():
     if not detect_cpu.autodetect().startswith(detect_cpu.MODEL_X86_64):
         raise VMProfPlatformUnsupported("rvmprof only supports"
                                         " x86-64 CPUs for now")
 
-
-    ROOT = py.path.local(rpythonroot).join('rpython', 'rlib', 'rvmprof')
-    SRC = ROOT.join('src')
-
-
     if sys.platform.startswith('linux'):
         libs = ['dl']
     else:
@@ -101,9 +99,10 @@
     target = udir.join('module_cache')
     target.ensure(dir=1)
     argnames = ", ".join(["arg%d" % i for i in range(len(token))])
+    vmprof_stack_h = SRC.join("vmprof_stack.h").read()
     target = target.join('trampoline_%s_%s.vmprof.c' % (name, token))
     target.write("""
-#include "vmprof_stack.h"
+%(vmprof_stack_h)s
 
 %(type)s %(cont_name)s(%(llargs)s);
 
diff --git a/rpython/rlib/rvmprof/src/vmprof_main.h b/rpython/rlib/rvmprof/src/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/vmprof_main.h
@@ -215,11 +215,13 @@
 {
     // read the first slot of shadowstack
     struct vmprof_stack* stack = vmprof_global_stack;
-    if (!stack) {
-        return 0;
+    int n = 0;
+    while (n < max_depth && stack) {
+        result[n] = (void*)stack->value;
+        stack = stack->next;
+        n++;
     }
-    result[0] = (void*)stack->value;
-    return 1;
+    return n;
 }
 
 static int xxx_get_stack_trace(void** result, int max_depth, ucontext_t *ucontext)
diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py b/rpython/rlib/rvmprof/test/test_rvmprof.py
--- a/rpython/rlib/rvmprof/test/test_rvmprof.py
+++ b/rpython/rlib/rvmprof/test/test_rvmprof.py
@@ -25,7 +25,7 @@
         return 0
 
     assert f() == 0
-    fn = compile(f, [], gcpolicy="minimark")
+    fn = compile(f, [])
     assert fn() == 0
 
 
@@ -53,7 +53,7 @@
         return 0
 
     assert f() == 0
-    fn = compile(f, [], gcpolicy="minimark")
+    fn = compile(f, [])
     assert fn() == 0
 
 
@@ -79,7 +79,7 @@
         return 0
 
     assert f() == 0
-    fn = compile(f, [], gcpolicy="minimark")
+    fn = compile(f, [])
     assert fn() == 0
 
 


More information about the pypy-commit mailing list