Skip to content

Commit 4e5c8c0

Browse files
authored
crossgen2 fixes and cleanup (#38463)
- Delete copy&paste code from CoreCLR that is only relevant for IL verification - Delete early out for CORINFO_ACCESS_ADDRESS. There is no check like that in old crossgen. Reduces number of methods that fail to compile in CoreLib significantly. - Ship internal calls without throwing and catching exceptions. Fixes #32663
1 parent 29dee27 commit 4e5c8c0

1 file changed

Lines changed: 4 additions & 37 deletions

File tree

src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ public static bool ShouldSkipCompilation(MethodDesc methodNeedingCode)
188188
{
189189
return true;
190190
}
191+
if (methodNeedingCode.IsInternalCall)
192+
{
193+
return true;
194+
}
191195
if (methodNeedingCode.OwningType.IsDelegate && (
192196
methodNeedingCode.IsConstructor ||
193197
methodNeedingCode.Name == "BeginInvoke" ||
@@ -1021,28 +1025,9 @@ private void getFieldInfo(ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_MET
10211025
}
10221026
else
10231027
{
1024-
if ((flags & CORINFO_ACCESS_FLAGS.CORINFO_ACCESS_ADDRESS) != 0)
1025-
{
1026-
throw new RequiresRuntimeJitException("https://github.com/dotnet/runtime/issues/32663: CORINFO_FIELD_STATIC_ADDRESS");
1027-
}
1028-
10291028
helperId = field.HasGCStaticBase ?
10301029
ReadyToRunHelperId.GetGCStaticBase :
10311030
ReadyToRunHelperId.GetNonGCStaticBase;
1032-
1033-
//
1034-
// Currently, we only do this optimization for regular statics, but it
1035-
// looks like it may be permissible to do this optimization for
1036-
// thread statics as well. Currently there's no reason to do this
1037-
// as this code is not reachable until we implement CORINFO_FIELD_STATIC_ADDRESS
1038-
// which is something Crossgen1 doesn't do (cf. the above GitHub issue 32663).
1039-
/*
1040-
if ((flags & CORINFO_ACCESS_FLAGS.CORINFO_ACCESS_ADDRESS) != 0 &&
1041-
(fieldAccessor != CORINFO_FIELD_ACCESSOR.CORINFO_FIELD_STATIC_TLS))
1042-
{
1043-
fieldFlags |= CORINFO_FIELD_FLAGS.CORINFO_FLG_FIELD_SAFESTATIC_BYREF_RETURN;
1044-
}
1045-
*/
10461031
}
10471032

10481033
if (!_compilation.NodeFactory.CompilationModuleGroup.VersionsWithType(field.OwningType) &&
@@ -1171,24 +1156,6 @@ private void ceeInfoGetCallInfo(
11711156
{
11721157
pResult->thisTransform = CORINFO_THIS_TRANSFORM.CORINFO_NO_THIS_TRANSFORM;
11731158
}
1174-
else if (constrainedType.IsRuntimeDeterminedSubtype || exactType.IsRuntimeDeterminedSubtype)
1175-
{
1176-
// <NICE> It shouldn't really matter what we do here - but the x86 JIT is annoyingly sensitive
1177-
// about what we do, since it pretend generic variables are reference types and generates
1178-
// an internal JIT tree even when just verifying generic code. </NICE>
1179-
if (constrainedType.IsRuntimeDeterminedType)
1180-
{
1181-
pResult->thisTransform = CORINFO_THIS_TRANSFORM.CORINFO_DEREF_THIS; // convert 'this' of type &T --> T
1182-
}
1183-
else if (constrainedType.IsValueType)
1184-
{
1185-
pResult->thisTransform = CORINFO_THIS_TRANSFORM.CORINFO_BOX_THIS; // convert 'this' of type &VC<T> --> boxed(VC<T>)
1186-
}
1187-
else
1188-
{
1189-
pResult->thisTransform = CORINFO_THIS_TRANSFORM.CORINFO_DEREF_THIS; // convert 'this' of type &C<T> --> C<T>
1190-
}
1191-
}
11921159
else
11931160
{
11941161
// We have a "constrained." call. Try a partial resolve of the constraint call. Note that this

0 commit comments

Comments
 (0)