0N/A/*
0N/A * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
1472N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
1472N/A *
0N/A */
0N/A
0N/A#ifndef SHARE_VM_RUNTIME_SIMPLETHRESHOLDPOLICY_INLINE_HPP
0N/A#define SHARE_VM_RUNTIME_SIMPLETHRESHOLDPOLICY_INLINE_HPP
0N/A
0N/Atemplate<CompLevel level>
0N/Abool SimpleThresholdPolicy::call_predicate_helper(int i, int b, double scale) {
0N/A switch(level) {
0N/A case CompLevel_none:
0N/A case CompLevel_limited_profile:
0N/A return (i > Tier3InvocationThreshold * scale) ||
0N/A (i > Tier3MinInvocationThreshold * scale && i + b > Tier3CompileThreshold * scale);
0N/A case CompLevel_full_profile:
0N/A return (i > Tier4InvocationThreshold * scale) ||
0N/A (i > Tier4MinInvocationThreshold * scale && i + b > Tier4CompileThreshold * scale);
0N/A }
0N/A return true;
0N/A}
0N/A
0N/Atemplate<CompLevel level>
0N/Abool SimpleThresholdPolicy::loop_predicate_helper(int i, int b, double scale) {
0N/A switch(level) {
0N/A case CompLevel_none:
case CompLevel_limited_profile:
return b > Tier3BackEdgeThreshold * scale;
case CompLevel_full_profile:
return b > Tier4BackEdgeThreshold * scale;
}
return true;
}
// Simple methods are as good being compiled with C1 as C2.
// Determine if a given method is such a case.
bool SimpleThresholdPolicy::is_trivial(methodOop method) {
if (method->is_accessor()) return true;
if (method->code() != NULL) {
methodDataOop mdo = method->method_data();
if (mdo != NULL && mdo->num_loops() == 0 &&
(method->code_size() < 5 || (mdo->num_blocks() < 4) && (method->code_size() < 15))) {
return !mdo->would_profile();
}
}
return false;
}
#endif // SHARE_VM_RUNTIME_SIMPLETHRESHOLDPOLICY_INLINE_HPP