Skip to content

Commit c3fa765

Browse files
authored
Delete IL verifier support in the VM (#66616)
Contributes to #32648
1 parent fa1f283 commit c3fa765

File tree

2 files changed

+14
-95
lines changed

2 files changed

+14
-95
lines changed

src/coreclr/vm/jitinterface.cpp

Lines changed: 11 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,13 +2365,6 @@ CORINFO_METHOD_HANDLE CEEInfo::GetDelegateCtor(
23652365
MODE_PREEMPTIVE;
23662366
} CONTRACTL_END;
23672367

2368-
if (isVerifyOnly())
2369-
{
2370-
// No sense going through the optimized case just for verification and it can cause issues parsing
2371-
// uninstantiated generic signatures.
2372-
return methHnd;
2373-
}
2374-
23752368
CORINFO_METHOD_HANDLE result = NULL;
23762369

23772370
JIT_TO_EE_TRANSITION();
@@ -2697,9 +2690,6 @@ void CEEInfo::ScanToken(Module * pModule, CORINFO_RESOLVED_TOKEN * pResolvedToke
26972690
if (pModule->IsSystem())
26982691
return;
26992692

2700-
if (isVerifyOnly())
2701-
return;
2702-
27032693
//
27042694
// Scan method instantiation
27052695
//
@@ -2884,10 +2874,6 @@ void CEEInfo::ComputeRuntimeLookupForSharedGenericToken(DictionaryEntryKind entr
28842874
PRECONDITION(CheckPointer(pResultLookup));
28852875
} CONTRACTL_END;
28862876

2887-
2888-
// We should never get here when we are only verifying
2889-
_ASSERTE(!isVerifyOnly());
2890-
28912877
pResultLookup->lookupKind.needsRuntimeLookup = true;
28922878
pResultLookup->lookupKind.runtimeLookupFlags = 0;
28932879

@@ -3691,13 +3677,6 @@ CorInfoInitClassResult CEEInfo::initClass(
36913677
JIT_TO_EE_TRANSITION();
36923678
{
36933679

3694-
// Do not bother figuring out the initialization if we are only verifying the method.
3695-
if (isVerifyOnly())
3696-
{
3697-
result = CORINFO_INITCLASS_NOT_REQUIRED;
3698-
goto exit;
3699-
}
3700-
37013680
FieldDesc * pFD = (FieldDesc *)field;
37023681
_ASSERTE(pFD == NULL || pFD->IsStatic());
37033682

@@ -5173,7 +5152,7 @@ void CEEInfo::getCallInfo(
51735152
{
51745153
BYTE * indcell = NULL;
51755154

5176-
if (!(flags & CORINFO_CALLINFO_KINDONLY) && !isVerifyOnly())
5155+
if (!(flags & CORINFO_CALLINFO_KINDONLY))
51775156
{
51785157
// We shouldn't be using GetLoaderAllocator here because for LCG, we need to get the
51795158
// VirtualCallStubManager from where the stub will be used.
@@ -5826,9 +5805,6 @@ CorInfoHelpFunc CEEInfo::getCastingHelper(CORINFO_RESOLVED_TOKEN * pResolvedToke
58265805
MODE_PREEMPTIVE;
58275806
} CONTRACTL_END;
58285807

5829-
if (isVerifyOnly())
5830-
return fThrowing ? CORINFO_HELP_CHKCASTANY : CORINFO_HELP_ISINSTANCEOFANY;
5831-
58325808
CorInfoHelpFunc result = CORINFO_HELP_UNDEF;
58335809

58345810
JIT_TO_EE_TRANSITION();
@@ -9455,7 +9431,7 @@ CorInfoTypeWithMod CEEInfo::getArgType (
94559431

94569432
case ELEMENT_TYPE_PTR:
94579433
// Load the type eagerly under debugger to make the eval work
9458-
if (!isVerifyOnly() && CORDisableJITOptimizations(pModule->GetDebuggerInfoBits()))
9434+
if (CORDisableJITOptimizations(pModule->GetDebuggerInfoBits()))
94599435
{
94609436
// NOTE: in some IJW cases, when the type pointed at is unmanaged,
94619437
// the GetTypeHandle may fail, because there is no TypeDef for such type.
@@ -12108,12 +12084,6 @@ void* CEEJitInfo::getFieldAddress(CORINFO_FIELD_HANDLE fieldHnd,
1210812084
if (ppIndirection != NULL)
1210912085
*ppIndirection = NULL;
1211012086

12111-
// Do not bother with initialization if we are only verifying the method.
12112-
if (isVerifyOnly())
12113-
{
12114-
return (void *)0x10;
12115-
}
12116-
1211712087
JIT_TO_EE_TRANSITION();
1211812088

1211912089
FieldDesc* field = (FieldDesc*) fieldHnd;
@@ -12164,12 +12134,6 @@ CORINFO_CLASS_HANDLE CEEJitInfo::getStaticFieldCurrentClass(CORINFO_FIELD_HANDLE
1216412134
*pIsSpeculative = true;
1216512135
}
1216612136

12167-
// Only examine the field's value if we are producing jitted code.
12168-
if (isVerifyOnly())
12169-
{
12170-
return result;
12171-
}
12172-
1217312137
JIT_TO_EE_TRANSITION();
1217412138

1217512139
FieldDesc* field = (FieldDesc*) fieldHnd;
@@ -12752,7 +12716,6 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
1275212716
// If we're doing an "import_only" compilation, it's for verification, so don't interpret.
1275312717
// (We assume that importation is completely architecture-independent, or at least nearly so.)
1275412718
if (FAILED(ret) &&
12755-
!jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) &&
1275612719
(forceInterpreter || !jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MAKEFINALCODE)))
1275712720
{
1275812721
if (SUCCEEDED(ret = Interpreter::GenerateInterpreterStub(comp, info, nativeEntry, nativeSizeOfCode)))
@@ -12777,7 +12740,6 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
1277712740
// If we're doing an "import_only" compilation, it's for verification, so don't interpret.
1277812741
// (We assume that importation is completely architecture-independent, or at least nearly so.)
1277912742
if (FAILED(ret) &&
12780-
!jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) &&
1278112743
(forceInterpreter || !jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MAKEFINALCODE)))
1278212744
{
1278312745
if (SUCCEEDED(ret = Interpreter::GenerateInterpreterStub(comp, info, nativeEntry, nativeSizeOfCode)))
@@ -12802,7 +12764,7 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
1280212764
// If the JIT fails we keep the IL around and will
1280312765
// try reJIT the same IL. VSW 525059
1280412766
//
12805-
if (SUCCEEDED(ret) && !jitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) && !((CEEJitInfo*)comp)->JitAgain())
12767+
if (SUCCEEDED(ret) && !((CEEJitInfo*)comp)->JitAgain())
1280612768
{
1280712769
((CEEJitInfo*)comp)->CompressDebugInfo();
1280812770

@@ -12962,14 +12924,6 @@ CORJIT_FLAGS GetDebuggerCompileFlags(Module* pModule, CORJIT_FLAGS flags)
1296212924
flags.Set(CORJIT_FLAGS::CORJIT_FLAG_DEBUG_CODE);
1296312925
}
1296412926

12965-
if (flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY))
12966-
{
12967-
// If we are only verifying the method, dont need any debug info and this
12968-
// prevents getVars()/getBoundaries() from being called unnecessarily.
12969-
flags.Clear(CORJIT_FLAGS::CORJIT_FLAG_DEBUG_INFO);
12970-
flags.Clear(CORJIT_FLAGS::CORJIT_FLAG_DEBUG_CODE);
12971-
}
12972-
1297312927
return flags;
1297412928
}
1297512929

@@ -12987,10 +12941,7 @@ CORJIT_FLAGS GetCompileFlags(MethodDesc * ftn, CORJIT_FLAGS flags, CORINFO_METHO
1298712941
//
1298812942
// Get CPU specific flags
1298912943
//
12990-
if (!flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY))
12991-
{
12992-
flags.Add(ExecutionManager::GetEEJitManager()->GetCPUCompileFlags());
12993-
}
12944+
flags.Add(ExecutionManager::GetEEJitManager()->GetCPUCompileFlags());
1299412945

1299512946
//
1299612947
// Find the debugger and profiler related flags
@@ -13215,12 +13166,8 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config,
1321513166

1321613167
getMethodInfoHelper(ftn, ftnHnd, ILHeader, &methodInfo);
1321713168

13218-
// If it's generic then we can only enter through an instantiated md (unless we're just verifying it)
13219-
_ASSERTE(flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) || !ftn->IsGenericMethodDefinition());
13220-
13221-
// If it's an instance method then it must not be entered from a generic class
13222-
_ASSERTE(flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) || ftn->IsStatic() ||
13223-
ftn->GetNumGenericClassArgs() == 0 || ftn->HasClassInstantiation());
13169+
// If it's generic then we can only enter through an instantiated md
13170+
_ASSERTE(!ftn->IsGenericMethodDefinition());
1322413171

1322513172
// method attributes and signature are consistant
1322613173
_ASSERTE(!!ftn->IsStatic() == ((methodInfo.args.callConv & CORINFO_CALLCONV_HASTHIS) == 0));
@@ -13257,8 +13204,7 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config,
1325713204

1325813205
for (;;)
1325913206
{
13260-
CEEJitInfo jitInfo(ftn, ILHeader, jitMgr, flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY),
13261-
!flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_NO_INLINING));
13207+
CEEJitInfo jitInfo(ftn, ILHeader, jitMgr, !flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_NO_INLINING));
1326213208

1326313209
#if (defined(TARGET_AMD64) || defined(TARGET_ARM64))
1326413210
#ifdef TARGET_AMD64
@@ -13337,8 +13283,7 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config,
1333713283
#ifdef PERF_TRACK_METHOD_JITTIMES
1333813284
//Because we're not calling QPC enough. I'm not going to track times if we're just importing.
1333913285
LARGE_INTEGER methodJitTimeStart = {0};
13340-
if (!flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY))
13341-
QueryPerformanceCounter (&methodJitTimeStart);
13286+
QueryPerformanceCounter (&methodJitTimeStart);
1334213287

