1 /* 2 * Copyright (c) 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 * 23 */ 24 25 #ifndef SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP 26 #define SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP 27 28 #include "utilities/globalDefinitions.hpp" 29 30 // The (closed set) of concrete compiler classes. 31 enum CompilerType { 32 compiler_none, 33 compiler_c1, 34 compiler_c2, 35 compiler_jvmci, 36 compiler_shark, 37 compiler_number_of_types 38 }; 39 40 extern const char* compilertype2name_tab[compiler_number_of_types]; // Map CompilerType to its name 41 inline const char* compilertype2name(CompilerType t) { return (uint)t < compiler_number_of_types ? compilertype2name_tab[t] : NULL; } 42 43 // Handy constants for deciding which compiler mode to use. 44 enum MethodCompilation { 45 InvocationEntryBci = -1 // i.e., not a on-stack replacement compilation 46 }; 47 48 // Enumeration to distinguish tiers of compilation 49 enum CompLevel { 50 CompLevel_any = -2, 51 CompLevel_all = -2, 52 CompLevel_aot = -1, 53 CompLevel_none = 0, // Interpreter 54 CompLevel_simple = 1, // C1 55 CompLevel_limited_profile = 2, // C1, invocation & backedge counters 56 CompLevel_full_profile = 3, // C1, invocation & backedge counters + mdo 57 CompLevel_full_optimization = 4, // C2, Shark or JVMCI 58 59 #if defined(COMPILER2) || defined(SHARK) 60 CompLevel_highest_tier = CompLevel_full_optimization, // pure C2 and tiered or JVMCI and tiered 61 #elif defined(COMPILER1) 62 CompLevel_highest_tier = CompLevel_simple, // pure C1 or JVMCI 63 #else 64 CompLevel_highest_tier = CompLevel_none, 65 #endif 66 67 #if defined(TIERED) 68 CompLevel_initial_compile = CompLevel_full_profile // tiered 69 #elif defined(COMPILER1) || INCLUDE_JVMCI 70 CompLevel_initial_compile = CompLevel_simple // pure C1 or JVMCI 71 #elif defined(COMPILER2) || defined(SHARK) 72 CompLevel_initial_compile = CompLevel_full_optimization // pure C2 73 #else 74 CompLevel_initial_compile = CompLevel_none 75 #endif 76 }; 77 78 inline bool is_c1_compile(int comp_level) { 79 return comp_level > CompLevel_none && comp_level < CompLevel_full_optimization; 80 } 81 82 inline bool is_c2_compile(int comp_level) { 83 return comp_level == CompLevel_full_optimization; 84 } 85 86 inline bool is_highest_tier_compile(int comp_level) { 87 return comp_level == CompLevel_highest_tier; 88 } 89 90 inline bool is_compile(int comp_level) { 91 return is_c1_compile(comp_level) || is_c2_compile(comp_level); 92 } 93 94 // States of Restricted Transactional Memory usage. 95 enum RTMState { 96 NoRTM = 0x2, // Don't use RTM 97 UseRTM = 0x1, // Use RTM 98 ProfileRTM = 0x0 // Use RTM with abort ratio calculation 99 }; 100 101 #ifndef INCLUDE_RTM_OPT 102 #define INCLUDE_RTM_OPT 0 103 #endif 104 #if INCLUDE_RTM_OPT 105 #define RTM_OPT_ONLY(code) code 106 #else 107 #define RTM_OPT_ONLY(code) 108 #endif 109 110 #endif // SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP