RFR: 8282420: JFR: Remove event handlers [v6]

Doug Simon dnsimon at openjdk.org
Thu Jul 7 11:19:44 UTC 2022


On Tue, 10 May 2022 14:42:58 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

>> Hi,
>> 
>> Could I have a review of a fix that removes event handler classes for JFR. Bytecode for event instrumentation is now only added to the event class. Benefits are:
>> 
>> - No class memory leak in the boot class loader.
>> - Reduce overhead from class loading during startup, which is important with additional JDK events that are coming (VirtualThreadStart etc.)
>> - One less frame to traverse when recording a Java stack trace.
>> 
>> Future benefits are:
>> 
>> - Simplify creating instrumentation as a build step. See https://bugs.openjdk.java.net/browse/JDK-8279354
>> - Simplify implementation of Event Metrics. See https://bugs.openjdk.java.net/browse/JDK-8224749
>> 
>> When the Security Manager is removed, much of the code being added for security reasons can be deleted.
>> 
>> There are few JFR hooks when code is being linked. Plan is to also use these for other events later. 
>> 
>> Testing: tier 1-4, jdk/jdk/jfr
>> 
>> Thanks
>> Erik
>
> Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Minor fixes

test/jdk/jdk/jfr/jvm/TestGetEventWriter.java line 114:

> 112:         Event e = newEventObject("RegisteredTrueEvent");
> 113:         try {
> 114:             e.commit(); // throws

When I modify this test to print the IllegalAccessError, I get:

java.lang.IllegalAccessError: class jdk.jfr.jvm.RegisteredTrueEvent (in unnamed module @0x4ed05077) cannot access class jdk.jfr.internal.event.EventWriterFactory (in module jdk.jfr) because module jdk.jfr does not export jdk.jfr.internal.event to unnamed module @0x4ed05077
	at jdk.jfr.jvm.RegisteredTrueEvent.commit(RegisteredTrueEvent.java:31)
	at jdk.jfr.jvm.TestGetEventWriter.testRegisteredTrueEvent(TestGetEventWriter.java:104)


I was assuming this test is attempting to instead trigger the IAE thrown when linking the commit call.
This is achieved by adding `-vmoptions:--add-exports=jdk.jfr/jdk.jfr.internal.event=ALL-UNNAMED` to the jtreg command line:

java.lang.IllegalAccessError: illegal access linking method 'jdk.jfr.internal.event.EventWriterFactory.getEventWriter(long)'
	at jdk.jfr.jvm.RegisteredTrueEvent.commit(RegisteredTrueEvent.java:31)
	at jdk.jfr.jvm.TestGetEventWriter.testRegisteredTrueEvent(TestGetEventWriter.java:104)


Maybe this should be added to the `@run` directives?

-------------

PR: https://git.openjdk.org/jdk/pull/8383


More information about the hotspot-jfr-dev mailing list