1334313288
#endif
1334413289
LOG((LF_CORDB, LL_EVERYTHING, "Calling invokeCompileMethod...\n"));
@@ -13363,7 +13308,6 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config,
1336313308
#ifdef PERF_TRACK_METHOD_JITTIMES
1336413309
//store the time in the string buffer. Module name and token are unique enough. Also, do not
1336513310
//capture importing time, just actual compilation time.
13366-
if (!flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY))
1336713311
{
1336813312
LARGE_INTEGER methodJitTimeStop;
1336913313
QueryPerformanceCounter(&methodJitTimeStop);
@@ -13390,8 +13334,7 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config,
1339013334
// Note: if we're only importing (ie, verifying/
1339113335
// checking to make sure we could JIT, but not actually generating code (
1339213336
// eg, for inlining), then DON'T TELL THE DEBUGGER about this.
13393-
if (!flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY) &&
13394-
!flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MCJIT_BACKGROUND)
13337+
if (!flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MCJIT_BACKGROUND)
1339513338
#ifdef FEATURE_STACK_SAMPLING
1339613339
&& !flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_SAMPLING_JIT_BACKGROUND)
1339713340
#endif // FEATURE_STACK_SAMPLING
@@ -13416,12 +13359,6 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config,
1341613359
ThrowExceptionForJit(res);
1341713360
}
1341813361

