@@ -124,49 +124,17 @@ public int CompareTo(FieldWithToken other, TypeSystemComparer comparer)
124124 }
125125 }
126126
127- #nullable enable
128127 public class MethodWithToken
129128 {
130- /// <summary>
131- /// The MethodDesc this represents.
132- /// </summary>
133129 public readonly MethodDesc Method ;
134-
135- /// <summary>
136- /// The ModuleToken that represents the definition of Method.
137- /// </summary>
138130 public readonly ModuleToken Token ;
139-
140- /// <summary>
141- /// For constrained calls, the type that the call is constrained to.
142- /// </summary>
143- public readonly TypeDesc ? ConstrainedType ;
144-
145- /// <summary>
146- /// Whether this method is for an unboxing stub.
147- /// </summary>
131+ public readonly TypeDesc ConstrainedType ;
148132 public readonly bool Unboxing ;
149-
150- /// <summary>
151- /// Indicates whether the owning type is different than indicated by the ModuleToken for the method.
152- /// </summary>
153133 public readonly bool OwningTypeNotDerivedFromToken ;
154-
155- /// <summary>
156- /// The type that owns the method instance.
157- /// </summary>
158134 public readonly TypeDesc OwningType ;
159135
160- /// <summary>
161- ///
162- /// </summary>
163- /// <param name="method">The MethodDesc this represents.</param>
164- /// <param name="token">The ModuleToken that represents the definition of <paramref name="method"/></param>
165- /// <param name="constrainedType">For constrained calls, the type that the call is constrained to.</param>
166- /// <param name="unboxing">If the method is an unboxing stub</param>
167- /// <param name="context">A MethodDesc or TypeDesc from which the generic context is determined for finding the owning type.</param>
168- /// <param name="devirtualizedMethodOwner">The type that owns the devirtualized method, if any.</param>
169- public MethodWithToken ( MethodDesc method , ModuleToken token , TypeDesc ? constrainedType = null , bool unboxing = false , object ? context = null , TypeDesc ? devirtualizedMethodOwner = null )
136+
137+ public MethodWithToken ( MethodDesc method , ModuleToken token , TypeDesc constrainedType , bool unboxing , object context , TypeDesc devirtualizedMethodOwner = null )
170138 {
171139 Debug . Assert ( ! method . IsUnboxingThunk ( ) ) ;
172140 Method = method ;
@@ -176,7 +144,7 @@ public MethodWithToken(MethodDesc method, ModuleToken token, TypeDesc? constrain
176144 OwningType = GetMethodTokenOwningType ( this , constrainedType , context , devirtualizedMethodOwner , out OwningTypeNotDerivedFromToken ) ;
177145 }
178146
179- private static TypeDesc GetMethodTokenOwningType ( MethodWithToken methodToken , TypeDesc ? constrainedType , object ? context , TypeDesc ? devirtualizedMethodOwner , out bool owningTypeNotDerivedFromToken )
147+ private static TypeDesc GetMethodTokenOwningType ( MethodWithToken methodToken , TypeDesc constrainedType , object context , TypeDesc devirtualizedMethodOwner , out bool owningTypeNotDerivedFromToken )
180148 {
181149 ModuleToken moduleToken = methodToken . Token ;
182150 owningTypeNotDerivedFromToken = false ;
@@ -211,7 +179,7 @@ private static TypeDesc GetMethodTokenOwningType(MethodWithToken methodToken, Ty
211179 return methodToken . Method . OwningType ;
212180 }
213181
214- TypeDesc HandleContext ( IEcmaModule module , EntityHandle handle , TypeDesc methodTargetOwner , TypeDesc ? constrainedType , object ? context , TypeDesc ? devirtualizedMethodOwner , ref bool owningTypeNotDerivedFromToken )
182+ TypeDesc HandleContext ( IEcmaModule module , EntityHandle handle , TypeDesc methodTargetOwner , TypeDesc constrainedType , object context , TypeDesc devirtualizedMethodOwner , ref bool owningTypeNotDerivedFromToken )
215183 {
216184 var tokenOnlyOwningType = module . GetType ( handle ) ;
217185 TypeDesc actualOwningType ;
@@ -236,7 +204,7 @@ TypeDesc HandleContext(IEcmaModule module, EntityHandle handle, TypeDesc methodT
236204 typeInstantiation = typeContext . Instantiation ;
237205 }
238206
239- TypeDesc ? instantiatedOwningType = null ;
207+ TypeDesc instantiatedOwningType = null ;
240208
241209 if ( devirtualizedMethodOwner != null )
242210 {
@@ -336,7 +304,7 @@ TypeDesc ComputeActualOwningType(TypeDesc methodTargetOwner, TypeDesc instantiat
336304 }
337305 }
338306
339- public override bool Equals ( object ? obj )
307+ public override bool Equals ( object obj )
340308 {
341309 return obj is MethodWithToken methodWithToken &&
342310 Equals ( methodWithToken ) ;
@@ -448,7 +416,6 @@ public int CompareTo(MethodWithToken other, TypeSystemComparer comparer)
448416 return comparer . Compare ( OwningType , other . OwningType ) ;
449417 }
450418 }
451- #nullable restore
452419
453420 public struct GenericContext : IEquatable < GenericContext >
454421 {
@@ -592,9 +559,7 @@ public static bool ShouldSkipCompilation(InstructionSetSupport instructionSetSup
592559 public static bool ShouldCodeNotBeCompiledIntoFinalImage ( InstructionSetSupport instructionSetSupport , MethodDesc method )
593560 {
594561 if ( method . IsAsyncVariant ( ) )
595- {
596562 return false ;
597- }
598563
599564 EcmaMethod ecmaMethod = method . GetTypicalMethodDefinition ( ) as EcmaMethod ;
600565
@@ -1453,12 +1418,12 @@ private ModuleToken HandleToModuleToken(ref CORINFO_RESOLVED_TOKEN pResolvedToke
14531418 // using instantiation parameters from the MethodDesc entity.
14541419 resultMethod = resultMethod . GetTypicalMethodDefinition ( ) . GetPrimaryMethodDesc ( ) ;
14551420
1456- Debug . Assert ( resultMethod is EcmaMethod ) ;
1457- if ( ! _compilation . NodeFactory . CompilationModuleGroup . VersionsWithType ( ( ( EcmaMethod ) resultMethod ) . OwningType ) )
1421+ if ( ! _compilation . NodeFactory . CompilationModuleGroup . VersionsWithType ( resultMethod . OwningType ) )
14581422 {
14591423 ModuleToken result = _compilation . NodeFactory . Resolver . GetModuleTokenForMethod ( resultMethod , allowDynamicallyCreatedReference : true , throwIfNotFound : true ) ;
14601424 return result ;
14611425 }
1426+ Debug . Assert ( resultMethod is EcmaMethod ) ;
14621427 token = ( mdToken ) MetadataTokens . GetToken ( ( ( EcmaMethod ) resultMethod ) . Handle ) ;
14631428 module = ( ( EcmaMethod ) resultMethod ) . Module ;
14641429 }
0 commit comments