Skip to content

Commit 60af720

Browse files
authored
Merge pull request #20649 from tajila/jfr2
(0.49) Recent JFR fixes
2 parents c73c323 + c4edde8 commit 60af720

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

jcl/src/java.base/share/classes/java/lang/System.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,10 @@ private static void ensureProperties(boolean isInitialization) {
736736
/*[ENDIF] CRIU_SUPPORT */
737737

738738
/*[IF JFR_SUPPORT]*/
739+
/* Enables openj9 JFR tests. */
739740
initializedProperties.put("org.eclipse.openj9.jfr.isJFREnabled", "true"); //$NON-NLS-1$ //$NON-NLS-2$
741+
/* TODO disable JFR JCL APIs until JFR natives are implemented. */
742+
initializedProperties.put("jfr.unsupported.vm", "true"); //$NON-NLS-1$ //$NON-NLS-2$
740743
/*[ENDIF] JFR_SUPPORT */
741744

742745
String[] list = getPropertyList();

runtime/vm/JFRConstantPoolTypes.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,15 @@ VM_JFRConstantPoolTypes::addThreadGroupEntry(j9object_t threadGroup)
853853
entry->parentIndex = addThreadGroupEntry(J9VMJAVALANGTHREADGROUP_PARENT(_currentThread, threadGroup));
854854
if (isResultNotOKay()) goto done;
855855

856+
/* Check again to see if the Threadgroup was added recursively. */
857+
entry = (ThreadGroupEntry *) hashTableFind(_threadGroupTable, entry);
858+
if (NULL != entry) {
859+
index = entry->index;
860+
goto done;
861+
} else {
862+
entry = &entryBuffer;
863+
}
864+
856865
entry->name = copyStringToJ9UTF8WithMemAlloc(_currentThread, J9VMJAVALANGTHREADGROUP_NAME(_currentThread, threadGroup), J9_STR_NONE, "", 0, NULL, 0);
857866

858867
entry->index = _threadGroupCount;

runtime/vm/jfr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,9 +979,11 @@ jfrSamplingThreadProc(void *entryArg)
979979
while (J9JFR_SAMPLER_STATE_STOP != vm->jfrSamplerState) {
980980
J9SignalAsyncEvent(vm, NULL, vm->jfrAsyncKey);
981981
if (0 == (count % 100)) { // 1 second
982+
omrthread_monitor_exit(vm->jfrSamplerMutex);
982983
internalAcquireVMAccess(currentThread);
983984
jfrCPULoad(currentThread);
984985
internalReleaseVMAccess(currentThread);
986+
omrthread_monitor_enter(vm->jfrSamplerMutex);
985987
if (0 == (count % 1000)) { // 10 seconds
986988
J9SignalAsyncEvent(vm, NULL, vm->jfrThreadCPULoadAsyncKey);
987989
}

0 commit comments

Comments
 (0)