Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/compiler/abstractCompiler.hpp
32285 views
/*1* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP25#define SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP2627#include "ci/compilerInterface.hpp"2829class AbstractCompiler : public CHeapObj<mtCompiler> {30private:31volatile int _num_compiler_threads;3233protected:34volatile int _compiler_state;35// Used for tracking global state of compiler runtime initialization36enum { uninitialized, initializing, initialized, failed, shut_down };3738// This method returns true for the first compiler thread that reaches that methods.39// This thread will initialize the compiler runtime.40bool should_perform_init();4142public:43AbstractCompiler() : _compiler_state(uninitialized), _num_compiler_threads(0) {}4445// This function determines the compiler thread that will perform the46// shutdown of the corresponding compiler runtime.47bool should_perform_shutdown();4849// Name of this compiler50virtual const char* name() = 0;5152// Missing feature tests53virtual bool supports_native() { return true; }54virtual bool supports_osr () { return true; }55virtual bool can_compile_method(methodHandle method) { return true; }56#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK))57virtual bool is_c1 () { return false; }58virtual bool is_c2 () { return false; }59virtual bool is_shark() { return false; }60#else61#ifdef COMPILER162bool is_c1 () { return true; }63bool is_c2 () { return false; }64bool is_shark() { return false; }65#endif // COMPILER166#ifdef COMPILER267bool is_c1 () { return false; }68bool is_c2 () { return true; }69bool is_shark() { return false; }70#endif // COMPILER271#ifdef SHARK72bool is_c1 () { return false; }73bool is_c2 () { return false; }74bool is_shark() { return true; }75#endif // SHARK76#endif // TIERED7778// Customization79virtual void initialize () = 0;8081void set_num_compiler_threads(int num) { _num_compiler_threads = num; }82int num_compiler_threads() { return _num_compiler_threads; }8384// Get/set state of compiler objects85bool is_initialized() { return _compiler_state == initialized; }86bool is_failed () { return _compiler_state == failed;}87void set_state (int state);88void set_shut_down () { set_state(shut_down); }89// Compilation entry point for methods90virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci) {91ShouldNotReachHere();92}939495// Print compilation timers and statistics96virtual void print_timers() {97ShouldNotReachHere();98}99};100101#endif // SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP102103104