Is there any way to start JIT manually besides java.lang.Compiler

I am trying to build a JIT strategy based on a method structure with profiling information (provided by the JVM), but I could not start the JIT manually. In this documentation, I can run JIT by calling java.lang.Compiler.compileClass() , but the method returns false every time, and the property that java.lang.Compiler checks (java.compiler) every time I run JVM. I tried OpenJDK and Oracle JVM 1.7, both results are the same.

However, when I observe compilation statistics with

 $ jstat -printcompilation <PID> 

I see that JIT is successfully compiling some method that matches the conditions.

If any method exists, I rather run it from java code. I tried to find the hotspot VM code , but I could not find the class and method in which the decision was made, and the launch of JIT.

Edit: After looking more, I found that compilationPolicy.cpp bu still could not find the exact location depending on the solution on. I would like something like (just thinking)

 if(hot_count > Threshold){ compile_method(methodHandle); } 

but instead found it,

 void SimpleCompPolicy::method_invocation_event(methodHandle m, JavaThread* thread) { const int comp_level = CompLevel_highest_tier; const int hot_count = m->invocation_count(); reset_counter_for_invocation_event(m); const char* comment = "count"; if (is_compilation_enabled() && can_be_compiled(m)) { nmethod* nm = m->code(); if (nm == NULL ) { // [MY COMMENT] no check being done on hot_count in here or callee methods CompileBroker::compile_method(m, InvocationEntryBci, comp_level, m, hot_count, comment, thread); } } } 

As for tracking my own JVM code, I am deleting my main theme. We are looking for a simple solution for use in the java side of the code .

+7
java compiler-optimization jvm-hotspot
source share
1 answer

It looks like you want something similar to a compiler control function ( http://openjdk.java.net/jeps/165 ).

Unfortunately, it does not exist yet, although it should currently be part of Java 9.

+2
source share

All Articles