@@ -284,19 +284,19 @@ CodeBlob* Profiler::findRuntimeStub(const void* address) {
284284 return _runtime_stubs.findBlobByAddress (address);
285285}
286286
287- int Profiler::getNativeTrace (void * ucontext, ASGCT_CallFrame* frames, EventType event_type, int tid, StackContext* java_ctx ) {
287+ int Profiler::getNativeTrace (void * ucontext, ASGCT_CallFrame* frames, EventType event_type, int tid, u64 * cpu ) {
288288 const void * callchain[MAX_NATIVE_FRAMES];
289289 int native_frames;
290290
291291 // Use PerfEvents stack walker for execution samples, or basic stack walker for other events
292292 if (event_type == PERF_SAMPLE) {
293- native_frames = PerfEvents::walk (tid, ucontext, callchain, MAX_NATIVE_FRAMES, java_ctx );
293+ native_frames = PerfEvents::walk (tid, ucontext, callchain, MAX_NATIVE_FRAMES, cpu );
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 ();
@@ -417,13 +417,13 @@ u64 Profiler::recordSample(void* ucontext, u64 counter, EventType event_type, Ev
417417 }
418418 }
419419
420- StackContext java_ctx = { 0 } ;
420+ u64 cpu = 0 ;
421421 if (hasNativeStack (event_type)) {
422422 if (_features.pc_addr && event_type <= WALL_CLOCK_SAMPLE) {
423423 num_frames += makeFrame (frames + num_frames, BCI_ADDRESS, StackFrame (ucontext).pc ());
424424 }
425425 if (_cstack != CSTACK_NO) {
426- num_frames += getNativeTrace (ucontext, frames + num_frames, event_type, tid, &java_ctx );
426+ num_frames += getNativeTrace (ucontext, frames + num_frames, event_type, tid, &cpu );
427427 }
428428 }
429429
@@ -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.
@@ -460,7 +460,7 @@ u64 Profiler::recordSample(void* ucontext, u64 counter, EventType event_type, Ev
460460 num_frames += makeFrame (frames + num_frames, BCI_ERROR, OS::schedPolicy (0 ));
461461 }
462462 if (_add_cpu_frame && event_type == PERF_SAMPLE) {
463- num_frames += makeFrame (frames + num_frames, BCI_CPU, java_ctx. cpu | 0x8000 );
463+ num_frames += makeFrame (frames + num_frames, BCI_CPU, cpu | 0x8000 );
464464 }
465465
466466 if (stack_walk_begin != 0 ) {
0 commit comments