diff src/share/vm/graal/graalCompilerToVM.cpp @ 8611:6c4db417385a

added API to reset the profiling information for a method added some test cases that check the recorded profiling information
author Christian Haeubl <haeubl@ssw.jku.at>
date Wed, 27 Mar 2013 17:25:59 +0100
parents 2ffd472c5d25
children cd9e8dd9f488
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Wed Mar 27 10:36:57 2013 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Wed Mar 27 17:25:59 2013 +0100
@@ -1007,6 +1007,28 @@
 
 C2V_END
 
+
+C2V_VMENTRY(void, reprofile, (JNIEnv *env, jobject, jlong metaspace_method))
+  Method* method = asMethod(metaspace_method);
+  method->reset_counters();
+
+  nmethod* code = method->code();
+  if (code != NULL) {
+    code->make_not_entrant();
+  }
+
+  MethodData* method_data = method->method_data();
+  if (method_data == NULL) {
+    ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
+    method_data = MethodData::allocate(loader_data, method, CHECK);
+    method->set_method_data(method_data);
+  } else {
+    method_data->initialize();
+  }
+C2V_END
+
+
+
 #define CC (char*)  /*cast a literal from (const char*)*/
 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
 
@@ -1080,6 +1102,7 @@
   {CC"getLineNumberTable",            CC"("HS_RESOLVED_METHOD")[J",                                     FN_PTR(getLineNumberTable)},
   {CC"getLocalVariableTable",         CC"("HS_RESOLVED_METHOD")["LOCAL,                                 FN_PTR(getLocalVariableTable)},
   {CC"getFileName",                   CC"("HS_RESOLVED_JAVA_TYPE")"STRING,                              FN_PTR(getFileName)},
+  {CC"reprofile",                     CC"("METASPACE_METHOD")V",                                        FN_PTR(reprofile)},
 };
 
 int CompilerToVM_methods_count() {