diff src/cpu/x86/vm/templateInterpreter_x86_64.cpp @ 5176:af59b4dfc9e4

compilation queue changes: * new CiCompilationStatistics * added new HotSpot compilation policy (-XX:CompilationPolicyChoice=4) * compile queue prioritizing (-G:+PriorityCompileQueue) * low-priority compilation threads (-G:+SlowCompileThreads) * dynamic compilation thread priority adjustment (-G:+DynamicCompilePriority)
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 29 Mar 2012 18:43:30 +0200
parents f3d2447db2d9
children 120820e30baa
line wrap: on
line diff
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Mar 29 13:23:34 2012 +0200
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Mar 29 18:43:30 2012 +0200
@@ -36,6 +36,7 @@
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/compilationPolicy.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
@@ -286,6 +287,15 @@
 // Helpers for commoning out cases in the various type of method entries.
 //
 
+#ifdef GRAAL
+
+void graal_initialize_time(JavaThread* thread) {
+  frame fr = thread->last_frame();
+  assert(fr.is_interpreted_frame(), "must come from interpreter");
+  fr.interpreter_frame_method()->set_graal_invocation_time(os::javaTimeNanos());
+}
+
+#endif // GRAAL
 
 // increment invocation count & check for overflow
 //
@@ -330,9 +340,30 @@
       __ incrementl(Address(rbx,
                             methodOopDesc::interpreter_invocation_counter_offset()));
     }
+
+#ifdef GRAAL
+    if (CompilationPolicyChoice == 4) {
+      Label not_zero;
+      __ testl(rcx, InvocationCounter::count_mask_value);
+      __ jcc(Assembler::notZero, not_zero);
+
+      __ push(rcx);
+      __ call_VM(noreg, CAST_FROM_FN_PTR(address, graal_initialize_time), rdx, false);
+      __ set_method_data_pointer_for_bcp();
+      __ get_method(rbx);
+      __ pop(rcx);
+
+      __ testl(rcx, InvocationCounter::count_mask_value);
+      __ jcc(Assembler::zero, not_zero);
+      __ stop("unexpected counter value in rcx");
+
+      __ bind(not_zero);
+    }
+#endif // GRAAL
+
     // Update standard invocation counters
+
     __ movl(rax, backedge_counter);   // load backedge counter
-
     __ incrementl(rcx, InvocationCounter::count_increment);
     __ andl(rax, InvocationCounter::count_mask_value); // mask out the status bits