diff src/share/vm/graal/graalCompilerToVM.cpp @ 5129:51111665eda6

Support for recording a leaf graph id for each deoptimization point in the debug info.
author Lukas Stadler <lukas.stadler@jku.at>
date Wed, 21 Mar 2012 10:47:02 +0100
parents 5e9f38419819
children ab038e0d6b43
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Fri Mar 16 11:03:54 2012 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Wed Mar 21 10:47:02 2012 +0100
@@ -966,6 +966,21 @@
   return vtable_entry_offset;
 }
 
+// public native long[] getDeoptedLeafGraphIds();
+JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getDeoptedLeafGraphIds(JNIEnv *, jobject) {
+  TRACE_graal_3("CompilerToVM::getDeoptedLeafGraphIds");
+
+  VM_ENTRY_MARK;
+
+  // the contract for this method is as follows:
+  // returning null: no deopted leaf graphs
+  // returning array (size > 0): the ids of the deopted leaf graphs
+  // returning array (size == 0): there was an overflow, the compiler needs to clear its cache completely
+
+  oop array = GraalCompiler::instance()->dump_deopted_leaf_graphs(CHECK_NULL);
+  return JNIHandles::make_local(array);
+}
+
 
 #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))
@@ -1029,6 +1044,7 @@
   {CC"disassembleJava",                   CC"("RESOLVED_METHOD")"STRING,                        FN_PTR(disassembleJava)},
   {CC"executeCompiledMethod",             CC"("HS_COMP_METHOD OBJECT OBJECT OBJECT")"OBJECT,    FN_PTR(executeCompiledMethod)},
   {CC"RiMethod_vtableEntryOffset",        CC"("RESOLVED_METHOD")I",                             FN_PTR(RiMethod_vtableEntryOffset)},
+  {CC"getDeoptedLeafGraphIds",            CC"()[J",                                             FN_PTR(getDeoptedLeafGraphIds)},
 };
 
 int CompilerToVM_methods_count() {