Blocks :
|
|
Relates :
|
|
Relates :
|
HotSpot JFR Events support for Graal Compiler ** This enhancement adds jvmci supports that is required for extending existing phase/inlining events support in graal compilers. In this process all event generation code are moved to compiler/compilerEvent.hpp/ .cpp Graal use these events via jvmc JFR.java helper class, which uses c2v interface to post and get information from hotspot Overview of functionalities exposed by JFR. java registerCompilerPhase, to register compiler phases at compiler creation, called only for singleton object. Ticks, for getting current jfr counter/ time stamp. used for getting start of events by Graal compiler. CompilerPhaseEvent for posting phase event to hotspot JFR. CompilerInlininingEvent for posting inlininig events. Detailed Design Note: This covers the JFR Provider and JVMCI part of the design only. Most other parts of event generation in Graal simply mimic DebugContext and dump handling code. This change introduces JFRProvider in Graal to notify a provider of JFR compilation events. The HotSpot-specific implementation of this provider is in HotSpotJFRProvider. HotSpotJFRProvider uses HotSpot-specific JVMCI API (JFR) to describe events. There are two compiler events defined by JFRProvider: JFRProvider.CompilerPhaseEvent JFRProvider.CompilerInliningEvent Both compiler events provide a write() method. HotSpotJFRProvider implements the above provider using the JVMCI JFR class to translate the events to EventCompilerPhase and EventCompilerInlining events in the HotSpot JFR C++ implementation. The JFR helper class provides helper classes/methods to access HotSpot JFR features required to implement HotSpotJFRProvider. Each HotSpot feature is implemented as nested class. Overview of features in JFR class. JFR.registerCompilerPhases, used for registering compiler phases on compiler create(used only for singleton object) JFR.Ticks class is used to access the current JFR time stamp. Each HotSpot JFR compiler event defined in src/share/jfr/metadata/metadata.xml has corresponding class at the Java level JFR.CompilerPhaseEvent JFR.CompilerInliningEvent These helper classes are used to notify events via C2V interface JFR.CompilerPhaseEvent requires phaseToId mapping in TYPE_COMPILERPHASETYPE. This is maintained as a growable array in compiler/compilerEvent.hpp and a cached copy in JFR.CompilerPhaseEvent. Comparison with earlier C2 implementation: In earlier C2 implementation idToPhase/phaseToId mapping is maintained in opto/phasetype.hpp. This is the compile time constant enum and a helper class. with JVMCI it is maintained as a growable array in compiler/compilerEvent.hpp and its cached copy maintained in JFR.CompilerPhaseEvent JFR Changes Extended the current content type TYPE_COMPILERPHASETYPE, to support Graal phases. CompilerPhaseEvent extends and use TYPE_COMPILERPHASETYPE content type for phase events CompilerEvent::PhaseType::register_phases is used for registering phases. This function is usually called on compiler singleton object creation. It is also called lazily if phases are not known beforehand. Testing All tests in jdk/jdk/jfr were run. There were a few unrelated failures There are no new tests added for this enhancement as it uses exisiting native events, and tests in jdk/jfr covers it. 1) Execution failed: `main' threw exception: java.lang.NoClassDefFoundError: jdk/test/lib/Utils jdk/jfr/javaagent/TestLoadedAgent.java: Tests emitting events in a dynamically loaded Java agent jdk/jfr/javaagent/TestPremainAgent.java: Tests emitting event before main using a Java agent Ran this separately, it passes 2) Execution failed: `main' threw exception: java.lang.RuntimeException: Expected to get exit value of [0] jdk/jfr/event/io/TestInstrumentation.java: Test that will instrument the same classes that JFR will also instrument. Fails with other compilers. jdk/jfr/jvm/TestJfrJavaBase.java: verify that jfr can not be used when JVM is executed only with java.base Execution failed: `main' threw exception: java.lang.RuntimeException: Wrong shouldCommit(): expected false to equal true Fails with other compilers. jdk/jfr/api/event/TestShouldCommit.java: Test enable/disable event and verify recording has expected events. Fails with other compilers. Program `/mnt/Work/OpenGrok/source/graal_latest/graal/compiler/mxbuild/linux-amd64/graaljdks/jdk14-cmp/bin/java' timed out (timeout set to 120000ms, elapsed time including timeout handling was 120274ms). jdk/jfr/event/io/EvilInstrument.java: This test runs JFR with a javaagent that reads/writes files and sockets during every class definition. Timeouts with other compilers. Entire JVMCI changes :http://cr.openjdk.java.net/~jcm/8193210/webrev/
|