diff options
Diffstat (limited to 'src/zap/zapinfo.cpp')
-rw-r--r-- | src/zap/zapinfo.cpp | 71 |
1 files changed, 37 insertions, 34 deletions
diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp index 232570f09d..d2362d4b90 100644 --- a/src/zap/zapinfo.cpp +++ b/src/zap/zapinfo.cpp @@ -141,13 +141,13 @@ void ZapInfo::InitMethodName() m_currentMethodName.AppendUTF8(szMethodName); } -int ZapInfo::ComputeJitFlags(CORINFO_METHOD_HANDLE handle) +CORJIT_FLAGS ZapInfo::ComputeJitFlags(CORINFO_METHOD_HANDLE handle) { - int jitFlags = m_zapper->m_pOpt->m_compilerFlags; + CORJIT_FLAGS jitFlags = m_zapper->m_pOpt->m_compilerFlags; - DWORD flags = 0; + CORJIT_FLAGS flags; IfFailThrow(m_pEECompileInfo->GetBaseJitFlags(handle, &flags)); - jitFlags |= flags; + jitFlags.Add(flags); // COMPlus_JitFramed specifies the default fpo setting for jitted and NGened code. // You can override the behavior for NGened code using COMPlus_NGenFramed. @@ -156,52 +156,56 @@ int ZapInfo::ComputeJitFlags(CORINFO_METHOD_HANDLE handle) if (dwNGenFramed == 0) { // NGened code should enable fpo - jitFlags &= ~CORJIT_FLG_FRAMED; + jitFlags.Clear(CORJIT_FLAGS::CORJIT_FLAG_FRAMED); } else if (dwNGenFramed == 1) { // NGened code should disable fpo - jitFlags |= CORJIT_FLG_FRAMED; + jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_FRAMED); } if (canSkipMethodVerification(m_currentMethodHandle) == CORINFO_VERIFICATION_CAN_SKIP) { - jitFlags |= CORJIT_FLG_SKIP_VERIFICATION; + jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_SKIP_VERIFICATION); } if (m_pImage->m_profileDataSections[MethodBlockCounts].pData && !m_zapper->m_pOpt->m_ignoreProfileData) { - jitFlags |= CORJIT_FLG_BBOPT; + jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_BBOPT); } // // By default we always enable Hot/Cold procedure splitting // - jitFlags |= CORJIT_FLG_PROCSPLIT; + jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_PROCSPLIT); if (m_zapper->m_pOpt->m_noProcedureSplitting) - jitFlags &= ~CORJIT_FLG_PROCSPLIT; + jitFlags.Clear(CORJIT_FLAGS::CORJIT_FLAG_PROCSPLIT); //never emit inlined polls for NGen'd code. The extra indirection is not optimal. - if (jitFlags & CORJIT_FLG_GCPOLL_INLINE) + if (jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_GCPOLL_INLINE)) { - jitFlags &= ~CORJIT_FLG_GCPOLL_INLINE; - jitFlags |= CORJIT_FLG_GCPOLL_CALLS; + jitFlags.Clear(CORJIT_FLAGS::CORJIT_FLAG_GCPOLL_INLINE); + jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_GCPOLL_CALLS); } // If the method is specified for min-opts then turn everything off - if (jitFlags & CORJIT_FLG_MIN_OPT) - jitFlags &= ~(CORJIT_FLG_BBINSTR | CORJIT_FLG_BBOPT | CORJIT_FLG_PROCSPLIT); + if (jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MIN_OPT)) + { + jitFlags.Clear(CORJIT_FLAGS::CORJIT_FLAG_BBINSTR); + jitFlags.Clear(CORJIT_FLAGS::CORJIT_FLAG_BBOPT); + jitFlags.Clear(CORJIT_FLAGS::CORJIT_FLAG_PROCSPLIT); + } // Rejit is now enabled by default for NGEN'ed code. This costs us // some size in exchange for diagnostic functionality, but we've got // further work planned that should mitigate the size increase. - jitFlags |= CORJIT_FLG_PROF_REJIT_NOPS; + jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_PROF_REJIT_NOPS); #ifdef FEATURE_READYTORUN_COMPILER if (IsReadyToRunCompilation()) - jitFlags |= CORJIT_FLG_READYTORUN; + jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_READYTORUN); #endif return jitFlags; @@ -427,14 +431,13 @@ void ZapInfo::CompileMethod() // this they can add the hint and reduce the perf cost at runtime. m_pImage->m_pPreloader->PrePrepareMethodIfNecessary(m_currentMethodHandle); - m_jitFlags = { 0 }; - m_jitFlags.corJitFlags = ComputeJitFlags(m_currentMethodHandle); + m_jitFlags = ComputeJitFlags(m_currentMethodHandle); #ifdef FEATURE_READYTORUN_COMPILER if (IsReadyToRunCompilation()) { // READYTORUN: FUTURE: Producedure spliting - m_jitFlags.corJitFlags &= ~CORJIT_FLG_PROCSPLIT; + m_jitFlags.Clear(CORJIT_FLAGS::CORJIT_FLAG_PROCSPLIT); DWORD methodAttribs = getMethodAttribs(m_currentMethodHandle); if (!(methodAttribs & CORINFO_FLG_NOSECURITYWRAP) || (methodAttribs & CORINFO_FLG_SECURITYCHECK)) @@ -445,13 +448,13 @@ void ZapInfo::CompileMethod() } #endif - if ((m_jitFlags.corJitFlags & CORJIT_FLG_SKIP_VERIFICATION) == 0) + if (!m_jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_SKIP_VERIFICATION)) { BOOL raiseVerificationException, unverifiableGenericCode; - m_jitFlags.corJitFlags = GetCompileFlagsIfGenericInstantiation( + m_jitFlags = GetCompileFlagsIfGenericInstantiation( m_currentMethodHandle, - (CorJitFlag)m_jitFlags.corJitFlags, + m_jitFlags, this, &raiseVerificationException, &unverifiableGenericCode); @@ -465,7 +468,7 @@ void ZapInfo::CompileMethod() #if !defined(FEATURE_CORECLR) // Ask the JIT to generate desktop-quirk-compatible code. - m_jitFlags.corJitFlags2 |= CORJIT_FLG2_DESKTOP_QUIRKS; + m_jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_DESKTOP_QUIRKS); #endif if (m_pImage->m_stats) @@ -486,7 +489,7 @@ void ZapInfo::CompileMethod() res = m_zapper->m_alternateJit->compileMethod( this, &m_currentMethodInfo, - CORJIT_FLG_CALL_GETJITFLAGS, + CORJIT_FLAGS::CORJIT_FLAG_CALL_GETJITFLAGS, &pCode, &cCode ); if (FAILED(res)) @@ -504,7 +507,7 @@ void ZapInfo::CompileMethod() ICorJitCompiler * pCompiler = m_zapper->m_pJitCompiler; res = pCompiler->compileMethod(this, &m_currentMethodInfo, - CORJIT_FLG_CALL_GETJITFLAGS, + CORJIT_FLAGS::CORJIT_FLAG_CALL_GETJITFLAGS, &pCode, &cCode); @@ -813,7 +816,7 @@ void ZapInfo::PublishCompiledMethod() // // For now, the only methods eligible for de-duplication are IL stubs // - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB) + if (m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB)) { ZapMethodHeader * pDuplicateMethod = m_pImage->m_CodeDeduplicator.Lookup(pMethod); if (pDuplicateMethod != NULL) @@ -830,7 +833,7 @@ void ZapInfo::PublishCompiledMethod() // Stubs that have no metadata token cannot be tracked by IBC data. if (m_currentMethodProfilingDataFlags & (1 << ReadMethodCode)) { - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB) + if (m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB)) m_pImage->m_PrioritizedGCInfo.Append(pMethod->m_pGCInfo); } @@ -888,7 +891,7 @@ HRESULT ZapInfo::allocBBProfileBuffer ( { HRESULT hr; - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB) + if (m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB)) { *ppBlock = NULL; return E_NOTIMPL; @@ -965,7 +968,7 @@ HRESULT ZapInfo::getBBProfileData ( // the profile data is in that module // @TODO: Fetch the profile data from the other module. if ((m_currentMethodModule != m_pImage->m_hModule) || - (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB)) + m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB)) { return E_FAIL; } @@ -1054,7 +1057,7 @@ void ZapInfo::allocMem( void ** roDataBlock /* OUT */ ) { - bool optForSize = ((m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_SIZE_OPT) == CORJIT_FLG_SIZE_OPT); + bool optForSize = m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_SIZE_OPT); UINT align = DEFAULT_CODE_ALIGN; @@ -1194,7 +1197,7 @@ void ZapInfo::setEHinfo(unsigned EHnumber, { ilClause->ClassToken = clause->ClassToken; - if ((m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB) && (clause->ClassToken != 0)) + if (m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB) && (clause->ClassToken != 0)) { // IL stub tokens are 'private' and do not resolve correctly in their parent module's metadata. @@ -2298,7 +2301,7 @@ unsigned ZapInfo::getClassDomainID (CORINFO_CLASS_HANDLE cls, void **ppIndirecti m_pImage->m_pPreloader->AddTypeToTransitiveClosureOfInstantiations(cls); - if(!(m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_DEBUG_CODE)) + if (!m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_DEBUG_CODE)) { if (isRIDClassDomainID(cls)) { @@ -3706,7 +3709,7 @@ CorInfoCanSkipVerificationResult ZapInfo::canSkipMethodVerification ( { // ILStubs are generated internally by the CLR. There is no need to // verify it, or any of its callees. - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB) + if (m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB)) return CORINFO_VERIFICATION_CAN_SKIP; CorInfoCanSkipVerificationResult canSkipVer = |