95 |
95 |
96 // Returns true if m must be compiled before executing it |
96 // Returns true if m must be compiled before executing it |
97 // This is intended to force compiles for methods (usually for |
97 // This is intended to force compiles for methods (usually for |
98 // debugging) that would otherwise be interpreted for some reason. |
98 // debugging) that would otherwise be interpreted for some reason. |
99 bool CompilationPolicy::must_be_compiled(methodHandle m, int comp_level) { |
99 bool CompilationPolicy::must_be_compiled(methodHandle m, int comp_level) { |
|
100 // Don't allow Xcomp to cause compiles in replay mode |
|
101 if (ReplayCompiles) return false; |
|
102 |
100 if (m->has_compiled_code()) return false; // already compiled |
103 if (m->has_compiled_code()) return false; // already compiled |
101 if (!can_be_compiled(m, comp_level)) return false; |
104 if (!can_be_compiled(m, comp_level)) return false; |
102 |
105 |
103 return !UseInterpreter || // must compile all methods |
106 return !UseInterpreter || // must compile all methods |
104 (UseCompiler && AlwaysCompileLoopMethods && m->has_loops() && CompileBroker::should_compile_new_jobs()); // eagerly compile loop methods |
107 (UseCompiler && AlwaysCompileLoopMethods && m->has_loops() && CompileBroker::should_compile_new_jobs()); // eagerly compile loop methods |
320 if (bci != InvocationEntryBci) { |
323 if (bci != InvocationEntryBci) { |
321 reset_counter_for_back_branch_event(method); |
324 reset_counter_for_back_branch_event(method); |
322 return NULL; |
325 return NULL; |
323 } |
326 } |
324 } |
327 } |
|
328 if (CompileTheWorld || ReplayCompiles) { |
|
329 // Don't trigger other compiles in testing mode |
|
330 if (bci == InvocationEntryBci) { |
|
331 reset_counter_for_invocation_event(method); |
|
332 } else { |
|
333 reset_counter_for_back_branch_event(method); |
|
334 } |
|
335 return NULL; |
|
336 } |
|
337 |
325 if (bci == InvocationEntryBci) { |
338 if (bci == InvocationEntryBci) { |
326 // when code cache is full, compilation gets switched off, UseCompiler |
339 // when code cache is full, compilation gets switched off, UseCompiler |
327 // is set to false |
340 // is set to false |
328 if (!method->has_compiled_code() && UseCompiler) { |
341 if (!method->has_compiled_code() && UseCompiler) { |
329 method_invocation_event(method, thread); |
342 method_invocation_event(method, thread); |