Skip to content

Initial PR for JFR susbsystem initialization#23602

Merged
gacholio merged 1 commit intoeclipse-openj9:masterfrom
tajila:jfr6
Apr 7, 2026
Merged

Initial PR for JFR susbsystem initialization#23602
gacholio merged 1 commit intoeclipse-openj9:masterfrom
tajila:jfr6

Conversation

@tajila
Copy link
Copy Markdown
Contributor

@tajila tajila commented Mar 30, 2026

There is an entire subsystem in the JDK responsible for profiling and recording events. A large portion of JFR functionality lives in the jfr.jdk module. There are many steps to get the JFR subsystem up and PR provides some initialization code for the JFR subsystem. Further support will need to be added to fully bringup the JFR subsystem.

Currently JFR support is limited to the VM so J9 only emits VM events and does not support any capailities that are available in the JCL.

This PR recognizes the -XX:StartOpenJ9ExperimentalFlightRecording option which differentiates it from the existing
-XX:StartFlightRecording (VM events only) option. The experimental flag will be used to enable the JFR subsystem wfor testing purposes development continues to fully bringup the JFR subsystem. Eventually, the experimental flag will be removed and the JFR subsystem will be enabled by -XX:StartFlightRecording flags.

This PR adds support to initiate initialization of the JFR subsystem cmdline arguments. It also provides some basic support to progress past the stages of JFR initialization.

@tajila tajila requested a review from gacholio March 30, 2026 13:17
@tajila tajila force-pushed the jfr6 branch 2 times, most recently from 029f0e3 to d24170d Compare March 30, 2026 15:29
Comment thread runtime/jcl/common/jclvm.c Outdated
if (NULL != unnamedModuleForSystemLoader) {
j9object_t module = unnamedModuleForSystemLoader->moduleObject;
if (NULL != module) {
moduleObject = javaVM->internalVMFunctions->j9jni_createLocalRef(env, module);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call can not fail (it aborts the VM on OOM). It returns NULL only for NULL input, so you could technically also remove the above NULL check.

}

vmFuncs->internalEnterVMFromJNI(currentThread);
vm->jfrState.jfrInternalEventClass = vmFuncs->internalFindClassUTF8(currentThread, (U_8 *)J9UTF8_DATA(&jfrInternalEventClassUTF8), J9UTF8_LENGTH(&jfrInternalEventClassUTF8), vm->systemClassLoader, 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storing J9Class pointers is problematic for HCR unless you intend to update them. Usually we use a global ref which is updated already.

Comment thread runtime/vm/jfr.cpp
@tajila tajila force-pushed the jfr6 branch 6 times, most recently from f29863d to 07e0036 Compare April 1, 2026 10:43
@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 1, 2026

@gacholio changes ready for another look

@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 1, 2026

jenkins compile win jdk17

@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 1, 2026

jenkins test sanity.functional alinux64 jdk21

@gacholio
Copy link
Copy Markdown
Contributor

gacholio commented Apr 1, 2026

The global refs should be freed during shutdown (and arguably during failed startup, i.e. one ref create, one fails).

@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 1, 2026

jenkins test sanity.functional alinux64 jdk25

@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 1, 2026

jenkins compile win jdk11

@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 1, 2026

jenkins test saniity amac jdk17

@tajila tajila marked this pull request as ready for review April 2, 2026 11:40
@tajila tajila force-pushed the jfr6 branch 3 times, most recently from 2201484 to 41352e2 Compare April 2, 2026 12:04
@tajila tajila marked this pull request as draft April 2, 2026 12:23
@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 2, 2026

jenkins test sanity.functional alinux64 jdk25

@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 2, 2026

jenkins test sanity.functional amac jdk11

@tajila tajila force-pushed the jfr6 branch 5 times, most recently from 5ab26b1 to c0b92a3 Compare April 6, 2026 13:30
There is an entire subsystem in the JDK responsible for profiling and
recording events. A large portion of JFR functionality lives in the
jfr.jdk module. There are many steps to get the JFR subsystem up and
PR provides some initialization code for the JFR subsystem. Further
support will need to be added to fully bringup the JFR subsystem.

Currently JFR support is limited to the VM so J9 only emits VM events
and does not support any capailities that are available in the JCL.

This PR recognizes the `-XX:StartOpenJ9ExperimentalFlightRecording`
option which differentiates it from the existing
`-XX:StartFlightRecording` (VM events only) option. The experimental
flag will be used to enable the JFR subsystem wfor testing purposes
development continues to fully bringup the JFR subsystem. Eventually,
the experimental flag will be removed and the JFR subsystem will be
enabled by `-XX:StartFlightRecording` flags.

This PR adds support to initiate initialization of the JFR subsystem
cmdline arguments. It also provides some basic support to progress past
the stages of JFR initialization.

Signed-off-by: Tobi Ajila <atobia@ca.ibm.com>
@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 6, 2026

jenkins test sanity.functional alinux64 jdk25

@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 6, 2026

jenkins test sanity.functional amac jdk11

@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 7, 2026

@gacholio This is ready for another look

@tajila tajila marked this pull request as ready for review April 7, 2026 11:46
@gacholio gacholio self-requested a review April 7, 2026 16:10
@tajila
Copy link
Copy Markdown
Contributor Author

tajila commented Apr 7, 2026

@gacholio can this be merged?

@gacholio
Copy link
Copy Markdown
Contributor

gacholio commented Apr 7, 2026

Sorry, didn't notice it was out of draft state.

@gacholio gacholio merged commit bc935e4 into eclipse-openj9:master Apr 7, 2026
8 checks passed
tajila added a commit to tajila/openj9 that referenced this pull request Apr 10, 2026
This reverts commit bc935e4, reversing
changes made to 3a6ad9e.
tajila added a commit to tajila/openj9 that referenced this pull request Apr 10, 2026
@tajila tajila added this to the JFR Support milestone Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants