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 = -1, 51 CompLevel_all = -1, 52 CompLevel_none = 0, // Interpreter 53 CompLevel_simple = 1, // C1 54 CompLevel_limited_profile = 2, // C1, invocation & backedge counters 55 CompLevel_full_profile = 3, // C1, invocation & backedge counters + mdo 56 CompLevel_full_optimization = 4, // C2, Shark or JVMCI 57 58 #if defined(COMPILER2) || defined(SHARK) 59 CompLevel_highest_tier = CompLevel_full_optimization, // pure C2 and tiered or JVMCI and tiered 60 #elif defined(COMPILER1) 61 CompLevel_highest_tier = CompLevel_simple, // pure C1 or JVMCI 62 #else 63 CompLevel_highest_tier = CompLevel_none, 64 #endif 65 66 #if defined(TIERED) 67 CompLevel_initial_compile = CompLevel_full_profile // tiered 68 #elif defined(COMPILER1) || INCLUDE_JVMCI 69 CompLevel_initial_compile = CompLevel_simple // pure C1 or JVMCI 70 #elif defined(COMPILER2) || defined(SHARK) 71 CompLevel_initial_compile = CompLevel_full_optimization // pure C2 72 #else 73 CompLevel_initial_compile = CompLevel_none 74 #endif 75 }; 76 77 inline bool is_c1_compile(int comp_level) { 78 return comp_level > CompLevel_none && comp_level < CompLevel_full_optimization; 79 } 80 81 inline bool is_c2_compile(int comp_level) { 82 return comp_level == CompLevel_full_optimization; 83 } 84 85 inline bool is_highest_tier_compile(int comp_level) { 86 return comp_level == CompLevel_highest_tier; 87 } 88 89 inline bool is_compile(int comp_level) { 90 return is_c1_compile(comp_level) || is_c2_compile(comp_level); 91 } 92 93 // States of Restricted Transactional Memory usage. 94 enum RTMState { 95 NoRTM = 0x2, // Don't use RTM 96 UseRTM = 0x1, // Use RTM 97 ProfileRTM = 0x0 // Use RTM with abort ratio calculation 98 }; 99 100 #ifndef INCLUDE_RTM_OPT 101 #define INCLUDE_RTM_OPT 0 102 #endif 103 #if INCLUDE_RTM_OPT 104 #define RTM_OPT_ONLY(code) code 105 #else 106 #define RTM_OPT_ONLY(code) 107 #endif 108 109 #endif // SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP