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_number_of_types 37 }; 38 39 extern const char* compilertype2name_tab[compiler_number_of_types]; // Map CompilerType to its name 40 inline const char* compilertype2name(CompilerType t) { return (uint)t < compiler_number_of_types ? compilertype2name_tab[t] : NULL; } 41 42 // Handy constants for deciding which compiler mode to use. 43 enum MethodCompilation { 44 InvocationEntryBci = -1 // i.e., not a on-stack replacement compilation 45 }; 46 47 // Enumeration to distinguish tiers of compilation 48 enum CompLevel { 49 CompLevel_any = -2, 50 CompLevel_all = -2, 51 CompLevel_aot = -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 or JVMCI 57 }; 58 59 extern CompLevel CompLevel_highest_tier; 60 extern CompLevel CompLevel_initial_compile; 61 62 enum CompMode { 63 CompMode_none = 0, 64 CompMode_client = 1, 65 CompMode_server = 2 66 }; 67 68 extern CompMode Compilation_mode; 69 70 inline bool is_server_compilation_mode_vm() { 71 return Compilation_mode == CompMode_server; 72 } 73 74 inline bool is_client_compilation_mode_vm() { 75 return Compilation_mode == CompMode_client; 76 } 77 78 extern void set_client_compilation_mode(); 79 80 inline bool is_c1_compile(int comp_level) { 81 return comp_level > CompLevel_none && comp_level < CompLevel_full_optimization; 82 } 83 84 inline bool is_c2_compile(int comp_level) { 85 return comp_level == CompLevel_full_optimization; 86 } 87 88 inline bool is_highest_tier_compile(int comp_level) { 89 return comp_level == CompLevel_highest_tier; 90 } 91 92 inline bool is_compile(int comp_level) { 93 return is_c1_compile(comp_level) || is_c2_compile(comp_level); 94 } 95 96 // States of Restricted Transactional Memory usage. 97 enum RTMState { 98 NoRTM = 0x2, // Don't use RTM 99 UseRTM = 0x1, // Use RTM 100 ProfileRTM = 0x0 // Use RTM with abort ratio calculation 101 }; 102 103 #ifndef INCLUDE_RTM_OPT 104 #define INCLUDE_RTM_OPT 0 105 #endif 106 #if INCLUDE_RTM_OPT 107 #define RTM_OPT_ONLY(code) code 108 #else 109 #define RTM_OPT_ONLY(code) 110 #endif 111 112 #endif // SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP