[pypy-commit] pypy vmprof-native: copy over changes from vmprof-python.git repo
plan_rich
pypy.commits at gmail.com
Mon Feb 13 06:00:08 EST 2017
Author: Richard Plangger <planrichi at gmail.com>
Branch: vmprof-native
Changeset: r90076:4abe2a5167f2
Date: 2017-02-13 11:41 +0100
http://bitbucket.org/pypy/pypy/changeset/4abe2a5167f2/
Log: copy over changes from vmprof-python.git repo
diff --git a/rpython/rlib/rvmprof/src/shared/_vmprof.c b/rpython/rlib/rvmprof/src/shared/_vmprof.c
--- a/rpython/rlib/rvmprof/src/shared/_vmprof.c
+++ b/rpython/rlib/rvmprof/src/shared/_vmprof.c
@@ -28,7 +28,7 @@
#ifdef VMPROF_UNIX
#ifdef __clang__
-__attribute__((disable_tail_calls))
+__attribute__((optnone))
#elif defined(__GNUC__)
__attribute__((optimize("O1")))
#endif
diff --git a/rpython/rlib/rvmprof/src/shared/vmp_stack.c b/rpython/rlib/rvmprof/src/shared/vmp_stack.c
--- a/rpython/rlib/rvmprof/src/shared/vmp_stack.c
+++ b/rpython/rlib/rvmprof/src/shared/vmp_stack.c
@@ -164,8 +164,10 @@
return 0;
}
+#ifdef VMPROF_LINUX
while (signal) {
- if (unw_is_signal_frame(&cursor)) {
+ int is_signal_frame = unw_is_signal_frame(&cursor);
+ if (is_signal_frame) {
break;
}
int err = unw_step(&cursor);
@@ -173,6 +175,16 @@
return 0;
}
}
+#else
+ // who would have guessed that unw_is_signal_frame does not work on mac os x
+ if (signal) {
+ unw_step(&cursor); // vmp_walk_and_record_stack
+ // get_stack_trace is inlined
+ unw_step(&cursor); // _vmprof_sample_stack
+ unw_step(&cursor); // sigprof_handler
+ unw_step(&cursor); // _sigtramp
+ }
+#endif
//printf("stack trace:\n");
int depth = 0;
@@ -265,7 +277,6 @@
//printf("sample ended\n");
break;
} else if (err < 0) {
- //printf("sample is broken\n");
return 0; // this sample is broken, cannot walk it fully
}
}
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_main.h b/rpython/rlib/rvmprof/src/shared/vmprof_main.h
--- a/rpython/rlib/rvmprof/src/shared/vmprof_main.h
+++ b/rpython/rlib/rvmprof/src/shared/vmprof_main.h
@@ -89,7 +89,7 @@
* *************************************************************
*/
-int get_stack_trace(PY_THREAD_STATE_T * current, void** result, int max_depth, intptr_t pc)
+static int get_stack_trace(PY_THREAD_STATE_T * current, void** result, int max_depth, intptr_t pc)
{
PY_STACK_FRAME_T * frame;
#ifdef RPYTHON_VMPROF
@@ -119,7 +119,7 @@
longjmp(restore_point, SIGSEGV);
}
-int _vmprof_sample_stack(struct profbuf_s *p, PY_THREAD_STATE_T * tstate, ucontext_t * uc)
+static int _vmprof_sample_stack(struct profbuf_s *p, PY_THREAD_STATE_T * tstate, ucontext_t * uc)
{
int depth;
struct prof_stacktrace_s *st = (struct prof_stacktrace_s *)p->data;
@@ -312,7 +312,8 @@
tstate->interp->eval_frame = vmprof_eval;
_default_eval_loop = _PyEval_EvalFrameDefault;
#elif defined(RPYTHON_VMPROF)
- // TODO nothing?
+ // do nothing here, the stack is maintained by rpython
+ // no need for a trampoline
#else
if (vmp_patch_callee_trampoline(PyEval_EvalFrameEx,
vmprof_eval, (void*)&_default_eval_loop) == 0) {
More information about the pypy-commit
mailing list