Skip to content

Commit 8977399

Browse files
More AGCT cleanup after removing recovery tricks
1 parent 0023021 commit 8977399

File tree

5 files changed

+14
-28
lines changed

5 files changed

+14
-28
lines changed

src/cpuEngine.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ void CpuEngine::signalHandlerJ9(int signo, siginfo_t* siginfo, void* ucontext) {
124124
if (!_enabled) return;
125125

126126
J9StackTraceNotification notif;
127-
StackContext java_ctx;
128127
notif.num_frames = _cstack == CSTACK_NO ? 0 : _cstack == CSTACK_DWARF
129-
? StackWalker::walkDwarf(ucontext, notif.addr, MAX_J9_NATIVE_FRAMES, &java_ctx)
130-
: StackWalker::walkFP(ucontext, notif.addr, MAX_J9_NATIVE_FRAMES, &java_ctx);
128+
? StackWalker::walkDwarf(ucontext, notif.addr, MAX_J9_NATIVE_FRAMES)
129+
: StackWalker::walkFP(ucontext, notif.addr, MAX_J9_NATIVE_FRAMES);
131130
J9StackTraces::checkpoint(_interval, &notif);
132131
}

src/profiler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ int Profiler::getNativeTrace(void* ucontext, ASGCT_CallFrame* frames, EventType
294294
} else if (_cstack == CSTACK_VM) {
295295
return 0;
296296
} else if (_cstack == CSTACK_DWARF) {
297-
native_frames = StackWalker::walkDwarf(ucontext, callchain, MAX_NATIVE_FRAMES, java_ctx);
297+
native_frames = StackWalker::walkDwarf(ucontext, callchain, MAX_NATIVE_FRAMES);
298298
} else {
299-
native_frames = StackWalker::walkFP(ucontext, callchain, MAX_NATIVE_FRAMES, java_ctx);
299+
native_frames = StackWalker::walkFP(ucontext, callchain, MAX_NATIVE_FRAMES);
300300
}
301301

302302
return convertNativeTrace(native_frames, callchain, frames, event_type);
@@ -331,7 +331,7 @@ int Profiler::convertNativeTrace(int native_frames, const void** callchain, ASGC
331331
return depth;
332332
}
333333

