Skip to content

JFR V2 cmdline option parsing - #23776

Merged
tajila merged 1 commit into
eclipse-openj9:masterfrom
JasonFengJ9:jfrv2cmd
May 13, 2026
Merged

JFR V2 cmdline option parsing#23776
tajila merged 1 commit into
eclipse-openj9:masterfrom
JasonFengJ9:jfrv2cmd

Conversation

@JasonFengJ9

@JasonFengJ9 JasonFengJ9 commented Apr 20, 2026

Copy link
Copy Markdown
Member

JFR V2 cmdline option parsing

JFR V2 implementation can be enabled only when JFR support is enabled;
Added com.ibm.oti.vm.VM.isJFRV2SupportEnabled() and native;
Removed VMOPT_XXSTARTOPENJ9EXPERIMENTALFLIGHTRECORDING;
Updated JFR V2 cmdline option parsing;
Added a test.

Related to

Signed-off-by: Jason Feng fengj@ca.ibm.com

@JasonFengJ9
JasonFengJ9 marked this pull request as draft April 20, 2026 12:33
@JasonFengJ9

Copy link
Copy Markdown
Member Author

@tajila Could you comment on if this PR in progress matches the issue described by #23753?

@tajila
tajila self-requested a review April 20, 2026 13:03

@tajila tajila left a comment

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.

The main required change is still missing. Basically, #define VMOPT_XXSTARTOPENJ9EXPERIMENTALFLIGHTRECORDING "-XX:StartOpenJ9ExperimentalFlightRecording" can go away and instead we can replace with -XX:+|-EnableOpenJ9ExperimentalFlightRecording which will set the J9_EXTENDED_RUNTIME3_JFR_V2_SUPPORT flag if enabled.

What is currently done under -XX:StartOpenJ9ExperimentalFlightRecording ie https://github.com/eclipse-openj9/openj9/blob/master/runtime/vm/jvminit.c#L4657-L4675 should now be done in -XX:StartFlightRecording= only if J9_EXTENDED_RUNTIME3_JFR_V2_SUPPORT. If the flag is not set, then the existing behaviour should remain.

Comment thread runtime/vm/jfr.cpp Outdated
Comment thread runtime/vm/jfr.cpp Outdated
Comment thread test/functional/cmdLineTests/jfr/jfr.xml
@JasonFengJ9

Copy link
Copy Markdown
Member Author

Added XX:+|-EnableOpenJ9ExperimentalFlightRecording and JFR V2 cmdline parsing uses existing VMOPT_XXSTARTFLIGHTRECORDING.

@tajila could you have another look?

@JasonFengJ9
JasonFengJ9 requested a review from tajila May 11, 2026 15:24
Comment thread jcl/src/java.base/share/classes/java/lang/JFRHelpers.java Outdated
Comment thread jcl/src/java.base/share/classes/java/lang/JFRHelpers.java Outdated
@JasonFengJ9
JasonFengJ9 marked this pull request as ready for review May 11, 2026 20:31
@JasonFengJ9
JasonFengJ9 requested a review from tajila May 11, 2026 20:31
@JasonFengJ9

Copy link
Copy Markdown
Member Author

@tajila this is ready for review.

Comment thread jcl/src/java.base/share/classes/java/lang/JFRHelpers.java Outdated
Comment thread jcl/src/java.base/share/classes/java/lang/JFRHelpers.java Outdated
Comment thread runtime/oti/vm_api.h Outdated
JFR V2 implementation can be enabled only when JFR support is enabled;
Added com.ibm.oti.vm.VM.isJFRV2SupportEnabled() and native;
Removed VMOPT_XXSTARTOPENJ9EXPERIMENTALFLIGHTRECORDING;
Updated JFR V2 cmdline option parsing;
Added a test.

Signed-off-by: Jason Feng <fengj@ca.ibm.com>
@JasonFengJ9

Copy link
Copy Markdown
Member Author

Removed <command>$EXE$ -XX:+EnableOpenJ9ExperimentalFlightRecording -XX:StartFlightRecording -Dibm.java9.forceCommonCleanerShutdown=true -Xint -Xcheck:memory --add-opens java.base/java.lang=ALL-UNNAMED --add-exports java.base/com.ibm.oti.vm=ALL-UNNAMED -cp $RESJAR$ org.openj9.test.WorkLoad 10 100 10 false</command> from jfrevents.xml.

java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:575)
	at java.base/java.lang.JFRHelpers.initJFRCmdlineOptions(JFRHelpers.java:132)
	at java.base/java.lang.JFRHelpers.initJFRv2(JFRHelpers.java:240)
Caused by: java.lang.IllegalStateException: Flight Recorder is not supported on this VM
	at jdk.jfr/jdk.jfr.internal.JVMSupport.ensureWithIllegalStateException(JVMSupport.java:77)
	at jdk.jfr/jdk.jfr.FlightRecorder.getFlightRecorder(FlightRecorder.java:176)
	at jdk.jfr/jdk.jfr.internal.dcmd.DCmdStart.initializeWithForcedInstrumentation(DCmdStart.java:284)
	at jdk.jfr/jdk.jfr.internal.dcmd.DCmdStart.execute(DCmdStart.java:132)
	at jdk.jfr/jdk.jfr.internal.dcmd.AbstractDCmd.execute(AbstractDCmd.java:88)
	... 6 more
Exception in thread "main" java.lang.InternalError: java.lang.IllegalStateException: Flight Recorder is not supported on this VM
	at java.base/java.lang.JFRHelpers.initJFRCmdlineOptions(JFRHelpers.java:141)
	at java.base/java.lang.JFRHelpers.initJFRv2(JFRHelpers.java:240)
Caused by: java.lang.IllegalStateException: Flight Recorder is not supported on this VM
	at jdk.jfr/jdk.jfr.internal.JVMSupport.ensureWithIllegalStateException(JVMSupport.java:77)
	at jdk.jfr/jdk.jfr.FlightRecorder.getFlightRecorder(FlightRecorder.java:176)
	at jdk.jfr/jdk.jfr.internal.dcmd.DCmdStart.initializeWithForcedInstrumentation(DCmdStart.java:284)
	at jdk.jfr/jdk.jfr.internal.dcmd.DCmdStart.execute(DCmdStart.java:132)
	at jdk.jfr/jdk.jfr.internal.dcmd.AbstractDCmd.execute(AbstractDCmd.java:88)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:575)
	at java.base/java.lang.JFRHelpers.initJFRCmdlineOptions(JFRHelpers.java:132)
	... 1 more

This seems due to uncompleted V2 implementation

Java_jdk_jfr_internal_JVM_isAvailable(JNIEnv *env, jobject obj)
{
// TODO: implementation
return JNI_FALSE;

@JasonFengJ9
JasonFengJ9 requested a review from tajila May 12, 2026 15:50
@tajila

tajila commented May 12, 2026

Copy link
Copy Markdown
Contributor

jenkins test sanity.functional,extended.functional xlinux jdk17,jdk21

@tajila
tajila merged commit e844487 into eclipse-openj9:master May 13, 2026
9 of 10 checks passed
@JasonFengJ9
JasonFengJ9 deleted the jfrv2cmd branch May 13, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants