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 *
363 next_level = CompLevel_full_profile;
364 }
365 break;
366 case CompLevel_limited_profile:
367 case CompLevel_full_profile:
368 {
369 MethodData* mdo = method->method_data();
370 if (mdo != NULL) {
371 if (mdo->would_profile()) {
372 int mdo_i = mdo->invocation_count_delta();
373 int mdo_b = mdo->backedge_count_delta();
374 if ((this->*p)(mdo_i, mdo_b, cur_level, method)) {
375 next_level = CompLevel_full_optimization;
376 }
377 } else {
378 next_level = CompLevel_full_optimization;
379 }
380 }
381 }
382 break;
383 }
384 }
385 return MIN2(next_level, (CompLevel)TieredStopAtLevel);
386 }
387
388 // Determine if a method should be compiled with a normal entry point at a different level.
389 CompLevel SimpleThresholdPolicy::call_event(Method* method, CompLevel cur_level, JavaThread* thread) {
390 CompLevel osr_level = MIN2((CompLevel) method->highest_osr_comp_level(),
391 common(&SimpleThresholdPolicy::loop_predicate, method, cur_level));
392 CompLevel next_level = common(&SimpleThresholdPolicy::call_predicate, method, cur_level);
393
394 // If OSR method level is greater than the regular method level, the levels should be
395 // equalized by raising the regular method level in order to avoid OSRs during each
396 // invocation of the method.
397 if (osr_level == CompLevel_full_optimization && cur_level == CompLevel_full_profile) {
398 MethodData* mdo = method->method_data();
399 guarantee(mdo != NULL, "MDO should not be NULL");
400 if (mdo->invocation_count() >= 1) {
401 next_level = CompLevel_full_optimization;
402 }
|
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 *
363 next_level = CompLevel_full_profile;
364 }
365 break;
366 case CompLevel_limited_profile:
367 case CompLevel_full_profile:
368 {
369 MethodData* mdo = method->method_data();
370 if (mdo != NULL) {
371 if (mdo->would_profile()) {
372 int mdo_i = mdo->invocation_count_delta();
373 int mdo_b = mdo->backedge_count_delta();
374 if ((this->*p)(mdo_i, mdo_b, cur_level, method)) {
375 next_level = CompLevel_full_optimization;
376 }
377 } else {
378 next_level = CompLevel_full_optimization;
379 }
380 }
381 }
382 break;
383 default:
384 break;
385 }
386 }
387 return MIN2(next_level, (CompLevel)TieredStopAtLevel);
388 }
389
390 // Determine if a method should be compiled with a normal entry point at a different level.
391 CompLevel SimpleThresholdPolicy::call_event(Method* method, CompLevel cur_level, JavaThread* thread) {
392 CompLevel osr_level = MIN2((CompLevel) method->highest_osr_comp_level(),
393 common(&SimpleThresholdPolicy::loop_predicate, method, cur_level));
394 CompLevel next_level = common(&SimpleThresholdPolicy::call_predicate, method, cur_level);
395
396 // If OSR method level is greater than the regular method level, the levels should be
397 // equalized by raising the regular method level in order to avoid OSRs during each
398 // invocation of the method.
399 if (osr_level == CompLevel_full_optimization && cur_level == CompLevel_full_profile) {
400 MethodData* mdo = method->method_data();
401 guarantee(mdo != NULL, "MDO should not be NULL");
402 if (mdo->invocation_count() >= 1) {
403 next_level = CompLevel_full_optimization;
404 }
|