334-
int Profiler::getJavaTraceAsync(void* ucontext, ASGCT_CallFrame* frames, int max_depth, StackContext* java_ctx) {
334+
int Profiler::getJavaTraceAsync(void* ucontext, ASGCT_CallFrame* frames, int max_depth) {
335335
// Workaround for JDK-8132510: it's not safe to call GetEnv() inside a signal handler
336336
// since JDK 9, so we do it only for threads already registered in ThreadLocalStorage
337337
VMThread* vm_thread = VMThread::current();
@@ -433,14 +433,14 @@ u64 Profiler::recordSample(void* ucontext, u64 counter, EventType event_type, Ev
433433
if (_cstack == CSTACK_VM) {
434434
num_frames += StackWalker::walkVM(ucontext, frames + num_frames, _max_stack_depth, lock_index, _features, event_type);
435435
} else {
436-
num_frames += getJavaTraceAsync(ucontext, frames + num_frames, _max_stack_depth, &java_ctx);
436+
num_frames += getJavaTraceAsync(ucontext, frames + num_frames, _max_stack_depth);
437437
}
438438
} else if (event_type >= ALLOC_SAMPLE && event_type <= ALLOC_OUTSIDE_TLAB && _alloc_engine == &alloc_tracer) {
439439
if (VMStructs::hasStackStructs()) {
440440
StackWalkFeatures no_features{};
441441
num_frames += StackWalker::walkVM(ucontext, frames + num_frames, _max_stack_depth, lock_index, no_features, event_type);
442442
} else {
443-
num_frames += getJavaTraceAsync(ucontext, frames + num_frames, _max_stack_depth, &java_ctx);
443+
num_frames += getJavaTraceAsync(ucontext, frames + num_frames, _max_stack_depth);
444444
}
445445
} else {
446446
// Lock events and instrumentation events can safely call synchronous JVM TI stack walker.

src/profiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class Profiler {
111111
const char* asgctError(int code);
112112
u32 getLockIndex(int tid);
113113
int getNativeTrace(void* ucontext, ASGCT_CallFrame* frames, EventType event_type, int tid, StackContext* java_ctx);
114-
int getJavaTraceAsync(void* ucontext, ASGCT_CallFrame* frames, int max_depth, StackContext* java_ctx);
114+
int getJavaTraceAsync(void* ucontext, ASGCT_CallFrame* frames, int max_depth);
115115
int getJavaTraceJvmti(jvmtiFrameInfo* jvmti_frames, ASGCT_CallFrame* frames, int start_depth, int max_depth);
116116
void setThreadInfo(int tid, const char* name, jlong java_thread_id);
117117
void updateThreadName(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread);

src/stackWalker.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static jmethodID getMethodId(VMMethod* method) {
6262
}
6363

6464

65-
int StackWalker::walkFP(void* ucontext, const void** callchain, int max_depth, StackContext* java_ctx) {
65+
int StackWalker::walkFP(void* ucontext, const void** callchain, int max_depth) {
6666
const void* pc;
6767
uintptr_t fp;
6868
uintptr_t sp;
@@ -83,8 +83,7 @@ int StackWalker::walkFP(void* ucontext, const void** callchain, int max_depth, S
8383

8484
// Walk until the bottom of the stack or until the first Java frame
8585
while (depth < max_depth) {
86-
if (CodeHeap::contains(pc) && !(depth == 0 && frame.unwindAtomicStub(pc))) {
87-
java_ctx->set(pc, sp, fp);
86+
if (CodeHeap::contains(pc)) {
8887
break;
8988
}
9089

@@ -112,7 +111,7 @@ int StackWalker::walkFP(void* ucontext, const void** callchain, int max_depth, S
112111
return depth;
113112
}
114113

115-
int StackWalker::walkDwarf(void* ucontext, const void** callchain, int max_depth, StackContext* java_ctx) {
114+
int StackWalker::walkDwarf(void* ucontext, const void** callchain, int max_depth) {
116115
const void* pc;
117116
uintptr_t fp;
118117
uintptr_t sp;
@@ -134,10 +133,7 @@ int StackWalker::walkDwarf(void* ucontext, const void** callchain, int max_depth
134133

135134
// Walk until the bottom of the stack or until the first Java frame
136135
while (depth < max_depth) {
137-
if (CodeHeap::contains(pc) && !(depth == 0 && frame.unwindAtomicStub(pc))) {
138-
// Don't dereference pc as it may point to unreadable memory
139-
// frame.adjustSP(page_start, pc, sp);
140-
java_ctx->set(pc, sp, fp);
136+
if (CodeHeap::contains(pc)) {
141137
break;
142138
}
143139

src/stackWalker.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,13 @@
1515
class JavaFrameAnchor;
1616

1717
struct StackContext {
18-
const void* pc;
19-
uintptr_t sp;
20-
uintptr_t fp;
2118
u64 cpu;
22-
23-
void set(const void* pc, uintptr_t sp, uintptr_t fp) {
24-
this->pc = pc;
25-
this->sp = sp;
26-
this->fp = fp;
27-
}
2819
};
2920

3021
class StackWalker {
3122
public:
32-
static int walkFP(void* ucontext, const void** callchain, int max_depth, StackContext* java_ctx);
33-
static int walkDwarf(void* ucontext, const void** callchain, int max_depth, StackContext* java_ctx);
23+
static int walkFP(void* ucontext, const void** callchain, int max_depth);
24+
static int walkDwarf(void* ucontext, const void** callchain, int max_depth);
3425
static int walkVM(void* ucontext, ASGCT_CallFrame* frames, int max_depth, int lock_index,
3526
StackWalkFeatures features, EventType event_type);
3627

0 commit comments

Comments
 (0)