Mercurial > hg > truffle
diff src/share/vm/graal/graalCompilerToVM.cpp @ 5318:b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
author | Christian Wimmer <Christian.Wimmer@Oracle.com> |
---|---|
date | Fri, 27 Apr 2012 12:56:39 -0700 |
parents | 290b3025b66f |
children | fc1943f18fef |
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompilerToVM.cpp Fri Apr 27 12:05:33 2012 -0700 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Fri Apr 27 12:56:39 2012 -0700 @@ -1111,6 +1111,30 @@ return JNIHandles::make_local(array); } +JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_decodePC(JNIEnv *, jobject, jlong pc) { + TRACE_graal_3("CompilerToVM::decodePC"); + + VM_ENTRY_MARK; + + stringStream(st); + CodeBlob* blob = CodeCache::find_blob_unsafe((void*) pc); + if (blob == NULL) { + st.print("[unidentified pc]"); + } else { + st.print(blob->name()); + + nmethod* nm = blob->as_nmethod_or_null(); + if (nm != NULL && nm->method() != NULL) { + st.print(" %s.", nm->method()->method_holder()->klass_part()->external_name()); + nm->method()->name()->print_symbol_on(&st); + st.print(" @ %d", pc - (jlong) nm->entry_point()); + } + } + Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); + return JNIHandles::make_local(result()); + +} + #define CC (char*) /*cast a literal from (const char*)*/ #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_##f)) @@ -1179,6 +1203,7 @@ {CC"executeCompiledMethodVarargs", CC"("HS_COMP_METHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, {CC"RiMethod_vtableEntryOffset", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_vtableEntryOffset)}, {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, + {CC"decodePC", CC"(J)"STRING, FN_PTR(decodePC)}, }; int CompilerToVM_methods_count() {