| 1 | // Licensed to the .NET Foundation under one or more agreements. |
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | |
| 5 | ////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 6 | // |
| 7 | // NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE |
| 8 | // |
| 9 | // The JIT/EE interface is versioned. By "interface", we mean mean any and all communication between the |
| 10 | // JIT and the EE. Any time a change is made to the interface, the JIT/EE interface version identifier |
| 11 | // must be updated. See code:JITEEVersionIdentifier for more information. |
| 12 | // |
| 13 | // NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE |
| 14 | // |
| 15 | ////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 16 | |
| 17 | #ifndef _COR_JIT_FLAGS_H_ |
| 18 | #define _COR_JIT_FLAGS_H_ |
| 19 | |
| 20 | class CORJIT_FLAGS |
| 21 | { |
| 22 | public: |
| 23 | |
| 24 | enum CorJitFlag |
| 25 | { |
| 26 | CORJIT_FLAG_CALL_GETJITFLAGS = 0xffffffff, // Indicates that the JIT should retrieve flags in the form of a |
| 27 | // pointer to a CORJIT_FLAGS value via ICorJitInfo::getJitFlags(). |
| 28 | CORJIT_FLAG_SPEED_OPT = 0, |
| 29 | CORJIT_FLAG_SIZE_OPT = 1, |
| 30 | CORJIT_FLAG_DEBUG_CODE = 2, // generate "debuggable" code (no code-mangling optimizations) |
| 31 | CORJIT_FLAG_DEBUG_EnC = 3, // We are in Edit-n-Continue mode |
| 32 | CORJIT_FLAG_DEBUG_INFO = 4, // generate line and local-var info |
| 33 | CORJIT_FLAG_MIN_OPT = 5, // disable all jit optimizations (not necesarily debuggable code) |
| 34 | CORJIT_FLAG_GCPOLL_CALLS = 6, // Emit calls to JIT_POLLGC for thread suspension. |
| 35 | CORJIT_FLAG_MCJIT_BACKGROUND = 7, // Calling from multicore JIT background thread, do not call JitComplete |
| 36 | |
| 37 | #if defined(_TARGET_X86_) |
| 38 | |
| 39 | CORJIT_FLAG_PINVOKE_RESTORE_ESP = 8, // Restore ESP after returning from inlined PInvoke |
| 40 | CORJIT_FLAG_TARGET_P4 = 9, |
| 41 | CORJIT_FLAG_USE_FCOMI = 10, // Generated code may use fcomi(p) instruction |
| 42 | CORJIT_FLAG_USE_CMOV = 11, // Generated code may use cmov instruction |
| 43 | CORJIT_FLAG_USE_SSE2 = 12, // Generated code may use SSE-2 instructions |
| 44 | |
| 45 | #else // !defined(_TARGET_X86_) |
| 46 | |
| 47 | CORJIT_FLAG_UNUSED1 = 8, |
| 48 | CORJIT_FLAG_UNUSED2 = 9, |
| 49 | CORJIT_FLAG_UNUSED3 = 10, |
| 50 | CORJIT_FLAG_UNUSED4 = 11, |
| 51 | CORJIT_FLAG_UNUSED5 = 12, |
| 52 | |
| 53 | #endif // !defined(_TARGET_X86_) |
| 54 | |
| 55 | CORJIT_FLAG_UNUSED6 = 13, |
| 56 | |
| 57 | #if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) |
| 58 | |
| 59 | CORJIT_FLAG_USE_AVX = 14, |
| 60 | CORJIT_FLAG_USE_AVX2 = 15, |
| 61 | CORJIT_FLAG_USE_AVX_512 = 16, |
| 62 | |
| 63 | #else // !defined(_TARGET_X86_) && !defined(_TARGET_AMD64_) |
| 64 | |
| 65 | CORJIT_FLAG_UNUSED7 = 14, |
| 66 | CORJIT_FLAG_UNUSED8 = 15, |
| 67 | CORJIT_FLAG_UNUSED9 = 16, |
| 68 | |
| 69 | #endif // !defined(_TARGET_X86_) && !defined(_TARGET_AMD64_) |
| 70 | |
| 71 | #if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_) |
| 72 | CORJIT_FLAG_FEATURE_SIMD = 17, |
| 73 | #else |
| 74 | CORJIT_FLAG_UNUSED10 = 17, |
| 75 | #endif // !(defined(_TARGET_X86_) || defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)) |
| 76 | |
| 77 | CORJIT_FLAG_MAKEFINALCODE = 18, // Use the final code generator, i.e., not the interpreter. |
| 78 | CORJIT_FLAG_READYTORUN = 19, // Use version-resilient code generation |
| 79 | CORJIT_FLAG_PROF_ENTERLEAVE = 20, // Instrument prologues/epilogues |
| 80 | CORJIT_FLAG_PROF_REJIT_NOPS = 21, // Insert NOPs to ensure code is re-jitable |
| 81 | CORJIT_FLAG_PROF_NO_PINVOKE_INLINE = 22, // Disables PInvoke inlining |
| 82 | CORJIT_FLAG_SKIP_VERIFICATION = 23, // (lazy) skip verification - determined without doing a full resolve. See comment below |
| 83 | CORJIT_FLAG_PREJIT = 24, // jit or prejit is the execution engine. |
| 84 | CORJIT_FLAG_RELOC = 25, // Generate relocatable code |
| 85 | CORJIT_FLAG_IMPORT_ONLY = 26, // Only import the function |
| 86 | CORJIT_FLAG_IL_STUB = 27, // method is an IL stub |
| 87 | CORJIT_FLAG_PROCSPLIT = 28, // JIT should separate code into hot and cold sections |
| 88 | CORJIT_FLAG_BBINSTR = 29, // Collect basic block profile information |
| 89 | CORJIT_FLAG_BBOPT = 30, // Optimize method based on profile information |
| 90 | CORJIT_FLAG_FRAMED = 31, // All methods have an EBP frame |
| 91 | CORJIT_FLAG_ALIGN_LOOPS = 32, // add NOPs before loops to align them at 16 byte boundaries |
| 92 | CORJIT_FLAG_PUBLISH_SECRET_PARAM = 33, // JIT must place stub secret param into local 0. (used by IL stubs) |
| 93 | CORJIT_FLAG_GCPOLL_INLINE = 34, // JIT must inline calls to GCPoll when possible |
| 94 | CORJIT_FLAG_SAMPLING_JIT_BACKGROUND = 35, // JIT is being invoked as a result of stack sampling for hot methods in the background |
| 95 | CORJIT_FLAG_USE_PINVOKE_HELPERS = 36, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions |
| 96 | CORJIT_FLAG_REVERSE_PINVOKE = 37, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog |
| 97 | CORJIT_FLAG_DESKTOP_QUIRKS = 38, // The JIT should generate desktop-quirk-compatible code |
| 98 | CORJIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible |
| 99 | CORJIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code |
| 100 | |
| 101 | #if defined(_TARGET_ARM_) |
| 102 | CORJIT_FLAG_RELATIVE_CODE_RELOCS = 41, // JIT should generate PC-relative address computations instead of EE relocation records |
| 103 | #else // !defined(_TARGET_ARM_) |
| 104 | CORJIT_FLAG_UNUSED11 = 41, |
| 105 | #endif // !defined(_TARGET_ARM_) |
| 106 | |
| 107 | CORJIT_FLAG_NO_INLINING = 42, // JIT should not inline any called method into this method |
| 108 | |
| 109 | #if defined(_TARGET_ARM64_) |
| 110 | |
| 111 | CORJIT_FLAG_HAS_ARM64_AES = 43, // ID_AA64ISAR0_EL1.AES is 1 or better |
| 112 | CORJIT_FLAG_HAS_ARM64_ATOMICS = 44, // ID_AA64ISAR0_EL1.Atomic is 2 or better |
| 113 | CORJIT_FLAG_HAS_ARM64_CRC32 = 45, // ID_AA64ISAR0_EL1.CRC32 is 1 or better |
| 114 | CORJIT_FLAG_HAS_ARM64_DCPOP = 46, // ID_AA64ISAR1_EL1.DPB is 1 or better |
| 115 | CORJIT_FLAG_HAS_ARM64_DP = 47, // ID_AA64ISAR0_EL1.DP is 1 or better |
| 116 | CORJIT_FLAG_HAS_ARM64_FCMA = 48, // ID_AA64ISAR1_EL1.FCMA is 1 or better |
| 117 | CORJIT_FLAG_HAS_ARM64_FP = 49, // ID_AA64PFR0_EL1.FP is 0 or better |
| 118 | CORJIT_FLAG_HAS_ARM64_FP16 = 50, // ID_AA64PFR0_EL1.FP is 1 or better |
| 119 | CORJIT_FLAG_HAS_ARM64_JSCVT = 51, // ID_AA64ISAR1_EL1.JSCVT is 1 or better |
| 120 | CORJIT_FLAG_HAS_ARM64_LRCPC = 52, // ID_AA64ISAR1_EL1.LRCPC is 1 or better |
| 121 | CORJIT_FLAG_HAS_ARM64_PMULL = 53, // ID_AA64ISAR0_EL1.AES is 2 or better |
| 122 | CORJIT_FLAG_HAS_ARM64_SHA1 = 54, // ID_AA64ISAR0_EL1.SHA1 is 1 or better |
| 123 | CORJIT_FLAG_HAS_ARM64_SHA256 = 55, // ID_AA64ISAR0_EL1.SHA2 is 1 or better |
| 124 | CORJIT_FLAG_HAS_ARM64_SHA512 = 56, // ID_AA64ISAR0_EL1.SHA2 is 2 or better |
| 125 | CORJIT_FLAG_HAS_ARM64_SHA3 = 57, // ID_AA64ISAR0_EL1.SHA3 is 1 or better |
| 126 | CORJIT_FLAG_HAS_ARM64_SIMD = 58, // ID_AA64PFR0_EL1.AdvSIMD is 0 or better |
| 127 | CORJIT_FLAG_HAS_ARM64_SIMD_V81 = 59, // ID_AA64ISAR0_EL1.RDM is 1 or better |
| 128 | CORJIT_FLAG_HAS_ARM64_SIMD_FP16 = 60, // ID_AA64PFR0_EL1.AdvSIMD is 1 or better |
| 129 | CORJIT_FLAG_HAS_ARM64_SM3 = 61, // ID_AA64ISAR0_EL1.SM3 is 1 or better |
| 130 | CORJIT_FLAG_HAS_ARM64_SM4 = 62, // ID_AA64ISAR0_EL1.SM4 is 1 or better |
| 131 | CORJIT_FLAG_HAS_ARM64_SVE = 63 // ID_AA64PFR0_EL1.SVE is 1 or better |
| 132 | |
| 133 | #elif defined(_TARGET_X86_) || defined(_TARGET_AMD64_) |
| 134 | |
| 135 | CORJIT_FLAG_USE_SSE3 = 43, |
| 136 | CORJIT_FLAG_USE_SSSE3 = 44, |
| 137 | CORJIT_FLAG_USE_SSE41 = 45, |
| 138 | CORJIT_FLAG_USE_SSE42 = 46, |
| 139 | CORJIT_FLAG_USE_AES = 47, |
| 140 | CORJIT_FLAG_USE_BMI1 = 48, |
| 141 | CORJIT_FLAG_USE_BMI2 = 49, |
| 142 | CORJIT_FLAG_USE_FMA = 50, |
| 143 | CORJIT_FLAG_USE_LZCNT = 51, |
| 144 | CORJIT_FLAG_USE_PCLMULQDQ = 52, |
| 145 | CORJIT_FLAG_USE_POPCNT = 53, |
| 146 | CORJIT_FLAG_UNUSED23 = 54, |
| 147 | CORJIT_FLAG_UNUSED24 = 55, |
| 148 | CORJIT_FLAG_UNUSED25 = 56, |
| 149 | CORJIT_FLAG_UNUSED26 = 57, |
| 150 | CORJIT_FLAG_UNUSED27 = 58, |
| 151 | CORJIT_FLAG_UNUSED28 = 59, |
| 152 | CORJIT_FLAG_UNUSED29 = 60, |
| 153 | CORJIT_FLAG_UNUSED30 = 61, |
| 154 | CORJIT_FLAG_UNUSED31 = 62, |
| 155 | CORJIT_FLAG_UNUSED32 = 63 |
| 156 | |
| 157 | |
| 158 | #else // !defined(_TARGET_ARM64_) &&!defined(_TARGET_X86_) && !defined(_TARGET_AMD64_) |
| 159 | |
| 160 | CORJIT_FLAG_UNUSED12 = 43, |
| 161 | CORJIT_FLAG_UNUSED13 = 44, |
| 162 | CORJIT_FLAG_UNUSED14 = 45, |
| 163 | CORJIT_FLAG_UNUSED15 = 46, |
| 164 | CORJIT_FLAG_UNUSED16 = 47, |
| 165 | CORJIT_FLAG_UNUSED17 = 48, |
| 166 | CORJIT_FLAG_UNUSED18 = 49, |
| 167 | CORJIT_FLAG_UNUSED19 = 50, |
| 168 | CORJIT_FLAG_UNUSED20 = 51, |
| 169 | CORJIT_FLAG_UNUSED21 = 52, |
| 170 | CORJIT_FLAG_UNUSED22 = 53, |
| 171 | CORJIT_FLAG_UNUSED23 = 54, |
| 172 | CORJIT_FLAG_UNUSED24 = 55, |
| 173 | CORJIT_FLAG_UNUSED25 = 56, |
| 174 | CORJIT_FLAG_UNUSED26 = 57, |
| 175 | CORJIT_FLAG_UNUSED27 = 58, |
| 176 | CORJIT_FLAG_UNUSED28 = 59, |
| 177 | CORJIT_FLAG_UNUSED29 = 60, |
| 178 | CORJIT_FLAG_UNUSED30 = 61, |
| 179 | CORJIT_FLAG_UNUSED31 = 62, |
| 180 | CORJIT_FLAG_UNUSED32 = 63 |
| 181 | |
| 182 | #endif // !defined(_TARGET_ARM64_) &&!defined(_TARGET_X86_) && !defined(_TARGET_AMD64_) |
| 183 | }; |
| 184 | |
| 185 | CORJIT_FLAGS() |
| 186 | : corJitFlags(0) |
| 187 | { |
| 188 | // empty |
| 189 | } |
| 190 | |
| 191 | // Convenience constructor to set exactly one flag. |
| 192 | CORJIT_FLAGS(CorJitFlag flag) |
| 193 | : corJitFlags(0) |
| 194 | { |
| 195 | Set(flag); |
| 196 | } |
| 197 | |
| 198 | CORJIT_FLAGS(const CORJIT_FLAGS& other) |
| 199 | { |
| 200 | corJitFlags = other.corJitFlags; |
| 201 | } |
| 202 | |
| 203 | void Reset() |
| 204 | { |
| 205 | corJitFlags = 0; |
| 206 | } |
| 207 | |
| 208 | void Set(CorJitFlag flag) |
| 209 | { |
| 210 | corJitFlags |= 1ULL << (unsigned __int64)flag; |
| 211 | } |
| 212 | |
| 213 | void Clear(CorJitFlag flag) |
| 214 | { |
| 215 | corJitFlags &= ~(1ULL << (unsigned __int64)flag); |
| 216 | } |
| 217 | |
| 218 | bool IsSet(CorJitFlag flag) const |
| 219 | { |
| 220 | return (corJitFlags & (1ULL << (unsigned __int64)flag)) != 0; |
| 221 | } |
| 222 | |
| 223 | void Add(const CORJIT_FLAGS& other) |
| 224 | { |
| 225 | corJitFlags |= other.corJitFlags; |
| 226 | } |
| 227 | |
| 228 | void Remove(const CORJIT_FLAGS& other) |
| 229 | { |
| 230 | corJitFlags &= ~other.corJitFlags; |
| 231 | } |
| 232 | |
| 233 | bool IsEmpty() const |
| 234 | { |
| 235 | return corJitFlags == 0; |
| 236 | } |
| 237 | |
| 238 | // DO NOT USE THIS FUNCTION! (except in very restricted special cases) |
| 239 | unsigned __int64 GetFlagsRaw() |
| 240 | { |
| 241 | return corJitFlags; |
| 242 | } |
| 243 | |
| 244 | private: |
| 245 | |
| 246 | unsigned __int64 corJitFlags; |
| 247 | }; |
| 248 | |
| 249 | |
| 250 | #endif // _COR_JIT_FLAGS_H_ |
| 251 | |