2168 ("[%s] method compile load event triggered", |
2168 ("[%s] method compile load event triggered", |
2169 JvmtiTrace::safe_get_thread_name(thread))); |
2169 JvmtiTrace::safe_get_thread_name(thread))); |
2170 |
2170 |
2171 JvmtiEnvIterator it; |
2171 JvmtiEnvIterator it; |
2172 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { |
2172 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { |
2173 if (env->is_enabled(JVMTI_EVENT_COMPILED_METHOD_LOAD)) { |
2173 post_compiled_method_load(env, nm); |
2174 if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { |
2174 } |
2175 continue; |
2175 } |
2176 } |
|
2177 EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, |
|
2178 ("[%s] class compile method load event sent %s.%s ", |
|
2179 JvmtiTrace::safe_get_thread_name(thread), |
|
2180 (nm->method() == NULL) ? "NULL" : nm->method()->klass_name()->as_C_string(), |
|
2181 (nm->method() == NULL) ? "NULL" : nm->method()->name()->as_C_string())); |
|
2182 ResourceMark rm(thread); |
|
2183 HandleMark hm(thread); |
|
2184 |
|
2185 // Add inlining information |
|
2186 jvmtiCompiledMethodLoadInlineRecord* inlinerecord = create_inline_record(nm); |
|
2187 // Pass inlining information through the void pointer |
|
2188 JvmtiCompiledMethodLoadEventMark jem(thread, nm, inlinerecord); |
|
2189 JvmtiJavaThreadEventTransition jet(thread); |
|
2190 jvmtiEventCompiledMethodLoad callback = env->callbacks()->CompiledMethodLoad; |
|
2191 if (callback != NULL) { |
|
2192 (*callback)(env->jvmti_external(), jem.jni_methodID(), |
|
2193 jem.code_size(), jem.code_data(), jem.map_length(), |
|
2194 jem.map(), jem.compile_info()); |
|
2195 } |
|
2196 } |
|
2197 } |
|
2198 } |
|
2199 |
|
2200 |
2176 |
2201 // post a COMPILED_METHOD_LOAD event for a given environment |
2177 // post a COMPILED_METHOD_LOAD event for a given environment |
2202 void JvmtiExport::post_compiled_method_load(JvmtiEnv* env, const jmethodID method, const jint length, |
2178 void JvmtiExport::post_compiled_method_load(JvmtiEnv* env, nmethod *nm) { |
2203 const void *code_begin, const jint map_length, |
2179 if (env->phase() == JVMTI_PHASE_PRIMORDIAL || !env->is_enabled(JVMTI_EVENT_COMPILED_METHOD_LOAD)) { |
2204 const jvmtiAddrLocationMap* map) |
2180 return; |
2205 { |
2181 } |
2206 if (env->phase() <= JVMTI_PHASE_PRIMORDIAL) { |
2182 jvmtiEventCompiledMethodLoad callback = env->callbacks()->CompiledMethodLoad; |
|
2183 if (callback == NULL) { |
2207 return; |
2184 return; |
2208 } |
2185 } |
2209 JavaThread* thread = JavaThread::current(); |
2186 JavaThread* thread = JavaThread::current(); |
2210 EVT_TRIG_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, |
2187 |
2211 ("[%s] method compile load event triggered (by GenerateEvents)", |
2188 EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, |
2212 JvmtiTrace::safe_get_thread_name(thread))); |
2189 ("[%s] method compile load event sent %s.%s ", |
2213 if (env->is_enabled(JVMTI_EVENT_COMPILED_METHOD_LOAD)) { |
2190 JvmtiTrace::safe_get_thread_name(thread), |
2214 |
2191 (nm->method() == NULL) ? "NULL" : nm->method()->klass_name()->as_C_string(), |
2215 EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, |
2192 (nm->method() == NULL) ? "NULL" : nm->method()->name()->as_C_string())); |
2216 ("[%s] class compile method load event sent (by GenerateEvents), jmethodID=" PTR_FORMAT, |
2193 ResourceMark rm(thread); |
2217 JvmtiTrace::safe_get_thread_name(thread), p2i(method))); |
2194 HandleMark hm(thread); |
2218 |
2195 |
2219 JvmtiEventMark jem(thread); |
2196 // Add inlining information |
2220 JvmtiJavaThreadEventTransition jet(thread); |
2197 jvmtiCompiledMethodLoadInlineRecord* inlinerecord = create_inline_record(nm); |
2221 jvmtiEventCompiledMethodLoad callback = env->callbacks()->CompiledMethodLoad; |
2198 // Pass inlining information through the void pointer |
2222 if (callback != NULL) { |
2199 JvmtiCompiledMethodLoadEventMark jem(thread, nm, inlinerecord); |
2223 (*callback)(env->jvmti_external(), method, |
2200 JvmtiJavaThreadEventTransition jet(thread); |
2224 length, code_begin, map_length, |
2201 (*callback)(env->jvmti_external(), jem.jni_methodID(), |
2225 map, NULL); |
2202 jem.code_size(), jem.code_data(), jem.map_length(), |
2226 } |
2203 jem.map(), jem.compile_info()); |
2227 } |
|
2228 } |
2204 } |
2229 |
2205 |
2230 void JvmtiExport::post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) { |
2206 void JvmtiExport::post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) { |
2231 assert(name != NULL && name[0] != '\0', "sanity check"); |
2207 assert(name != NULL && name[0] != '\0', "sanity check"); |
2232 |
2208 |