comparison src/share/vm/runtime/advancedThresholdPolicy.cpp @ 23404:3ef45d0a6d77

Remove jvmci VM configuration, and backport UseJVMCICompiler flag.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 24 May 2016 13:51:28 +0200
parents 24505bf61633
children
comparison
equal deleted inserted replaced
23403:5342deb9bf53 23404:3ef45d0a6d77
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "runtime/advancedThresholdPolicy.hpp" 26 #include "runtime/advancedThresholdPolicy.hpp"
27 #include "runtime/simpleThresholdPolicy.inline.hpp" 27 #include "runtime/simpleThresholdPolicy.inline.hpp"
28 #ifdef COMPILERJVMCI 28 #if INCLUDE_JVMCI
29 #include "jvmci/jvmciRuntime.hpp" 29 #include "jvmci/jvmciRuntime.hpp"
30 #endif 30 #endif
31 31
32 #ifdef TIERED 32 #ifdef TIERED
33 // Print an event. 33 // Print an event.
162 return false; 162 return false;
163 } 163 }
164 164
165 // Called with the queue locked and with at least one element 165 // Called with the queue locked and with at least one element
166 CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) { 166 CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) {
167 #ifdef COMPILERJVMCI
168 CompileTask *max_blocking_task = NULL; 167 CompileTask *max_blocking_task = NULL;
169 #endif
170 CompileTask *max_task = NULL; 168 CompileTask *max_task = NULL;
171 Method* max_method = NULL; 169 Method* max_method = NULL;
172 jlong t = os::javaTimeMillis(); 170 jlong t = os::javaTimeMillis();
173 // Iterate through the queue and find a method with a maximum rate. 171 // Iterate through the queue and find a method with a maximum rate.
174 for (CompileTask* task = compile_queue->first(); task != NULL;) { 172 for (CompileTask* task = compile_queue->first(); task != NULL;) {
195 if (compare_methods(method, max_method)) { 193 if (compare_methods(method, max_method)) {
196 max_task = task; 194 max_task = task;
197 max_method = method; 195 max_method = method;
198 } 196 }
199 } 197 }
200 #ifdef COMPILERJVMCI
201 if (task->is_blocking()) { 198 if (task->is_blocking()) {
202 if (max_blocking_task == NULL || compare_methods(method, max_blocking_task->method())) { 199 if (max_blocking_task == NULL || compare_methods(method, max_blocking_task->method())) {
203 max_blocking_task = task; 200 max_blocking_task = task;
204 } 201 }
205 } 202 }
206 #endif
207 task = next_task; 203 task = next_task;
208 } 204 }
209 205
210 #ifdef COMPILERJVMCI
211 if (max_blocking_task != NULL) { 206 if (max_blocking_task != NULL) {
212 // In blocking compilation mode, the CompileBroker will make 207 // In blocking compilation mode, the CompileBroker will make
213 // compilations submitted by a JVMCI compiler thread non-blocking. These 208 // compilations submitted by a JVMCI compiler thread non-blocking. These
214 // compilations should be scheduled after all blocking compilations 209 // compilations should be scheduled after all blocking compilations
215 // to service non-compiler related compilations sooner and reduce the 210 // to service non-compiler related compilations sooner and reduce the
216 // chance of such compilations timing out. 211 // chance of such compilations timing out.
217 max_task = max_blocking_task; 212 max_task = max_blocking_task;
218 max_method = max_task->method(); 213 max_method = max_task->method();
219 } 214 }
220 #endif
221 215
222 if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile 216 if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile
223 && is_method_profiled(max_method)) { 217 && is_method_profiled(max_method)) {
224 max_task->set_comp_level(CompLevel_limited_profile); 218 max_task->set_comp_level(CompLevel_limited_profile);
225 if (PrintTieredEvents) { 219 if (PrintTieredEvents) {
372 case CompLevel_none: 366 case CompLevel_none:
373 // If we were at full profile level, would we switch to full opt? 367 // If we were at full profile level, would we switch to full opt?
374 if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) { 368 if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) {
375 next_level = CompLevel_full_optimization; 369 next_level = CompLevel_full_optimization;
376 } else if ((this->*p)(i, b, cur_level)) { 370 } else if ((this->*p)(i, b, cur_level)) {
377 #ifdef COMPILERJVMCI 371 #if INCLUDE_JVMCI
378 // Since JVMCI takes a while to warm up, its queue inevitably backs up during 372 if (UseJVMCICompiler) {
379 // early VM execution. 373 // Since JVMCI takes a while to warm up, its queue inevitably backs up during
380 next_level = CompLevel_full_profile; 374 // early VM execution.
381 #else 375 next_level = CompLevel_full_profile;
376 break;
377 }
378 #endif
382 // C1-generated fully profiled code is about 30% slower than the limited profile 379 // C1-generated fully profiled code is about 30% slower than the limited profile
383 // code that has only invocation and backedge counters. The observation is that 380 // code that has only invocation and backedge counters. The observation is that
384 // if C2 queue is large enough we can spend too much time in the fully profiled code 381 // if C2 queue is large enough we can spend too much time in the fully profiled code
385 // while waiting for C2 to pick the method from the queue. To alleviate this problem 382 // while waiting for C2 to pick the method from the queue. To alleviate this problem
386 // we introduce a feedback on the C2 queue size. If the C2 queue is sufficiently long 383 // we introduce a feedback on the C2 queue size. If the C2 queue is sufficiently long
390 Tier3DelayOn * compiler_count(CompLevel_full_optimization)) { 387 Tier3DelayOn * compiler_count(CompLevel_full_optimization)) {
391 next_level = CompLevel_limited_profile; 388 next_level = CompLevel_limited_profile;
392 } else { 389 } else {
393 next_level = CompLevel_full_profile; 390 next_level = CompLevel_full_profile;
394 } 391 }
395 #endif
396 } 392 }
397 break; 393 break;
398 case CompLevel_limited_profile: 394 case CompLevel_limited_profile:
399 if (is_method_profiled(method)) { 395 if (is_method_profiled(method)) {
400 // Special case: we got here because this method was fully profiled in the interpreter. 396 // Special case: we got here because this method was fully profiled in the interpreter.
451 next_level = CompLevel_full_optimization; 447 next_level = CompLevel_full_optimization;
452 } 448 }
453 } else { 449 } else {
454 next_level = MAX2(osr_level, next_level); 450 next_level = MAX2(osr_level, next_level);
455 } 451 }
456 COMPILERJVMCI_PRESENT(next_level = JVMCIRuntime::adjust_comp_level(method, false, next_level, thread);) 452 #if INCLUDE_JVMCI
453 if (UseJVMCICompiler) {
454 next_level = JVMCIRuntime::adjust_comp_level(method, false, next_level, thread);
455 }
456 #endif
457 return next_level; 457 return next_level;
458 } 458 }
459 459
460 // Determine if we should do an OSR compilation of a given method. 460 // Determine if we should do an OSR compilation of a given method.
461 CompLevel AdvancedThresholdPolicy::loop_event(Method* method, CompLevel cur_level, JavaThread * thread) { 461 CompLevel AdvancedThresholdPolicy::loop_event(Method* method, CompLevel cur_level, JavaThread * thread) {
466 CompLevel osr_level = MIN2((CompLevel)method->highest_osr_comp_level(), next_level); 466 CompLevel osr_level = MIN2((CompLevel)method->highest_osr_comp_level(), next_level);
467 if (osr_level > CompLevel_none) { 467 if (osr_level > CompLevel_none) {
468 return osr_level; 468 return osr_level;
469 } 469 }
470 } 470 }
471 COMPILERJVMCI_PRESENT(next_level = JVMCIRuntime::adjust_comp_level(method, true, next_level, thread);) 471 #if INCLUDE_JVMCI
472 if (UseJVMCICompiler) {
473 next_level = JVMCIRuntime::adjust_comp_level(method, true, next_level, thread);
474 }
475 #endif
472 return next_level; 476 return next_level;
473 } 477 }
474 478
475 // Update the rate and submit compile 479 // Update the rate and submit compile
476 void AdvancedThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) { 480 void AdvancedThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {