1 /*
2 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
383 * e. 0 -> 4.
384 * This can happen if a method fails C1 compilation (it will still be profiled in the interpreter)
385 * or because of a deopt that didn't require reprofiling (compilation won't happen in this case because
386 * the compiled version already exists).
387 *
388 * Note that since state 0 can be reached from any other state via deoptimization different loops
389 * are possible.
390 *
391 */
392
393 // Common transition function. Given a predicate determines if a method should transition to another level.
394 CompLevel AdvancedThresholdPolicy::common(Predicate p, Method* method, CompLevel cur_level, bool disable_feedback) {
395 CompLevel next_level = cur_level;
396 int i = method->invocation_count();
397 int b = method->backedge_count();
398
399 if (is_trivial(method)) {
400 next_level = CompLevel_simple;
401 } else {
402 switch(cur_level) {
403 case CompLevel_aot: {
404 // If we were at full profile level, would we switch to full opt?
405 if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) {
406 next_level = CompLevel_full_optimization;
407 } else if (disable_feedback || (CompileBroker::queue_size(CompLevel_full_optimization) <=
408 Tier3DelayOff * compiler_count(CompLevel_full_optimization) &&
409 (this->*p)(i, b, cur_level, method))) {
410 next_level = CompLevel_full_profile;
411 }
412 }
413 break;
414 case CompLevel_none:
415 // If we were at full profile level, would we switch to full opt?
416 if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) {
417 next_level = CompLevel_full_optimization;
418 } else if ((this->*p)(i, b, cur_level, method)) {
419 #if INCLUDE_JVMCI
420 if (EnableJVMCI && UseJVMCICompiler) {
421 // Since JVMCI takes a while to warm up, its queue inevitably backs up during
422 // early VM execution. As of 2014-06-13, JVMCI's inliner assumes that the root
|
1 /*
2 * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
383 * e. 0 -> 4.
384 * This can happen if a method fails C1 compilation (it will still be profiled in the interpreter)
385 * or because of a deopt that didn't require reprofiling (compilation won't happen in this case because
386 * the compiled version already exists).
387 *
388 * Note that since state 0 can be reached from any other state via deoptimization different loops
389 * are possible.
390 *
391 */
392
393 // Common transition function. Given a predicate determines if a method should transition to another level.
394 CompLevel AdvancedThresholdPolicy::common(Predicate p, Method* method, CompLevel cur_level, bool disable_feedback) {
395 CompLevel next_level = cur_level;
396 int i = method->invocation_count();
397 int b = method->backedge_count();
398
399 if (is_trivial(method)) {
400 next_level = CompLevel_simple;
401 } else {
402 switch(cur_level) {
403 default: break;
404 case CompLevel_aot: {
405 // If we were at full profile level, would we switch to full opt?
406 if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) {
407 next_level = CompLevel_full_optimization;
408 } else if (disable_feedback || (CompileBroker::queue_size(CompLevel_full_optimization) <=
409 Tier3DelayOff * compiler_count(CompLevel_full_optimization) &&
410 (this->*p)(i, b, cur_level, method))) {
411 next_level = CompLevel_full_profile;
412 }
413 }
414 break;
415 case CompLevel_none:
416 // If we were at full profile level, would we switch to full opt?
417 if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) {
418 next_level = CompLevel_full_optimization;
419 } else if ((this->*p)(i, b, cur_level, method)) {
420 #if INCLUDE_JVMCI
421 if (EnableJVMCI && UseJVMCICompiler) {
422 // Since JVMCI takes a while to warm up, its queue inevitably backs up during
423 // early VM execution. As of 2014-06-13, JVMCI's inliner assumes that the root
|