Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit e72536c

Browse files
committed
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.
1 parent 675622b commit e72536c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+906
-471
lines changed

src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@
5757
// When the EE loads the System.Numerics.Vectors assembly, it asks the JIT what length (in bytes) of
5858
// SIMD vector it supports as an intrinsic type. Zero means that the JIT does not support SIMD
5959
// intrinsics, so the EE should use the default size (i.e. the size of the IL implementation).
60+
#if COR_JIT_EE_VERSION > 460
61+
unsigned getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags); /* { return 0; } */
62+
#else
6063
unsigned getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags); /* { return 0; } */
64+
#endif
6165

6266
// IL obfuscators sometimes interpose on the EE-JIT interface. This function allows the VM to
6367
// tell the JIT to use a particular ICorJitCompiler to implement the methods of this interface,

src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@
653653
// in the code are. The native compiler will ensure that these places
654654
// have a corresponding break point in native code.
655655
//
656-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
656+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
657657
// be used only as a hint and the native compiler should not change its
658658
// code generation.
659659
void getBoundaries(
@@ -683,7 +683,7 @@
683683
// under debugging, the JIT needs to keep them live over their
684684
// entire scope so that they can be inspected.
685685
//
686-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
686+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
687687
// be used only as a hint and the native compiler should not change its
688688
// code generation.
689689
void getVars(

src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ void MethodContext::recCompileMethod(CORINFO_METHOD_INFO *info, unsigned flags)
744744
void MethodContext::dmpCompileMethod(DWORD key, const Agnostic_CompileMethod& value)
745745
{
746746
printf("CompiledMethod key %u, value ftn-%016llX scp-%016llX ilo-%u ils-%u ms-%u ehc-%u opt-%u rk-%u "
747-
"args{cc-%u rc-%016llX rts-%016llX rt-%u(%s) flg-%08X nA-%u cc-%u ci-%u mc-%u mi-%u arg-%016llX cb-%u pSig-%u scp-%016llX tok-%08X} "
747+
"args{cc-%u rc-%016llX rts-%016llX rt-%u(%s) flg-%08X nA-%u cc-%u ci-%u mc-%u mi-%u arg-%016llX cb-%u pSig-%u scp-%016llX tok-%08X} "
748748
"locals{cc-%u rc-%016llX rts-%016llX rt-%u(%s) flg-%08X nA-%u cc-%u ci-%u mc-%u mi-%u arg-%016llX cb-%u pSig-%u scp-%016llX tok-%08X} "
749749
"flg-%08X",
750750
key,
@@ -1098,8 +1098,8 @@ void MethodContext::recGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes, DW
10981098
}
10991099
void MethodContext::dmpGetJitFlags(DWORD key, DD value)
11001100
{
1101-
CORJIT_FLAGS *flags = (CORJIT_FLAGS*)GetJitFlags->GetBuffer(value.A);
1102-
printf("GetJitFlags key %u sizeInBytes-%u corJitFlags-%08X corJitFlags2-%08X", key, value.B, flags->corJitFlags, flags->corJitFlags2);
1101+
CORJIT_FLAGS *jitflags = (CORJIT_FLAGS*)GetJitFlags->GetBuffer(value.A);
1102+
printf("GetJitFlags key %u sizeInBytes-%u jitFlags-%016llX", key, value.B, jitflags->GetFlagsRaw());
11031103
GetJitFlags->Unlock();
11041104
}
11051105
DWORD MethodContext::repGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes)

src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void interceptor_ICJC::getVersionIdentifier(GUID* versionIdentifier /* OUT */)
109109
original_ICorJitCompiler->getVersionIdentifier(versionIdentifier);
110110
}
111111

112-
unsigned interceptor_ICJC::getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags)
112+
unsigned interceptor_ICJC::getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags)
113113
{
114114
return original_ICorJitCompiler->getMaxIntrinsicSIMDVectorLength(cpuCompileFlags);
115115
}

src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ bool interceptor_ICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
11731173
// in the code are. The native compiler will ensure that these places
11741174
// have a corresponding break point in native code.
11751175
//
1176-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
1176+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
11771177
// be used only as a hint and the native compiler should not change its
11781178
// code generation.
11791179
void interceptor_ICJI::getBoundaries(
@@ -1214,7 +1214,7 @@ void interceptor_ICJI::setBoundaries(
12141214
// under debugging, the JIT needs to keep them live over their
12151215
// entire scope so that they can be inspected.
12161216
//
1217-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
1217+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
12181218
// be used only as a hint and the native compiler should not change its
12191219
// code generation.
12201220
void interceptor_ICJI::getVars(

src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void interceptor_ICJC::getVersionIdentifier(GUID* versionIdentifier /* OUT */)
5555
original_ICorJitCompiler->getVersionIdentifier(versionIdentifier);
5656
}
5757

58-
unsigned interceptor_ICJC::getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags)
58+
unsigned interceptor_ICJC::getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags)
5959
{
6060
mcs->AddCall("getMaxIntrinsicSIMDVectorLength");
6161
return original_ICorJitCompiler->getMaxIntrinsicSIMDVectorLength(cpuCompileFlags);

src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ bool interceptor_ICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
961961
// in the code are. The native compiler will ensure that these places
962962
// have a corresponding break point in native code.
963963
//
964-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
964+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
965965
// be used only as a hint and the native compiler should not change its
966966
// code generation.
967967
void interceptor_ICJI::getBoundaries(
@@ -999,7 +999,7 @@ void interceptor_ICJI::setBoundaries(
999999
// under debugging, the JIT needs to keep them live over their
10001000
// entire scope so that they can be inspected.
10011001
//
1002-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
1002+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
10031003
// be used only as a hint and the native compiler should not change its
10041004
// code generation.
10051005
void interceptor_ICJI::getVars(

src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void interceptor_ICJC::getVersionIdentifier(GUID* versionIdentifier /* OUT */)
4848
original_ICorJitCompiler->getVersionIdentifier(versionIdentifier);
4949
}
5050

51-
unsigned interceptor_ICJC::getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags)
51+
unsigned interceptor_ICJC::getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags)
5252
{
5353
return original_ICorJitCompiler->getMaxIntrinsicSIMDVectorLength(cpuCompileFlags);
5454
}

src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ bool interceptor_ICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
876876
// in the code are. The native compiler will ensure that these places
877877
// have a corresponding break point in native code.
878878
//
879-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
879+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
880880
// be used only as a hint and the native compiler should not change its
881881
// code generation.
882882
void interceptor_ICJI::getBoundaries(
@@ -912,7 +912,7 @@ void interceptor_ICJI::setBoundaries(
912912
// under debugging, the JIT needs to keep them live over their
913913
// entire scope so that they can be inspected.
914914
//
915-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
915+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
916916
// be used only as a hint and the native compiler should not change its
917917
// code generation.
918918
void interceptor_ICJI::getVars(

src/ToolBox/superpmi/superpmi/icorjitinfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ bool MyICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
10181018
// in the code are. The native compiler will ensure that these places
10191019
// have a corresponding break point in native code.
10201020
//
1021-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
1021+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
10221022
// be used only as a hint and the native compiler should not change its
10231023
// code generation.
10241024
void MyICJI::getBoundaries(
@@ -1068,7 +1068,7 @@ void MyICJI::setBoundaries(
10681068
// under debugging, the JIT needs to keep them live over their
10691069
// entire scope so that they can be inspected.
10701070
//
1071-
// Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
1071+
// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
10721072
// be used only as a hint and the native compiler should not change its
10731073
// code generation.
10741074
void MyICJI::getVars(

0 commit comments

Comments
 (0)