Tue, 29 Aug 2017 15:31:19 +0800
#6062 The disassembler is implemented by hsdis instead of disassembler_mips.cpp.
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@0 | 25 | #ifndef SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP |
aoqi@0 | 26 | #define SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP |
aoqi@0 | 27 | |
aoqi@0 | 28 | #include "ci/compilerInterface.hpp" |
aoqi@0 | 29 | |
aoqi@0 | 30 | class AbstractCompiler : public CHeapObj<mtCompiler> { |
aoqi@0 | 31 | private: |
aoqi@0 | 32 | volatile int _num_compiler_threads; |
aoqi@0 | 33 | |
aoqi@0 | 34 | protected: |
aoqi@0 | 35 | volatile int _compiler_state; |
aoqi@0 | 36 | // Used for tracking global state of compiler runtime initialization |
aoqi@0 | 37 | enum { uninitialized, initializing, initialized, failed, shut_down }; |
aoqi@0 | 38 | |
aoqi@0 | 39 | // This method returns true for the first compiler thread that reaches that methods. |
aoqi@0 | 40 | // This thread will initialize the compiler runtime. |
aoqi@0 | 41 | bool should_perform_init(); |
aoqi@0 | 42 | |
aoqi@0 | 43 | public: |
aoqi@0 | 44 | AbstractCompiler() : _compiler_state(uninitialized), _num_compiler_threads(0) {} |
aoqi@0 | 45 | |
aoqi@0 | 46 | // This function determines the compiler thread that will perform the |
aoqi@0 | 47 | // shutdown of the corresponding compiler runtime. |
aoqi@0 | 48 | bool should_perform_shutdown(); |
aoqi@0 | 49 | |
aoqi@0 | 50 | // Name of this compiler |
aoqi@0 | 51 | virtual const char* name() = 0; |
aoqi@0 | 52 | |
aoqi@0 | 53 | // Missing feature tests |
aoqi@0 | 54 | virtual bool supports_native() { return true; } |
aoqi@0 | 55 | virtual bool supports_osr () { return true; } |
aoqi@0 | 56 | virtual bool can_compile_method(methodHandle method) { return true; } |
aoqi@0 | 57 | #if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)) |
aoqi@0 | 58 | virtual bool is_c1 () { return false; } |
aoqi@0 | 59 | virtual bool is_c2 () { return false; } |
aoqi@0 | 60 | virtual bool is_shark() { return false; } |
aoqi@0 | 61 | #else |
aoqi@0 | 62 | #ifdef COMPILER1 |
aoqi@0 | 63 | bool is_c1 () { return true; } |
aoqi@0 | 64 | bool is_c2 () { return false; } |
aoqi@0 | 65 | bool is_shark() { return false; } |
aoqi@0 | 66 | #endif // COMPILER1 |
aoqi@0 | 67 | #ifdef COMPILER2 |
aoqi@0 | 68 | bool is_c1 () { return false; } |
aoqi@0 | 69 | bool is_c2 () { return true; } |
aoqi@0 | 70 | bool is_shark() { return false; } |
aoqi@0 | 71 | #endif // COMPILER2 |
aoqi@0 | 72 | #ifdef SHARK |
aoqi@0 | 73 | bool is_c1 () { return false; } |
aoqi@0 | 74 | bool is_c2 () { return false; } |
aoqi@0 | 75 | bool is_shark() { return true; } |
aoqi@0 | 76 | #endif // SHARK |
aoqi@0 | 77 | #endif // TIERED |
aoqi@0 | 78 | |
aoqi@0 | 79 | // Customization |
aoqi@0 | 80 | virtual void initialize () = 0; |
aoqi@0 | 81 | |
aoqi@0 | 82 | void set_num_compiler_threads(int num) { _num_compiler_threads = num; } |
aoqi@0 | 83 | int num_compiler_threads() { return _num_compiler_threads; } |
aoqi@0 | 84 | |
aoqi@0 | 85 | // Get/set state of compiler objects |
aoqi@0 | 86 | bool is_initialized() { return _compiler_state == initialized; } |
aoqi@0 | 87 | bool is_failed () { return _compiler_state == failed;} |
aoqi@0 | 88 | void set_state (int state); |
aoqi@0 | 89 | void set_shut_down () { set_state(shut_down); } |
aoqi@0 | 90 | // Compilation entry point for methods |
aoqi@0 | 91 | virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci) { |
aoqi@0 | 92 | ShouldNotReachHere(); |
aoqi@0 | 93 | } |
aoqi@0 | 94 | |
aoqi@0 | 95 | |
aoqi@0 | 96 | // Print compilation timers and statistics |
aoqi@0 | 97 | virtual void print_timers() { |
aoqi@0 | 98 | ShouldNotReachHere(); |
aoqi@0 | 99 | } |
aoqi@0 | 100 | }; |
aoqi@0 | 101 | |
aoqi@0 | 102 | #endif // SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP |