Author: fijal
Branch: vmprof-newstack
Changeset: r80615:cda9b080c6aa
Date: 2015-11-09 16:23 +0100
http://bitbucket.org/pypy/pypy/changeset/cda9b080c6aa/
Log: in progress
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
@@ -114,6 +114,7 @@
struct vmprof_stack node;
node.value = unique_id;
+ node.kind = VMPROF_CODE_TAG;
node.next = vmprof_global_stack;
vmprof_global_stack = &node;
result = %(cont_name)s(%(argnames)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
@@ -143,6 +143,7 @@
#define VERSION_BASE '\x00'
#define VERSION_THREAD_ID '\x01'
+#define VERSION_TAG '\x02'
vmprof_stack* vmprof_global_stack = NULL;
@@ -216,10 +217,11 @@
// read the first slot of shadowstack
struct vmprof_stack* stack = vmprof_global_stack;
int n = 0;
- while (n < max_depth && stack) {
- result[n] = (void*)stack->value;
+ while (n < max_depth - 1 && stack) {
+ result[n] = (void*)stack->kind;
+ result[n + 1] = (void*)stack->value;
stack = stack->next;
- n++;
+ n += 2;
}
return n;
}
@@ -311,9 +313,9 @@
struct prof_stacktrace_s *st = (struct prof_stacktrace_s *)p->data;
st->marker = MARKER_STACKTRACE;
st->count = 1;
- st->stack[0] = GetPC((ucontext_t*)ucontext);
- depth = get_stack_trace(st->stack+1, MAX_STACK_DEPTH-2, ucontext);
- depth++; // To account for pc value in stack[0];
+ //st->stack[0] = GetPC((ucontext_t*)ucontext);
+ depth = get_stack_trace(st->stack, MAX_STACK_DEPTH-2, ucontext);
+ //depth++; // To account for pc value in stack[0];
st->depth = depth;
st->stack[depth++] = get_current_thread_id();
p->data_offset = offsetof(struct prof_stacktrace_s, marker);
@@ -459,7 +461,7 @@
header.hdr[4] = 0;
header.interp_name[0] = MARKER_HEADER;
header.interp_name[1] = '\x00';
- header.interp_name[2] = VERSION_THREAD_ID;
+ header.interp_name[2] = VERSION_TAG;
header.interp_name[3] = namelen;
memcpy(&header.interp_name[4], interp_name, namelen);
return _write_all(&header, 5 * sizeof(long) + 4 + namelen);
diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h
b/rpython/rlib/rvmprof/src/vmprof_stack.h
--- a/rpython/rlib/rvmprof/src/vmprof_stack.h
+++ b/rpython/rlib/rvmprof/src/vmprof_stack.h
@@ -1,7 +1,25 @@
+
+#define VMPROF_CODE_TAG 1
+#define VMPROF_BLACKHOLE_TAG 2
+#define VMPROF_JITTED_TAG 3
+#define VMPROF_JITTING_TAG 4
+#define VMPROF_GC_TAG 5
+// whatever we want here
typedef struct vmprof_stack {
struct vmprof_stack* next;
long value;
+ long kind;
} vmprof_stack;
+// the kind is WORD so we consume exactly 3 WORDs and we don't have
+// to worry too much. There is a potential for squeezing it with bit
+// patterns into one WORD, but I don't want to care RIGHT NOW, potential
+// for future optimization potential
+
RPY_EXTERN vmprof_stack* vmprof_global_stack;
+
+RPY_EXTERN void *vmprof_address_of_global_stack(void)
+{
+ return (void*)&vmprof_global_stack;
+}
\ No newline at end of file
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit