/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "code/nmethod.hpp"
#include "compiler/compileBroker.hpp"
#include "memory/allocation.hpp"
#include "runtime/vm_operations.hpp"
#include "utilities/growableArray.hpp"
// The CompilationPolicy selects which method (if any) should be compiled.
// It also decides which methods must always be compiled (i.e., are never
// interpreted).
class CompileTask;
class CompileQueue;
// Accumulated time
static bool _in_vm_startup;
public:
static void completed_vm_startup();
// m must be compiled before executing it
// m is allowed to be compiled
static bool is_compilation_enabled();
// Profiling
// Return initial compile level that is used with Xcomp
virtual CompLevel initial_compile_level() = 0;
// main notification entry, return a pointer to an nmethod if the OSR is required,
// returns NULL otherwise.
virtual nmethod* event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) = 0;
// safepoint() is called at the end of the safepoint
virtual void do_safepoint_work() = 0;
// reprofile request
// delay_compilation(method) can be called by any component of the runtime to notify the policy
// that it's recommended to delay the complation of this method.
// disable_compilation() is called whenever the runtime decides to disable compilation of the
// specified method.
// Select task is called by CompileBroker. The queue is guaranteed to have at least one
// element and is locked. The function should select one and return it.
// Tell the runtime if we think a given method is adequately profiled.
// Do policy initialization
virtual void initialize() = 0;
};
// A base class for baseline policies.
int _compiler_count;
protected:
public:
virtual void do_safepoint_work();
virtual void initialize();
virtual nmethod* event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
};
public:
};
// StackWalkCompPolicy - existing C2 policy
#ifdef COMPILER2
public:
private:
// the following variables hold values computed by the last inlining decision
// they are used for performance debugging only (print better messages)
// positive filter: should send be inlined? returns NULL (--> yes) or rejection msg
// negative filter: should send NOT be inlined? returns NULL (--> inline) or rejection msg
};
#endif
#endif // SHARE_VM_RUNTIME_COMPILATIONPOLICY_HPP