Skip to content

Commit 7344a0f

Browse files
linux fix + more cleanup
1 parent 8977399 commit 7344a0f

11 files changed

+9
-50
lines changed

src/dwarf.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#include <stdlib.h>
77
#include "dwarf.h"
8+
9+
#include <cstring>
10+
#include <stdio.h>
11+
812
#include "log.h"
913

1014

src/perfEvents.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class PerfEvents : public CpuEngine {
4545
const char* title();
4646
const char* units();
4747

48-
static int walk(int tid, void* ucontext, const void** callchain, int max_depth, StackContext* java_ctx);
48+
static int walk(int tid, void* ucontext, const void** callchain, int max_depth, StackContext* stack_ctx);
4949
static void resetBuffer(int tid);
5050

5151
static bool supported();

src/perfEvents_linux.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ void PerfEvents::stop() {
896896
J9StackTraces::stop();
897897
}
898898

899-
int PerfEvents::walk(int tid, void* ucontext, const void** callchain, int max_depth, StackContext* java_ctx) {
899+
int PerfEvents::walk(int tid, void* ucontext, const void** callchain, int max_depth, StackContext* stack_ctx) {
900900
PerfEvent* event = &_events[tid];
901901
if (!event->tryLock()) {
902902
return 0; // the event is being destroyed
@@ -917,7 +917,7 @@ int PerfEvents::walk(int tid, void* ucontext, const void** callchain, int max_de
917917

918918
if (hdr->type == PERF_RECORD_SAMPLE) {
919919
if (_record_cpu) {
920-
java_ctx->cpu = ring.next();
920+
stack_ctx->cpu = ring.next();
921921
}
922922

923923
u64 nr = ring.next();
@@ -927,7 +927,6 @@ int PerfEvents::walk(int tid, void* ucontext, const void** callchain, int max_de
927927
const void* iptr = (const void*)ip;
928928
if (CodeHeap::contains(iptr) || depth >= max_depth) {
929929
// Stop at the first Java frame
930-
java_ctx->pc = iptr;
931930
goto stack_complete;
932931
}
933932
callchain[depth++] = iptr;
@@ -946,9 +945,9 @@ int PerfEvents::walk(int tid, void* ucontext, const void** callchain, int max_de
946945
event->unlock();
947946

948947
if (_cstack == CSTACK_FP) {
949-
depth += StackWalker::walkFP(ucontext, callchain + depth, max_depth - depth, java_ctx);
948+
depth += StackWalker::walkFP(ucontext, callchain + depth, max_depth - depth);
950949
} else if (_cstack == CSTACK_DWARF) {
951-
depth += StackWalker::walkDwarf(ucontext, callchain + depth, max_depth - depth, java_ctx);
950+
depth += StackWalker::walkDwarf(ucontext, callchain + depth, max_depth - depth);
952951
}
953952

954953
return depth;

src/stackFrame.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class StackFrame {
4949
void ret();
5050

5151
bool unwindStub(instruction_t* entry, const char* name, uintptr_t& pc, uintptr_t& sp, uintptr_t& fp);
52-
bool unwindAtomicStub(const void*& pc);
5352

5453
bool unwindPrologue(NMethod* nm, uintptr_t& pc, uintptr_t& sp, uintptr_t& fp);
5554
bool unwindEpilogue(NMethod* nm, uintptr_t& pc, uintptr_t& sp, uintptr_t& fp);

src/stackFrame_aarch64.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,6 @@ bool StackFrame::unwindEpilogue(NMethod* nm, uintptr_t& pc, uintptr_t& sp, uintp
292292
return false;
293293
}
294294

295-
bool StackFrame::unwindAtomicStub(const void*& pc) {
296-
// VM threads may call generated atomic stubs, which are not normally walkable
297-
const void* lr = (const void*)link();
298-
if (VMStructs::libjvm()->contains(lr)) {
299-
NMethod* nm = CodeHeap::findNMethod(pc);
300-
if (nm != NULL && strncmp(nm->name(), "Stub", 4) == 0) {
301-
pc = lr;
302-
return true;
303-
}
304-
}
305-
return false;
306-
}
307-
308295
void StackFrame::adjustSP(const void* entry, const void* pc, uintptr_t& sp) {
309296
instruction_t* ip = (instruction_t*)pc;
310297
if (ip > entry && (ip[-1] == 0xa9bf27ff || (ip[-1] == 0xd63f0100 && ip[-2] == 0xa9bf27ff))) {

src/stackFrame_arm.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ bool StackFrame::unwindEpilogue(NMethod* nm, uintptr_t& pc, uintptr_t& sp, uintp
9393
return false;
9494
}
9595

96-
bool StackFrame::unwindAtomicStub(const void*& pc) {
97-
// Not needed
98-
return false;
99-
}
100-
10196
void StackFrame::adjustSP(const void* entry, const void* pc, uintptr_t& sp) {
10297
// Not needed
10398
}

src/stackFrame_i386.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,6 @@ bool StackFrame::unwindEpilogue(NMethod* nm, uintptr_t& pc, uintptr_t& sp, uintp
116116
return false;
117117
}
118118

119-
bool StackFrame::unwindAtomicStub(const void*& pc) {
120-
// Not needed
121-
return false;
122-
}
123-
124119
void StackFrame::adjustSP(const void* entry, const void* pc, uintptr_t& sp) {
125120
// Not needed
126121
}

src/stackFrame_loongarch64.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ bool StackFrame::unwindEpilogue(NMethod* nm, uintptr_t& pc, uintptr_t& sp, uintp
8787
return false;
8888
}
8989

90-
bool StackFrame::unwindAtomicStub(const void*& pc) {
91-
// Not needed
92-
return false;
93-
}
94-
9590
void StackFrame::adjustSP(const void* entry, const void* pc, uintptr_t& sp) {
9691
// Not yet implemented
9792
}

src/stackFrame_ppc64.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ bool StackFrame::unwindEpilogue(NMethod* nm, uintptr_t& pc, uintptr_t& sp, uintp
8080
return false;
8181
}
8282

83-
bool StackFrame::unwindAtomicStub(const void*& pc) {
84-
// Not needed
85-
return false;
86-
}
87-
8883
void StackFrame::adjustSP(const void* entry, const void* pc, uintptr_t& sp) {
8984
// Not needed
9085
}

src/stackFrame_riscv64.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ bool StackFrame::unwindEpilogue(NMethod* nm, uintptr_t& pc, uintptr_t& sp, uintp
8787
return false;
8888
}
8989

90-
bool StackFrame::unwindAtomicStub(const void*& pc) {
91-
// Not needed
92-
return false;
93-
}
94-
9590
void StackFrame::adjustSP(const void* entry, const void* pc, uintptr_t& sp) {
9691
// Not yet implemented
9792
}

0 commit comments

Comments
 (0)