JDK-8151532 : Add support for module aware agents introduced regression for CompiledMethodLoad event
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 9-repo-jigsaw
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-03-09
  • Updated: 2016-03-15
  • Resolved: 2016-03-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9-repo-jigsawFixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
A regression was introduced with the fix for the task:
  https://bugs.openjdk.java.net/browse/JDK-8146454

This is a email message from Mandy:

The demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java is failing.
Do you think this is related to  the early start capability change?
The error looks like:

ERROR: JVMTI: 112(JVMTI_ERROR_WRONG_PHASE): get method declaring class

One JPRT log:
http://scaaa637.us.oracle.com/archive/2016/03/2016-03-08-223439.mlchung.jake-dev/logs/macosx_x64_10.9-product-c2-svc_tools.log.FAILED.log
Comments
The following linked bug describes the same manifestation/symptom: https://bugs.openjdk.java.net/browse/JDK-8067876
15-03-2016

The suggested fix is: % hg diff diff -r 1ae14b475915 src/share/vm/prims/jvmtiExport.cpp --- a/src/share/vm/prims/jvmtiExport.cpp Tue Mar 08 15:34:23 2016 -0500 +++ b/src/share/vm/prims/jvmtiExport.cpp Wed Mar 09 15:59:05 2016 +0000 @@ -835,6 +835,9 @@ void JvmtiExport::post_compiled_method_unload( jmethodID method, const void *code_begin) { + if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) { + return; + } JavaThread* thread = JavaThread::current(); EVT_TRIG_TRACE(JVMTI_EVENT_COMPILED_METHOD_UNLOAD, ("JVMTI [%s] method compile unload event triggered", @@ -844,7 +847,9 @@ JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_COMPILED_METHOD_UNLOAD)) { - + if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { + continue; + } EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_UNLOAD, ("JVMTI [%s] class compile method unload event sent jmethodID " PTR_FORMAT, JvmtiTrace::safe_get_thread_name(thread), p2i(method))); @@ -1867,6 +1872,9 @@ } void JvmtiExport::post_compiled_method_load(nmethod *nm) { + if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) { + return; + } JavaThread* thread = JavaThread::current(); EVT_TRIG_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, @@ -1876,7 +1884,9 @@ JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_COMPILED_METHOD_LOAD)) { - + if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { + continue; + } EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, ("JVMTI [%s] class compile method load event sent %s.%s ", JvmtiTrace::safe_get_thread_name(thread), @@ -1906,6 +1916,9 @@ const void *code_begin, const jint map_length, const jvmtiAddrLocationMap* map) { + if (env->phase() <= JVMTI_PHASE_PRIMORDIAL) { + return; + } JavaThread* thread = JavaThread::current(); EVT_TRIG_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, ("JVMTI [%s] method compile load event triggered (by GenerateEvents)",
09-03-2016