@@ -653,7 +653,6 @@ u64 Profiler::recordJVMTISample(u64 counter, int tid, jthread thread, jint event
653653#endif // COUNTERS
654654 }
655655 if (!deferred) {
656- setWallSampleIdIfNeeded (event_type, event);
657656 _jfr.recordEvent (lock_index, tid, call_trace_id, event_type, event);
658657 }
659658
@@ -673,7 +672,6 @@ void Profiler::recordDeferredSample(int tid, u64 call_trace_id, jint event_type,
673672 return ;
674673 }
675674
676- setWallSampleIdIfNeeded (event_type, event);
677675 _jfr.recordEvent (lock_index, tid, call_trace_id, event_type, event);
678676
679677 _locks[lock_index].unlock ();
@@ -743,7 +741,6 @@ bool Profiler::recordSample(void *ucontext, u64 counter, int tid,
743741 }
744742#endif // COUNTERS
745743 }
746- setWallSampleIdIfNeeded (event_type, event);
747744 if (event_type == BCI_WALL ) {
748745 static_cast <ExecutionEvent *>(event)->_call_trace_id = call_trace_id;
749746 }
@@ -757,7 +754,8 @@ bool Profiler::recordSample(void *ucontext, u64 counter, int tid,
757754}
758755
759756bool Profiler::recordSampleDelegated (void *ucontext, u64 weight, int tid,
760- jint event_type, Event *event) {
757+ jint event_type, Event *event,
758+ u64 *recorded_correlation_id) {
761759 if (!VM::canRequestStackTrace ()) {
762760 return false ;
763761 }
@@ -790,12 +788,11 @@ bool Profiler::recordSampleDelegated(void *ucontext, u64 weight, int tid,
790788 return false ;
791789 }
792790
793- setWallSampleIdIfNeeded (event_type, event);
794- if (event_type == BCI_WALL ) {
795- static_cast <ExecutionEvent *>(event)->_correlation_id = correlation_id;
796- }
797791 bool recorded =
798792 _jfr.recordEventDelegated (lock_index, tid, correlation_id, event_type, event);
793+ if (recorded && recorded_correlation_id != nullptr ) {
794+ *recorded_correlation_id = correlation_id;
795+ }
799796 _locks[lock_index].unlock ();
800797 return recorded;
801798}
@@ -901,7 +898,6 @@ void Profiler::recordExternalSample(u64 weight, int tid, int num_frames,
901898
902899 u64 call_trace_id =
903900 _call_trace_storage.put (num_frames, extended_frames, truncated, weight);
904- setWallSampleIdIfNeeded (event_type, event);
905901 _jfr.recordEvent (lock_index, tid, call_trace_id, event_type, event);
906902
907903 _locks[lock_index].unlock ();
0 commit comments