13419-
if (flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_IMPORT_ONLY))
13420-
{
13421-
// We are done
13422-
break;
13423-
}
13424-
1342513362
if (!nativeEntry)
1342613363
COMPlusThrow(kInvalidProgramException);
1342713364

@@ -14590,9 +14527,7 @@ InfoAccessType CEEInfo::constructStringLiteral(CORINFO_MODULE_HANDLE scopeHnd,
1459014527
InfoAccessType CEEInfo::emptyStringLiteral(void ** ppValue)
1459114528
{
1459214529
LIMITED_METHOD_CONTRACT;
14593-
_ASSERTE(isVerifyOnly());
14594-
*ppValue = (void *)0x10;
14595-
return IAT_PVALUE;
14530+
UNREACHABLE(); // only called on derived class.
1459614531
}
1459714532

1459814533
void* CEEInfo::getFieldAddress(CORINFO_FIELD_HANDLE fieldHnd,
@@ -14609,12 +14544,6 @@ void* CEEInfo::getFieldAddress(CORINFO_FIELD_HANDLE fieldHnd,
1460914544
if (ppIndirection != NULL)
1461014545
*ppIndirection = NULL;
1461114546

14612-
// Do not bother with initialization if we are only verifying the method.
14613-
if (isVerifyOnly())
14614-
{
14615-
return (void *)0x10;
14616-
}
14617-
1461814547
JIT_TO_EE_TRANSITION();
1461914548

1462014549
FieldDesc* field = (FieldDesc*)fieldHnd;
@@ -14632,10 +14561,7 @@ CORINFO_CLASS_HANDLE CEEInfo::getStaticFieldCurrentClass(CORINFO_FIELD_HANDLE fi
1463214561
bool* pIsSpeculative)
1463314562
{
1463414563
LIMITED_METHOD_CONTRACT;
14635-
_ASSERTE(isVerifyOnly());
14636-
if (pIsSpeculative != NULL)
14637-
*pIsSpeculative = true;
14638-
return NULL;
14564+
UNREACHABLE(); // only called on derived class.
1463914565
}
1464014566

1464114567
void* CEEInfo::getMethodSync(CORINFO_METHOD_HANDLE ftnHnd,

src/coreclr/vm/jitinterface.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,6 @@ class CEEInfo : public ICorJitInfo
466466
CORINFO_EH_CLAUSE* clause,
467467
COR_ILMETHOD_DECODER* pILHeader);
468468

469-
bool isVerifyOnly()
470-
{
471-
return m_fVerifyOnly;
472-
}
473-
474469
public:
475470

476471
void* getAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void **ppIndirection);
@@ -489,9 +484,8 @@ class CEEInfo : public ICorJitInfo
489484
TypeHandle typeHnd = TypeHandle() /* optional in */,
490485
CORINFO_CLASS_HANDLE *clsRet = NULL /* optional out */ );
491486

492-
CEEInfo(MethodDesc * fd = NULL, bool fVerifyOnly = false, bool fAllowInlining = true) :
487+
CEEInfo(MethodDesc * fd = NULL, bool fAllowInlining = true) :
493488
m_pMethodBeingCompiled(fd),
494-
m_fVerifyOnly(fVerifyOnly),
495489
m_pThread(GetThreadNULLOk()),
496490
m_hMethodForSecurity_Key(NULL),
497491
m_pMethodForSecurity_Value(NULL),
@@ -567,7 +561,6 @@ class CEEInfo : public ICorJitInfo
567561

568562
protected:
569563
MethodDesc* m_pMethodBeingCompiled; // Top-level method being compiled
570-
bool m_fVerifyOnly;
571564
Thread * m_pThread; // Cached current thread for faster JIT-EE transitions
572565
CORJIT_FLAGS m_jitFlags;
573566

@@ -792,8 +785,8 @@ class CEEJitInfo : public CEEInfo
792785
#endif
793786

794787
CEEJitInfo(MethodDesc* fd, COR_ILMETHOD_DECODER* header,
795-
EEJitManager* jm, bool fVerifyOnly, bool allowInlining = true)
796-
: CEEInfo(fd, fVerifyOnly, allowInlining),
788+
EEJitManager* jm, bool allowInlining = true)
789+
: CEEInfo(fd, allowInlining),
797790
m_jitManager(jm),
798791
m_CodeHeader(NULL),
799792
m_CodeHeaderRW(NULL),

0 commit comments

Comments
 (0)