diff options
author | Bruce Forstall <brucefo@microsoft.com> | 2016-10-26 15:52:06 -0700 |
---|---|---|
committer | Bruce Forstall <brucefo@microsoft.com> | 2016-10-27 12:08:20 -0700 |
commit | e72536c32676b412cfead025b577d4e8c18d1c2f (patch) | |
tree | 41c0b6f18262cdacc29070e5fa880c6ba82c1081 /src/zap/zapimage.cpp | |
parent | 675622bb85f3c78de1967a78052d7280a2834611 (diff) | |
download | coreclr-e72536c32676b412cfead025b577d4e8c18d1c2f.tar.gz coreclr-e72536c32676b412cfead025b577d4e8c18d1c2f.tar.bz2 coreclr-e72536c32676b412cfead025b577d4e8c18d1c2f.zip |
Introduce new CORJIT_FLAGS type
The "JIT flags" currently passed between the EE and the JIT have traditionally
been bit flags in a 32-bit word. Recently, a second 32-bit word was added to
accommodate additional flags, but that set of flags is definitely "2nd class":
they are not universally passed, and require using a separate set of bit
definitions, and comparing those bits against the proper, 2nd word.
This change replaces all uses of bare DWORD or 'unsigned int' types
representing flags with CORJIT_FLAGS, which is now an opaque type. All
flag names were renamed from CORJIT_FLG_* to CORJIT_FLAG_* to ensure all
cases were changed to use the new names, which are also scoped within the
CORJIT_FLAGS type itself.
Another motivation to do this, besides cleaner code, is to allow enabling the
SSE/AVX flags for x86. For x86, we had fewer bits available in the "first
word", so would have to either put them in the "second word", which, as
stated, was very much 2nd class and not plumbed through many usages, or
we could move other bits to the "second word", with the same issues. Neither
was a good option.
RyuJIT compiles with both COR_JIT_EE_VERSION > 460 and <= 460. I introduced
a JitFlags adapter class in jitee.h to handle both JIT flag types. All JIT
code uses this JitFlags type, which operates identically to the new
CORJIT_FLAGS type.
In addition to introducing the new CORJIT_FLAGS type, the SSE/AVX flags are
enabled for x86.
The JIT-EE interface GUID is changed, as this is a breaking change.
Diffstat (limited to 'src/zap/zapimage.cpp')
-rw-r--r-- | src/zap/zapimage.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index 8f2bc78f5b..a6f80d2540 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -395,7 +395,7 @@ void ZapImage::AllocateVirtualSections() // // If we're instrumenting allocate a section for writing profile data // - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_BBINSTR) + if (m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_BBINSTR)) { m_pInstrumentSection = NewVirtualSection(pDataSection, IBCUnProfiledSection | ColdRange | InstrumentSection, sizeof(TADDR)); } @@ -1943,23 +1943,24 @@ struct CompileMethodStubContext //----------------------------------------------------------------------------- // static void __stdcall -void ZapImage::TryCompileMethodStub(LPVOID pContext, CORINFO_METHOD_HANDLE hStub, DWORD dwJitFlags) +void ZapImage::TryCompileMethodStub(LPVOID pContext, CORINFO_METHOD_HANDLE hStub, CORJIT_FLAGS jitFlags) { STANDARD_VM_CONTRACT; // The caller must always set the IL_STUB flag - _ASSERTE((dwJitFlags & CORJIT_FLG_IL_STUB) != 0); + _ASSERTE(jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB)); CompileMethodStubContext *pCompileContext = reinterpret_cast<CompileMethodStubContext *>(pContext); ZapImage *pImage = pCompileContext->pImage; - unsigned oldFlags = pImage->m_zapper->m_pOpt->m_compilerFlags; + CORJIT_FLAGS oldFlags = pImage->m_zapper->m_pOpt->m_compilerFlags; - pImage->m_zapper->m_pOpt->m_compilerFlags |= dwJitFlags; - pImage->m_zapper->m_pOpt->m_compilerFlags &= ~(CORJIT_FLG_PROF_ENTERLEAVE | - CORJIT_FLG_DEBUG_CODE | - CORJIT_FLG_DEBUG_EnC | - CORJIT_FLG_DEBUG_INFO); + CORJIT_FLAGS* pCompilerFlags = &pImage->m_zapper->m_pOpt->m_compilerFlags; + pCompilerFlags->Add(jitFlags); + pCompilerFlags->Clear(CORJIT_FLAGS::CORJIT_FLAG_PROF_ENTERLEAVE); + pCompilerFlags->Clear(CORJIT_FLAGS::CORJIT_FLAG_DEBUG_CODE); + pCompilerFlags->Clear(CORJIT_FLAGS::CORJIT_FLAG_DEBUG_EnC); + pCompilerFlags->Clear(CORJIT_FLAGS::CORJIT_FLAG_DEBUG_INFO); mdMethodDef md = mdMethodDefNil; @@ -2199,7 +2200,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h if (GetCompiledMethod(handle) != NULL) return ALREADY_COMPILED; - _ASSERTE((m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB) || IsNilToken(md) || handle == m_pPreloader->LookupMethodDef(md)); + _ASSERTE(m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB) || IsNilToken(md) || handle == m_pPreloader->LookupMethodDef(md)); CompileStatus result = NOT_COMPILED; @@ -2213,7 +2214,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h CORINFO_MODULE_HANDLE module; // We only compile IL_STUBs from the current assembly - 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)) module = m_hModule; else module = m_zapper->m_pEEJitInfo->getMethodModule(handle); @@ -2271,7 +2272,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h if (m_stats != NULL) { - if ((m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB) == 0) + if (!m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IL_STUB)) m_stats->m_failedMethods++; else m_stats->m_failedILStubs++; @@ -2504,7 +2505,7 @@ HRESULT ZapImage::LocateProfileData() // the final image. // #if 0 - if ((m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_BBINSTR) != 0) + if (m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_BBINSTR)) return S_FALSE; #endif @@ -3481,7 +3482,7 @@ bool ZapImage::canIntraModuleDirectCall( // No direct calls at all under some circumstances - if ((m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_PROF_ENTERLEAVE) + if (m_zapper->m_pOpt->m_compilerFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_PROF_ENTERLEAVE) && !m_pPreloader->IsDynamicMethod(callerFtn)) { *pReason = CORINFO_INDIRECT_CALL_PROFILING; |