Compiler\BodySubstitutionParser.cs (9)
22private readonly Dictionary<MethodDesc, BodySubstitution> _methodSubstitutions;
29_methodSubstitutions = new Dictionary<MethodDesc, BodySubstitution>();
36_methodSubstitutions = new Dictionary<MethodDesc, BodySubstitution>();
61MethodDesc method = FindMethod(type, signature);
157private static MethodDesc FindMethod(TypeDesc type, string signature)
159foreach (MethodDesc meth in type.GetMethods())
228private Dictionary<MethodDesc, BodySubstitution> _bodySubstitutions;
231public IReadOnlyDictionary<MethodDesc, BodySubstitution> BodySubstitutions => _bodySubstitutions;
234public BodyAndFieldSubstitutions(Dictionary<MethodDesc, BodySubstitution> bodySubstitutions, Dictionary<FieldDesc, object> fieldSubstitutions)
Compiler\Compilation.cs (40)
79public virtual MethodIL GetMethodIL(MethodDesc method)
92public void DetectGenericCycles(MethodDesc caller, MethodDesc callee)
102public bool CanInline(MethodDesc caller, MethodDesc callee)
117public DelegateCreationInfo GetDelegateCtor(TypeDesc delegateType, MethodDesc target, TypeDesc constrainedType, bool followVirtualDispatch)
127MethodDesc originalTarget = target;
128MethodDesc targetDefinition = target.GetMethodDefinition();
174public MethodDesc ExpandIntrinsicForCallsite(MethodDesc intrinsicMethod, MethodDesc callsiteMethod)
240public bool IsEffectivelySealed(MethodDesc method)
245public MethodDesc ResolveVirtualMethod(MethodDesc declMethod, TypeDesc implType, out CORINFO_DEVIRTUALIZATION_DETAIL devirtualizationDetail)
266return ((MethodDesc)targetOfLookup).IsRuntimeDeterminedExactMethod;
302public static MethodDesc GetConstructorForCreateInstanceIntrinsic(TypeDesc type)
304MethodDesc ctor = type.GetDefaultConstructor();
355return NodeFactory.MethodGenericDictionary((MethodDesc)targetOfLookup);
357return NodeFactory.FatFunctionPointer((MethodDesc)targetOfLookup);
359return NodeFactory.RuntimeMethodHandle((MethodDesc)targetOfLookup);
365MethodDesc ctor = GetConstructorForCreateInstanceIntrinsic(type);
379public GenericDictionaryLookup ComputeGenericLookup(MethodDesc contextMethod, ReadyToRunHelperId lookupKind, object targetOfLookup)
457public bool IsFatPointerCandidate(MethodDesc containingMethod, MethodSignature signature)
480public MethodDesc GetTargetOfGenericVirtualMethodCall(MethodDesc calledMethod)
488MethodDesc targetMethod = calledMethod.GetCanonMethodTarget(CanonicalFormKind.Specific);
489MethodDesc targetMethodDefinition = targetMethod.GetMethodDefinition();
491MethodDesc slotNormalizedMethodDefinition = MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(targetMethodDefinition);
508MethodDesc runtimeDeterminedSlotNormalizedMethod;
560private sealed class ILCache : LockFreeReaderHashtable<MethodDesc, ILCache.MethodILData>
569protected override int GetKeyHashCode(MethodDesc key)
577protected override bool CompareKeyToValue(MethodDesc key, MethodILData value)
585protected override MethodILData CreateValueFromKey(MethodDesc key)
592public MethodDesc Method;
608public override MethodIL GetMethodIL(MethodDesc method)
653public IEnumerable<MethodDesc> CompiledMethodBodies
665public bool IsMethodBodyCompiled(MethodDesc method)
694public IEnumerable<MethodDesc> ReflectedMethods
710public readonly MethodDesc Method;
711public ConstrainedCallInfo(TypeDesc constrainedType, MethodDesc method)
Compiler\Dataflow\CompilerGeneratedState.cs (40)
26MethodDesc CreatingMethod,
89private Dictionary<MetadataType, MethodDesc>? _compilerGeneratedTypeToUserCodeMethod;
91private Dictionary<MethodDesc, MethodDesc>? _compilerGeneratedMethodToUserCodeMethod;
96private Dictionary<MethodDesc, List<TypeSystemEntity>>? _compilerGeneratedMembers;
125var userDefinedMethods = new HashSet<MethodDesc>();
137void ProcessMethod(MethodDesc method)
175MethodDesc? referencedMethod = methodBody.GetObject(reader.ReadILToken(), NotFoundBehavior.ReturnNull) as MethodDesc;
193var alreadyAssociatedMethod = generatedTypeToTypeArgs[generatedType].CreatingMethod;
258_compilerGeneratedTypeToUserCodeMethod ??= new Dictionary<MetadataType, MethodDesc>();
261var alreadyAssociatedMethod = _compilerGeneratedTypeToUserCodeMethod[stateMachineType];
287foreach (MethodDesc method in type.GetMethods())
299foreach (var method in nestedType.GetMethods())
314foreach (var userDefinedMethod in userDefinedMethods)
320_compilerGeneratedMembers ??= new Dictionary<MethodDesc, List<TypeSystemEntity>>();
327case MethodDesc nestedFunction:
330_compilerGeneratedMethodToUserCodeMethod ??= new Dictionary<MethodDesc, MethodDesc>();
333var alreadyAssociatedMethod = _compilerGeneratedMethodToUserCodeMethod[nestedFunction];
364var method = info.CreatingMethod;
365var alreadyAssociatedMethod = _generatedTypeToTypeArgumentInfo[generatedType].CreatingMethod;
403var method = typeInfo.CreatingMethod;
468MethodDesc? methodOperand = null;
473methodOperand = body.GetObject(reader.ReadILToken()) as MethodDesc;
474if (methodOperand is MethodDesc { OwningType: MetadataType owningType }
487methodOperand = body.GetObject(reader.ReadILToken()) as MethodDesc;
528public bool TryGetCompilerGeneratedCalleesForUserMethod(MethodDesc method, [NotNullWhen(true)] out List<TypeSystemEntity>? callees)
549public bool TryGetOwningMethodForCompilerGeneratedMethod(MethodDesc compilerGeneratedMethod, [NotNullWhen(true)] out MethodDesc? owningMethod)
560public bool TryGetOwningMethodForCompilerGeneratedType(MetadataType compilerGeneratedType, [NotNullWhen(true)] out MethodDesc? owningMethod)
604if (member is MethodDesc method && CompilerGeneratedNames.IsLambdaOrLocalFunction(method.Name.AsSpan()))
613public static bool TryGetStateMachineType(MethodDesc method, [NotNullWhen(true)] out MetadataType? stateMachineType)
660public bool TryGetCompilerGeneratedCalleesForUserMethod(MethodDesc method, [NotNullWhen(true)] out List<TypeSystemEntity>? callees)
707public bool TryGetOwningMethodForCompilerGeneratedMember(TypeSystemEntity sourceMember, [NotNullWhen(true)] out MethodDesc? owningMethod)
727MethodDesc? compilerGeneratedMethod = sourceMember as MethodDesc;
740public bool TryGetUserMethodForCompilerGeneratedMember(TypeSystemEntity sourceMember, [NotNullWhen(true)] out MethodDesc? userMethod)
746Debug.Assert(sourceMember is not MethodDesc sourceMethod || sourceMethod.IsTypicalMethodDefinition);
753MethodDesc? userMethodCandidate;
Compiler\Dataflow\FlowAnnotations.cs (21)
52public bool RequiresDataflowAnalysisDueToSignature(MethodDesc method)
68public bool RequiresVirtualMethodDataflowAnalysis(MethodDesc method)
110public bool HasGenericParameterAnnotation(MethodDesc method)
125MethodDesc method = param.Method.Method.GetTypicalMethodDefinition();
135public DynamicallyAccessedMemberTypes GetReturnParameterAnnotation(MethodDesc method)
167MethodDesc method => ShouldWarnWhenAccessedForReflection(method),
190MethodDesc parent = ecmaGenericParameter.Module.GetMethod(paramDef.Parent);
201public bool ShouldWarnWhenAccessedForReflection(MethodDesc method)
528MethodDesc setMethod = property.SetMethod;
573MethodDesc getMethod = property.GetMethod;
727internal void ValidateMethodAnnotationsAreSame(MethodDesc method, MethodDesc baseMethod, TypeSystemEntity origin)
785private void ValidateMethodParametersHaveNoAnnotations(DynamicallyAccessedMemberTypes[] parameterAnnotations, MethodDesc method, MethodDesc baseMethod, TypeSystemEntity origin)
798private void ValidateMethodGenericParametersHaveNoAnnotations(DynamicallyAccessedMemberTypes[] genericParameterAnnotations, MethodDesc method, MethodDesc baseMethod, TypeSystemEntity origin)
831case (TypeDesc, MethodDesc method):
833DiagnosticUtilities.GetMethodSignatureDisplayName(method), DiagnosticUtilities.GetMethodSignatureDisplayName((MethodDesc)baseProvider));
860public bool TryGetAnnotation(MethodDesc method, out MethodAnnotations annotations)
926public readonly MethodDesc Method;
932MethodDesc method,
Compiler\Dataflow\MethodBodyScanner.cs (15)
288MethodDesc startingMethod = startingMethodBody.OwningMethod;
334private static void TrackNestedFunctionReference(MethodDesc referencedMethod, ref InterproceduralState interproceduralState)
336MethodDesc method = referencedMethod.GetTypicalMethodDefinition();
346MethodDesc thisMethod = methodIL.OwningMethod;
475if (methodIL.GetObject(reader.ReadILToken()) is MethodDesc methodOperand)
536if (methodIL.GetObject(reader.ReadILToken()) is MethodDesc methodOperand)
763MethodDesc methodOperand = (MethodDesc)methodIL.GetObject(reader.ReadILToken());
884private void ScanLdarg(ILOpcode opcode, int parameterIndex, Stack<StackSlot> currentStack, MethodDesc thisMethod)
979else if (operand is MethodDesc method)
1167MethodDesc methodCalled,
1241MethodDesc calledMethod,
1265protected abstract void HandleMethodTokenAccess(MethodIL methodIL, int offset, MethodDesc accessedMethod);
1276MethodDesc calledMethod,
1327MethodDesc calledMethod,
Compiler\Dataflow\ReflectionMarker.cs (11)
44public List<(MethodDesc OwningMethod, INodeWithRuntimeDeterminedDependencies Dependency)> RuntimeDeterminedDependencies { get; } = new List<(MethodDesc, INodeWithRuntimeDeterminedDependencies)>();
97case MethodDesc method:
200internal void MarkMethod(in MessageOrigin origin, MethodDesc method, TypeSystemEntity reason, AccessKind accessKind = AccessKind.Unspecified)
208internal void MarkMethod(in MessageOrigin origin, MethodDesc method, string reason, AccessKind accessKind = AccessKind.Unspecified)
258internal void MarkConstructorsOnType(in MessageOrigin origin, TypeDesc type, Func<MethodDesc, bool>? filter, TypeSystemEntity reason, BindingFlags? bindingFlags = null)
264foreach (var ctor in type.GetConstructorsOnType(filter, bindingFlags))
303MethodDesc cctor = type.GetStaticConstructor();
325Debug.Assert(entity is MethodDesc or FieldDesc);
353if (entity is MethodDesc)
377Debug.Assert(entity is MethodDesc or FieldDesc);
Compiler\Dataflow\ReflectionMethodBodyScanner.cs (9)
38public static bool RequiresReflectionMethodBodyScannerForCallSite(FlowAnnotations flowAnnotations, MethodDesc method)
49public static bool RequiresReflectionMethodBodyScannerForMethodBody(FlowAnnotations flowAnnotations, MethodDesc methodDefinition)
128public static DependencyList ScanAndProcessReturnValue(NodeFactory factory, FlowAnnotations annotations, Logger logger, MethodIL methodIL, out List<(MethodDesc OwningMethod, INodeWithRuntimeDeterminedDependencies Dependency)> runtimeDependencies)
271protected override void HandleMethodTokenAccess(MethodIL methodIL, int offset, MethodDesc accessedMethod)
289public override MultiValue HandleCall(MethodIL callingMethodIL, MethodDesc calledMethod, ILOpcode operation, int offset, ValueNodeList methodParams)
333MethodDesc calledMethod,
340var callingMethodDefinition = callingMethodBody.OwningMethod;
442private void ProcessGenericArgumentDataFlow(MethodDesc method)
477internal static bool IsPInvokeDangerous(MethodDesc calledMethod, out bool comDangerousMethod, out bool aotUnsafeDelegate)
Compiler\DependencyAnalysis\NativeLayoutVertexNode.cs (33)
100protected readonly MethodDesc _method;
105public MethodDesc Method => _method;
111public NativeLayoutMethodEntryVertexNode(NodeFactory factory, MethodDesc method, MethodEntryFlags flags)
188MethodDesc methodForToken = GetMethodForMetadata(_method, out bool isAsyncVariant, out bool isReturnDroppingAsyncThunk);
207private static MethodDesc GetMethodForMetadata(MethodDesc method, out bool isAsyncVariant, out bool isReturnDroppingAsyncThunk)
209MethodDesc result = method.GetTypicalMethodDefinition();
620private static bool NeedsEntrypoint(MethodDesc method)
637public NativeLayoutTemplateMethodSignatureVertexNode(NodeFactory factory, MethodDesc method)
684if (owningMethodOrType is MethodDesc owningMethod)
702if (_owningMethodOrType is MethodDesc owningMethod)
774private MethodDesc _method;
778public NativeLayoutTemplateMethodLayoutVertexNode(NodeFactory factory, MethodDesc method)
1006MethodDesc cctorMethod = _type.GetStaticConstructor();
1007MethodDesc canonCctorMethod = cctorMethod.GetCanonMethodTarget(CanonicalFormKind.Specific);
1200private MethodDesc _method;
1202public NativeLayoutInterfaceDispatchGenericDictionarySlotNode(NodeFactory factory, MethodDesc method)
1215MethodDesc canonMethod = _method.GetCanonMethodTarget(CanonicalFormKind.Specific);
1229MethodDesc method = _method;
1241private MethodDesc _method;
1243public NativeLayoutGvmDispatchGenericDictionarySlotNode(NodeFactory factory, MethodDesc method)
1266MethodDesc canonMethod = _method.GetCanonMethodTarget(CanonicalFormKind.Specific);
1281private MethodDesc _method;
1283public NativeLayoutMethodDictionaryGenericDictionarySlotNode(NodeFactory factory, MethodDesc method)
1356private MethodDesc _method;
1358public NativeLayoutMethodLdTokenGenericDictionarySlotNode(NodeFactory factory, MethodDesc method)
1399private MethodDesc _constrainedMethod;
1403public NativeLayoutConstrainedMethodDictionarySlotNode(MethodDesc constrainedMethod, TypeDesc constraintType, bool directCall)
1464MethodDesc canonMethod = _constrainedMethod.GetCanonMethodTarget(CanonicalFormKind.Specific);
1482var canonConstrainedMethod = _constrainedMethod.GetCanonMethodTarget(CanonicalFormKind.Specific);
1492private MethodDesc _method;
1502public WrappedMethodEntryVertexNode(NodeFactory factory, MethodDesc method, bool unboxingStub, IMethodNode functionPointerNode) :
1518public NativeLayoutMethodEntrypointGenericDictionarySlotNode(NodeFactory factory, MethodDesc method, IMethodNode functionPointerNode, bool unboxingStub)
Compiler\DependencyAnalysis\NodeFactory.cs (107)
133protected virtual bool CanFold(MethodDesc method) => false;
278_directPInvokes = new NodeCache<MethodDesc, ExternFunctionSymbolNode>((MethodDesc key) =>
287MethodDesc nativeTarget = key is PInvokeTargetNativeMethod
319_tentativeMethodEntrypoints = new NodeCache<MethodDesc, IMethodNode>((MethodDesc method) =>
331_unboxingStubs = new NodeCache<MethodDesc, IMethodNode>(CreateUnboxingStubNode);
348_gvmDependenciesNode = new NodeCache<MethodDesc, GVMDependenciesNode>(method =>
353_gvmImpls = new NodeCache<MethodDesc, GenericVirtualMethodImplNode>(method =>
358_genericMethodEntries = new NodeCache<MethodDesc, GenericMethodsHashtableEntryNode>(method =>
363_exactMethodEntries = new NodeCache<MethodDesc, ExactMethodInstantiationsEntryNode>(method =>
373_addressTakenMethods = new NodeCache<MethodDesc, AddressTakenMethodNode>(method =>
378_reflectedDelegateTargetMethods = new NodeCache<MethodDesc, DelegateTargetVirtualMethodNode>(method =>
383_delegateTargetMethods = new NodeCache<MethodDesc, DelegateTargetVirtualMethodNode>(method =>
388_reflectableVirtualMethodImpls = new NodeCache<(MethodDesc Declaration, MethodDesc Implementation), ReflectableVirtualMethodImplNode>(methods =>
398_reflectedMethods = new NodeCache<MethodDesc, ReflectedMethodNode>(method =>
440_variantMethods = new NodeCache<MethodDesc, VariantInterfaceMethodUseNode>((MethodDesc method) =>
504_runtimeMethodHandles = new NodeCache<MethodDesc, RuntimeMethodHandleNode>((MethodDesc method) =>
549_eagerCctorIndirectionNodes = new NodeCache<MethodDesc, EmbeddedObjectNode>((MethodDesc method) =>
568_methodGenericDictionaries = new NodeCache<MethodDesc, ISortableSymbolNode>(method =>
592_methodsWithMetadata = new NodeCache<MethodDesc, MethodMetadataNode>(method =>
597_methodsWithLimitedMetadata = new NodeCache<MethodDesc, MethodMetadataNode>(method =>
639_stringAllocators = new NodeCache<MethodDesc, IMethodNode>(constructor =>
746protected abstract IMethodNode CreateMethodEntrypointNode(MethodDesc method);
748protected abstract IMethodNode CreateUnboxingStubNode(MethodDesc method);
928public DispatchCellNode DispatchCell(MethodDesc method, ISortableSymbolNode callSite = null)
933private NodeCache<MethodDesc, RuntimeMethodHandleNode> _runtimeMethodHandles;
935public RuntimeMethodHandleNode RuntimeMethodHandle(MethodDesc method)
1039private NodeCache<MethodDesc, ExternFunctionSymbolNode> _directPInvokes;
1040public ExternFunctionSymbolNode DirectPInvokeTarget(MethodDesc method)
1096private NodeCache<MethodDesc, ISortableSymbolNode> _methodGenericDictionaries;
1097public ISortableSymbolNode MethodGenericDictionary(MethodDesc method)
1114private NodeCache<MethodDesc, IMethodNode> _stringAllocators;
1115public IMethodNode StringAllocator(MethodDesc stringConstructor)
1131private sealed class MethodEntrypointHashtable : LockFreeReaderHashtable<MethodDesc, IMethodNode>
1135protected override bool CompareKeyToValue(MethodDesc key, IMethodNode value) => key == value.Method;
1137protected override IMethodNode CreateValueFromKey(MethodDesc key) => _factory.CreateMethodEntrypointNode(key);
1138protected override int GetKeyHashCode(MethodDesc key) => key.GetHashCode();
1143private NodeCache<MethodDesc, IMethodNode> _unboxingStubs;
1146public IMethodNode MethodEntrypoint(MethodDesc method, bool unboxingStub = false)
1156protected NodeCache<MethodDesc, IMethodNode> _tentativeMethodEntrypoints;
1158public IMethodNode TentativeMethodEntrypoint(MethodDesc method, bool unboxingStub = false)
1166public IMethodNode MethodEntrypointOrTentativeMethod(MethodDesc method, bool unboxingStub = false)
1185public IMethodNode FatFunctionPointer(MethodDesc method, bool isUnboxingStub = false)
1192public IMethodNode FatAddressTakenFunctionPointer(MethodDesc method, bool isUnboxingStub = false)
1200public IMethodNode ExactCallableAddress(MethodDesc method, bool isUnboxingStub = false)
1202MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific);
1209public IMethodNode ExactCallableAddressTakenAddress(MethodDesc method, bool isUnboxingStub = false)
1211MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific);
1218public IMethodNode CanonicalEntrypoint(MethodDesc method)
1220MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific);
1227private NodeCache<MethodDesc, GVMDependenciesNode> _gvmDependenciesNode;
1228public GVMDependenciesNode GVMDependencies(MethodDesc method)
1233private NodeCache<MethodDesc, GenericVirtualMethodImplNode> _gvmImpls;
1234public GenericVirtualMethodImplNode GenericVirtualMethodImpl(MethodDesc method)
1239private NodeCache<MethodDesc, GenericMethodsHashtableEntryNode> _genericMethodEntries;
1240public GenericMethodsHashtableEntryNode GenericMethodsHashtableEntry(MethodDesc method)
1245private NodeCache<MethodDesc, ExactMethodInstantiationsEntryNode> _exactMethodEntries;
1246public ExactMethodInstantiationsEntryNode ExactMethodInstantiationsHashtableEntry(MethodDesc method)
1257private NodeCache<MethodDesc, AddressTakenMethodNode> _addressTakenMethods;
1258public IMethodNode AddressTakenMethodEntrypoint(MethodDesc method, bool unboxingStub = false)
1266private NodeCache<MethodDesc, DelegateTargetVirtualMethodNode> _reflectedDelegateTargetMethods;
1267public DelegateTargetVirtualMethodNode ReflectedDelegateTargetVirtualMethod(MethodDesc method)
1272private NodeCache<MethodDesc, DelegateTargetVirtualMethodNode> _delegateTargetMethods;
1273public DelegateTargetVirtualMethodNode DelegateTargetVirtualMethod(MethodDesc method)
1278private NodeCache<(MethodDesc Declaration, MethodDesc Implementation), ReflectableVirtualMethodImplNode> _reflectableVirtualMethodImpls;
1279public ReflectableVirtualMethodImplNode ReflectableVirtualMethodImpl(MethodDesc declaration, MethodDesc implementation)
1294private NodeCache<MethodDesc, ReflectedMethodNode> _reflectedMethods;
1295public ReflectedMethodNode ReflectedMethod(MethodDesc method)
1336private sealed class ShadowConcreteMethodHashtable : LockFreeReaderHashtable<MethodDesc, ShadowConcreteMethodNode>
1340protected override bool CompareKeyToValue(MethodDesc key, ShadowConcreteMethodNode value) => key == value.Method;
1342protected override ShadowConcreteMethodNode CreateValueFromKey(MethodDesc key) =>
1344protected override int GetKeyHashCode(MethodDesc key) => key.GetHashCode();
1349public ShadowConcreteMethodNode ShadowConcreteMethod(MethodDesc method)
1354private sealed class ShadowNonConcreteMethodHashtable : LockFreeReaderHashtable<MethodDesc, ShadowNonConcreteMethodNode>
1358protected override bool CompareKeyToValue(MethodDesc key, ShadowNonConcreteMethodNode value) => key == value.Method;
1360protected override ShadowNonConcreteMethodNode CreateValueFromKey(MethodDesc key) =>
1362protected override int GetKeyHashCode(MethodDesc key) => key.GetHashCode();
1367public ShadowNonConcreteMethodNode ShadowNonConcreteMethod(MethodDesc method)
1394var method = type.GetKnownMethod(Encoding.UTF8.GetBytes(entry[2]), null);
1412private MethodDesc _instanceMethodRemovedHelper;
1413public MethodDesc InstanceMethodRemovedHelper
1423private sealed class VirtualMethodUseHashtable : LockFreeReaderHashtable<MethodDesc, VirtualMethodUseNode>
1427protected override bool CompareKeyToValue(MethodDesc key, VirtualMethodUseNode value) => key == value.Method;
1429protected override VirtualMethodUseNode CreateValueFromKey(MethodDesc key)
1436protected override int GetKeyHashCode(MethodDesc key) => key.GetHashCode();
1442public DependencyNodeCore<NodeFactory> VirtualMethodUse(MethodDesc decl)
1447private NodeCache<MethodDesc, VariantInterfaceMethodUseNode> _variantMethods;
1449public DependencyNodeCore<NodeFactory> VariantInterfaceMethodUse(MethodDesc decl)
1499private NodeCache<MethodDesc, MethodMetadataNode> _methodsWithMetadata;
1501internal MethodMetadataNode MethodMetadata(MethodDesc method)
1509private NodeCache<MethodDesc, MethodMetadataNode> _methodsWithLimitedMetadata;
1511internal MethodMetadataNode LimitedMethodMetadata(MethodDesc method)
1613private NodeCache<MethodDesc, EmbeddedObjectNode> _eagerCctorIndirectionNodes;
1615public EmbeddedObjectNode EagerCctorIndirection(MethodDesc cctorMethod)
1676public WasmTypeNode WasmTypeNode(MethodDesc desc)
1769public Vertex EncodeReferenceToMethod(NativeWriter writer, MethodDesc method)
1777public readonly MethodDesc Method;
1780public MethodKey(MethodDesc method, bool isUnboxingStub)
1839public readonly MethodDesc Target;
1842public DispatchCellKey(MethodDesc target, ISortableSymbolNode callsiteId)
Compiler\DependencyAnalysis\NodeFactory.GenericLookups.cs (13)
45_methodHandles = new NodeCache<MethodDesc, GenericLookupResult>(method =>
55_methodDictionaries = new NodeCache<MethodDesc, GenericLookupResult>(method =>
65_dispatchCells = new NodeCache<MethodDesc, GenericLookupResult>(method =>
140private NodeCache<MethodDesc, GenericLookupResult> _methodHandles;
142public GenericLookupResult MethodHandle(MethodDesc method)
175private NodeCache<MethodDesc, GenericLookupResult> _methodDictionaries;
177public GenericLookupResult MethodDictionary(MethodDesc method)
182private NodeCache<MethodDesc, GenericLookupResult> _dispatchCells;
184public GenericLookupResult DispatchCell(MethodDesc method)
191public GenericLookupResult MethodEntry(MethodDesc method, bool isUnboxingThunk = false)
211public GenericLookupResult ConstrainedMethodUse(MethodDesc constrainedMethod, TypeDesc constraintType, bool directCall)
221public ConstrainedMethodUseKey(MethodDesc constrainedMethod, TypeDesc constraintType, bool directCall)
228public readonly MethodDesc ConstrainedMethod;
Compiler\DependencyAnalysis\NodeFactory.NativeLayout.cs (25)
55_methodEntries = new NodeCache<MethodDesc, NativeLayoutMethodEntryVertexNode>(method =>
60_templateMethodEntries = new NodeCache<MethodDesc, NativeLayoutTemplateMethodSignatureVertexNode>(method =>
65_templateMethodLayouts = new NodeCache<MethodDesc, NativeLayoutTemplateMethodLayoutVertexNode>(method =>
110_interfaceCell_GenericDictionarySlots = new NodeCache<MethodDesc, NativeLayoutInterfaceDispatchGenericDictionarySlotNode>(method =>
115_gvmCell_GenericDictionarySlots = new NodeCache<MethodDesc, NativeLayoutGvmDispatchGenericDictionarySlotNode>(method =>
120_methodDictionary_GenericDictionarySlots = new NodeCache<MethodDesc, NativeLayoutMethodDictionaryGenericDictionarySlotNode>(method =>
135_methodLdToken_GenericDictionarySlots = new NodeCache<MethodDesc, NativeLayoutMethodLdTokenGenericDictionarySlotNode>(method =>
315private NodeCache<MethodDesc, NativeLayoutMethodEntryVertexNode> _methodEntries;
316internal NativeLayoutMethodEntryVertexNode MethodEntry(MethodDesc method)
321private NodeCache<MethodDesc, NativeLayoutTemplateMethodSignatureVertexNode> _templateMethodEntries;
322internal NativeLayoutTemplateMethodSignatureVertexNode TemplateMethodEntry(MethodDesc method)
327private NodeCache<MethodDesc, NativeLayoutTemplateMethodLayoutVertexNode> _templateMethodLayouts;
328public NativeLayoutTemplateMethodLayoutVertexNode TemplateMethodLayout(MethodDesc method)
381private NodeCache<MethodDesc, NativeLayoutInterfaceDispatchGenericDictionarySlotNode> _interfaceCell_GenericDictionarySlots;
382public NativeLayoutInterfaceDispatchGenericDictionarySlotNode InterfaceCellDictionarySlot(MethodDesc method)
387private NodeCache<MethodDesc, NativeLayoutGvmDispatchGenericDictionarySlotNode> _gvmCell_GenericDictionarySlots;
388public NativeLayoutGvmDispatchGenericDictionarySlotNode GvmCellDictionarySlot(MethodDesc method)
393private NodeCache<MethodDesc, NativeLayoutMethodDictionaryGenericDictionarySlotNode> _methodDictionary_GenericDictionarySlots;
394public NativeLayoutMethodDictionaryGenericDictionarySlotNode MethodDictionaryDictionarySlot(MethodDesc method)
404public readonly MethodDesc Method;
407public MethodEntrypointSlotKey(MethodDesc method, bool unboxing, IMethodNode functionPointerTarget)
447public NativeLayoutMethodEntrypointGenericDictionarySlotNode MethodEntrypointDictionarySlot(MethodDesc method, bool unboxing, IMethodNode functionPointerTarget)
458private NodeCache<MethodDesc, NativeLayoutMethodLdTokenGenericDictionarySlotNode> _methodLdToken_GenericDictionarySlots;
459public NativeLayoutMethodLdTokenGenericDictionarySlotNode MethodLdTokenDictionarySlot(MethodDesc method)
471public NativeLayoutConstrainedMethodDictionarySlotNode ConstrainedMethodUse(MethodDesc constrainedMethod, TypeDesc constraintType, bool directCall)
Compiler\ILScanner.cs (33)
57var canonicalMethodsToCompile = new HashSet<MethodDesc>();
71MethodDesc method = methodCodeNodeNeedingCode.Method;
119MethodDesc method = methodCodeNodeNeedingCode.Method;
195MethodDesc methodDesc = JitHelper.GetEntryPoint(_compilation.TypeSystemContext, key);
289private readonly Dictionary<TypeDesc, MethodDesc[]> _vtableSlices = new Dictionary<TypeDesc, MethodDesc[]>();
298ArrayBuilder<MethodDesc> usedSlots = default;
302MethodDesc slot = vtableSliceNode.Slots[i];
314if (!_vtableSlices.TryGetValue(type, out MethodDesc[] slots))
384MethodDesc targetMethod = methodDictLookup.Method.GetCanonMethodTarget(CanonicalFormKind.Specific);
439Debug.Assert(methodOrType is MethodDesc);
440MethodDesc method = (MethodDesc)methodOrType;
457private HashSet<MethodDesc> _overriddenMethods = new();
458private HashSet<MethodDesc> _generatedVirtualMethods = new();
473var vtables = new Dictionary<TypeDesc, List<MethodDesc>>();
594static List<MethodDesc> BuildVTable(NodeFactory factory, TypeDesc currentType, TypeDesc implType, List<MethodDesc> vtable)
601IReadOnlyList<MethodDesc> slice = factory.VTable(currentType).Slots;
602foreach (MethodDesc decl in slice)
614if (!vtables.TryGetValue(baseType, out List<MethodDesc> baseVtable))
615vtables.Add(baseType, baseVtable = BuildVTable(factory, baseType, baseType, new List<MethodDesc>()));
617if (!vtables.TryGetValue(type, out List<MethodDesc> vtable))
618vtables.Add(type, vtable = BuildVTable(factory, type, type, new List<MethodDesc>()));
707public override bool IsEffectivelySealed(MethodDesc method)
722MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific);
730protected override MethodDesc ResolveVirtualMethod(MethodDesc declMethod, DefType implType, out CORINFO_DEVIRTUALIZATION_DETAIL devirtualizationDetail)
833public bool CanInline(MethodDesc caller, MethodDesc callee)
854private readonly Dictionary<MethodDesc, TypeSystemException> _importationErrors = new Dictionary<MethodDesc, TypeSystemException>();
868public override TypeSystemException GetCompilationError(MethodDesc method)
Compiler\MetadataManager.cs (65)
56private List<MetadataMapping<MethodDesc>> _methodMappings;
57private Dictionary<MethodDesc, int> _methodHandleMap;
75private readonly SortedSet<MethodDesc> _reflectableMethods = new SortedSet<MethodDesc>(TypeSystemComparer.Instance);
86private readonly SortedSet<MethodDesc> _genericMethodHashtableEntries = new SortedSet<MethodDesc>(TypeSystemComparer.Instance);
87private readonly SortedSet<MethodDesc> _exactMethodHashtableEntries = new SortedSet<MethodDesc>(TypeSystemComparer.Instance);
390public virtual bool IsReflectionInvokable(MethodDesc method)
395public static bool IsMethodSupportedInReflectionInvoke(MethodDesc method)
440public bool HasReflectionInvokeStub(MethodDesc method)
451public bool ShouldMethodBeInInvokeMap(MethodDesc method)
464public void GetDependenciesDueToGenericDictionary(DependencySink dependencies, NodeFactory factory, MethodDesc method)
472public void AddConditionalDependenciesDueToGenericDictionary(DependencySink dependencies, NodeFactory factory, MethodDesc method)
485public void GetDependenciesDueToReflectability(IDependencySink dependencies, NodeFactory factory, MethodDesc method)
541MethodDesc method,
547protected virtual void GetMetadataDependenciesDueToReflectability(IDependencySink dependencies, NodeFactory factory, MethodDesc method)
554public virtual void AddNativeLayoutMetadataDependencies(DependencySink dependencies, NodeFactory factory, MethodDesc method)
605public virtual void GetDependenciesDueToLdToken(DependencySink dependencies, NodeFactory factory, MethodDesc method)
620public void GetDependenciesDueToDelegateCreation(DependencySink dependencies, NodeFactory factory, TypeDesc delegateType, MethodDesc target)
631public virtual void GetConditionalDependenciesDueToDelegateCreation(DependencySink dependencies, NodeFactory factory, TypeDesc delegateType, MethodDesc target)
640public virtual void GetDependenciesForOverridingMethod(DependencySink dependencies, NodeFactory factory, MethodDesc decl, MethodDesc impl)
653public void GetDependenciesDueToMethodCodePresence(IDependencySink dependencies, NodeFactory factory, MethodDesc method, MethodIL methodIL)
660public virtual void GetConditionalDependenciesDueToMethodCodePresence(IConditionalDependencySink dependencies, NodeFactory factory, MethodDesc method)
666protected virtual void GetDependenciesDueToMethodCodePresenceInternal(IDependencySink dependencies, NodeFactory factory, MethodDesc method, MethodIL methodIL)
675public bool HasReflectionInvokeStubForInvokableMethod(MethodDesc method)
685public bool WillUseMetadataTokenToReferenceMethod(MethodDesc method)
702public MethodDesc GetReflectionInvokeStub(MethodDesc method)
725out List<MetadataMapping<MethodDesc>> methodMappings,
726out Dictionary<MethodDesc, int> methodMetadataMappings,
737out List<MetadataMapping<MethodDesc>> methodMappings,
738out Dictionary<MethodDesc, int> methodMetadataMappings,
751var methodsWithMappings = new HashSet<MethodDesc>();
752foreach (var method in GetReflectableMethods())
762var methodBodies = new HashSet<MethodDesc>();
765MethodDesc method = methodBody.Method;
825methodMappings = new List<MetadataMapping<MethodDesc>>();
826methodMetadataMappings = new Dictionary<MethodDesc, int>();
852foreach (var method in GetReflectableMethods())
854MethodDesc typicalMethod = method.GetTypicalMethodDefinition();
885methodMappings.Add(new MetadataMapping<MethodDesc>(method, writer.GetRecordHandle(record)));
935protected StackTraceRecordData CreateStackTraceRecord(Metadata.MetadataTransform transform, MethodDesc method, StackTraceRecordFlags flags)
938MethodDesc methodToGenerateMetadataFor = method.GetTypicalMethodDefinition();
1004public IEnumerable<MetadataMapping<MethodDesc>> GetMethodMapping(NodeFactory factory)
1010public int GetMetadataHandleForMethod(NodeFactory factory, MethodDesc method)
1095public IEnumerable<MethodDesc> GetReflectableMethods()
1115public IEnumerable<MethodDesc> GetGenericMethodHashtableEntries()
1120public IEnumerable<MethodDesc> GetExactMethodHashtableEntries()
1222public bool IsReflectionBlocked(MethodDesc method)
1224MethodDesc methodDefinition = method.GetMethodDefinition();
1230MethodDesc typicalMethodDefinition = methodDefinition.GetTypicalMethodDefinition();
1257public bool CanGenerateMetadata(MethodDesc method)
1276protected abstract MetadataCategory GetMetadataCategory(MethodDesc method);
1292public virtual void GetDependenciesDueToAccess(IDependencySink dependencies, NodeFactory factory, MethodIL methodIL, MethodDesc calledMethod)
1300public virtual DependencyList GetDependenciesForCustomAttribute(NodeFactory factory, MethodDesc attributeCtor, CustomAttributeValue decodedValue, TypeSystemEntity parent)
1305public virtual void NoteOverridingMethod(MethodDesc baseMethod, MethodDesc overridingMethod, TypeSystemEntity origin = null)
1321public readonly MethodDesc Method;
1328public StackTraceMapping(MethodDesc method, int owningTypeHandle, int methodSignatureHandle, int methodNameHandle, int methodInstantiationArgumentCollectionHandle, StackTraceRecordFlags flags)
1335public readonly MethodDesc Method;
1339public ReflectionStackTraceMapping(MethodDesc method, int owningTypeHandle, int methodHandle)
1353public readonly MethodDesc Method;
1360public StackTraceRecordData(MethodDesc method, MetadataRecord owningType, MetadataRecord methodSignature, MetadataRecord methodName, MetadataRecord methodInstantiationArgumentCollection, StackTraceRecordFlags flags)
Compiler\MstatObjectDumper.cs (6)
40private List<(MethodDesc Method, string MangledName, int Size, int GcInfoSize)> _methods = new();
41private Dictionary<MethodDesc, int> _methodEhInfo = new();
43private Dictionary<MethodDesc, List<(MethodDesc Method, int MangledName)>> _deduplicatedBodies = new();
114if (!_deduplicatedBodies.TryGetValue(originalBody.Method, out List<(MethodDesc, int)> targetBodies))
115_deduplicatedBodies.Add(originalBody.Method, targetBodies = new List<(MethodDesc, int)>());
Compiler\TypePreinit.cs (33)
118private bool TryGetNestedPreinitResult(MethodDesc callingMethod, MetadataType type, Stack<MethodDesc> recursionProtect, ref int instructionCounter, out NestedPreinitResult result)
123recursionProtect ??= new Stack<MethodDesc>();
169private Status TryScanMethod(MethodDesc method, Value[] parameters, Stack<MethodDesc> recursionProtect, ref int instructionCounter, out Value returnValue)
181private Status TryScanMethod(MethodIL methodIL, Value[] parameters, Stack<MethodDesc> recursionProtect, ref int instructionCounter, out Value returnValue)
490MethodDesc method = (MethodDesc)methodIL.GetObject(reader.ReadILToken());
498MethodDesc directMethod = constrainedType.GetClosestDefType().TryResolveConstraintMethodApprox(method.OwningType, method, out bool forceUseRuntimeLookup, ref staticResolution);
544recursionProtect ??= new Stack<MethodDesc>();
562MethodDesc ctor = (MethodDesc)methodIL.GetObject(reader.ReadILToken());
635MethodDesc pointedMethod = methodPointer.PointedToMethod;
700recursionProtect ??= new Stack<MethodDesc>();
1038var method = methodIL.GetObject(reader.ReadILToken()) as MethodDesc;
1890private bool TryHandleIntrinsicCall(MethodDesc method, Value[] parameters, out Value retVal)
1979private static TypeDesc GetArgType(MethodDesc method, int index)
2602private readonly MethodDesc[] _methods;
2606: this(type, new MethodDesc[GetFieldCount(type)], fieldThatOwnsMemory)
2610private VTableLikeStructValue(MetadataType type, MethodDesc[] methods, FieldDesc fieldThatOwnsMemory)
2663foreach (MethodDesc method in _methods)
2680return new VTableLikeStructValue(_type, (MethodDesc[])_methods.Clone(), fieldThatOwnsMemory: null);
2749MethodDesc[] slots = new MethodDesc[GetFieldCount(mdType)];
2783MethodDesc method = _parent._methods[GetFieldIndex(field)];
3051public MethodDesc PointedToMethod { get; }
3053public MethodPointerValue(MethodDesc pointedToMethod)
3262private readonly MethodDesc _methodPointed;
3265public DelegateInstance(TypeDesc delegateType, MethodDesc methodPointed, ReferenceTypeValue firstParameter, AllocationSite allocationSite)
3287MethodDesc targetMethod = creationInfo.PossiblyUnresolvedTargetMethod.GetCanonMethodTarget(CanonicalFormKind.Specific);
3735public static Status Fail(MethodDesc method, ILOpcode opcode, string detail = null)
3740public static Status Fail(MethodDesc method, string detail)
Compiler\UsageBasedMetadataManager.cs (34)
58private readonly List<MethodDesc> _methodsWithMetadata = new List<MethodDesc>();
196protected override MetadataCategory GetMetadataCategory(MethodDesc method)
233out List<MetadataMapping<MethodDesc>> methodMappings,
234out Dictionary<MethodDesc, int> methodMetadataMappings,
244protected override void GetMetadataDependenciesDueToReflectability(IDependencySink dependencies, NodeFactory factory, MethodDesc method)
249public override void AddNativeLayoutMetadataDependencies(DependencySink dependencies, NodeFactory factory, MethodDesc method)
270if (module.GetGlobalModuleType().GetStaticConstructor() is MethodDesc moduleCctor)
306MethodDesc invokeMethod = type.GetMethod("Invoke"u8, null);
320MethodDesc defaultConstructor = elementType.GetDefaultConstructor();
501foreach (MethodDesc method in type.GetMethods())
511MethodDesc reflectedMethod;
541public override void GetDependenciesDueToLdToken(DependencySink dependencies, NodeFactory factory, MethodDesc method)
546MethodDesc canonicalMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific);
559public override void GetConditionalDependenciesDueToDelegateCreation(DependencySink dependencies, NodeFactory factory, TypeDesc delegateType, MethodDesc target)
610public override void GetDependenciesForOverridingMethod(DependencySink dependencies, NodeFactory factory, MethodDesc decl, MethodDesc impl)
627protected override void GetDependenciesDueToMethodCodePresenceInternal(IDependencySink dependencies, NodeFactory factory, MethodDesc method, MethodIL methodIL)
678public override void GetConditionalDependenciesDueToMethodCodePresence(IConditionalDependencySink dependencies, NodeFactory factory, MethodDesc method)
680MethodDesc typicalMethod = method.GetTypicalMethodDefinition();
695MethodDesc method,
773public override void GetDependenciesDueToAccess(IDependencySink dependencies, NodeFactory factory, MethodIL methodIL, MethodDesc calledMethod)
782public override DependencyList GetDependenciesForCustomAttribute(NodeFactory factory, MethodDesc attributeCtor, CustomAttributeValue decodedValue, TypeSystemEntity parent)
805public override void NoteOverridingMethod(MethodDesc baseMethod, MethodDesc overridingMethod, TypeSystemEntity origin)
838public static bool HasMismatchingAttributes(MethodDesc baseMethod, MethodDesc overridingMethod, string requiresAttributeName)
873var reflectableMethods = ReflectableEntityBuilder<MethodDesc>.Create();
874foreach (var methodWithMetadata in _methodsWithMetadata)
879foreach (var method in GetReflectableMethods())
890MethodDesc typicalMethod = method.GetTypicalMethodDefinition();
931if (FlowAnnotations.CompilerGeneratedState.TryGetUserMethodForCompilerGeneratedMember(methodILDefinition.OwningMethod, out var userMethod))
1019public bool GeneratesMetadata(MethodDesc methodDef)
1059public bool IsBlocked(MethodDesc methodDef)
IL\ILImporter.Scanner.cs (53)
34private readonly MethodDesc _canonMethod;
84public ILImporter(ILScanner compilation, MethodDesc method, MethodIL methodIL = null)
113MethodDesc sharedMethod = method.GetSharedRuntimeFormMethodTarget();
146MethodDesc method = _methodIL.OwningMethod;
168MethodDesc method = _methodIL.OwningMethod;
221private ISymbolNode GetGenericLookupHelper(ReadyToRunHelperId helperId, MethodDesc method)
333private IMethodNode GetMethodEntrypoint(MethodDesc method)
392|| !IsTaskConfigureAwait((MethodDesc)_methodIL.GetObject(reader.ReadILToken()))
404&& IsAsyncHelpersAwait((MethodDesc)_methodIL.GetObject(reader.ReadILToken()));
492if (!IsValueTaskAsTask((MethodDesc)_methodIL.GetObject(callToken)))
512MethodDesc ctorMethod = (MethodDesc)_methodIL.GetObject(ctorToken);
546var runtimeDeterminedMethod = (MethodDesc)_methodIL.GetObject(token);
547var method = (MethodDesc)_canonMethodIL.GetObject(token);
578MethodDesc asyncVariantMethod = _factory.TypeSystemContext.GetAsyncVariantMethod(method);
579MethodDesc asyncVariantRuntimeDeterminedMethod = _factory.TypeSystemContext.GetAsyncVariantMethod(runtimeDeterminedMethod);
587private void ImportCall(ILOpcode opcode, MethodDesc method, MethodDesc runtimeDeterminedMethod)
669MethodDesc ctor = Compilation.GetConstructorForCreateInstanceIntrinsic(type);
730MethodDesc runtimeDeterminedTarget = null;
732MethodDesc methodAfterConstraintResolution = method;
757MethodDesc directMethod = constrained.GetClosestDefType().TryResolveConstraintMethodApprox(method.OwningType, method, out forceUseRuntimeLookup, ref staticResolution);
793MethodDesc targetMethod = methodAfterConstraintResolution;
841MethodDesc targetForDelegate = !resolvedConstraint || forceUseRuntimeLookup ? runtimeDeterminedMethod : targetMethod;
895MethodDesc concreteMethod = targetMethod;
1003MethodDesc methodToLookup = _compilation.GetTargetOfGenericVirtualMethodCall(runtimeDeterminedMethod);
1033MethodDesc slotDefiningMethod = targetMethod.IsNewSlot ?
1046var ctorMethod = (MethodDesc)_methodIL.GetObject(ctorToken);
1099private void RegisterDependenciesOnAwaitAwaiterInContinuation(MethodDesc runtimeDeterminedMethod, bool isUnsafe, string reason)
1124MethodDesc runtimeDeterminedResult = asyncHelpers
1128MethodDesc targetMethod = runtimeDeterminedResult.GetCanonMethodTarget(CanonicalFormKind.Specific);
1169MethodDesc stub = _compilation.PInvokeILProvider.GetCalliStub(
1222&& _methodIL.GetObject(reader.ReadILToken()) is MethodDesc { IsIntrinsic: true } intrinsicMethod
1357else if (obj is MethodDesc method)
1359_factory.MetadataManager.GetDependenciesDueToAccess(_dependencies, _factory, _methodIL, (MethodDesc)_canonMethodIL.GetObject(token));
1836private static bool IsTypeGetTypeFromHandle(MethodDesc method)
1850private static bool IsActivatorDefaultConstructorOf(MethodDesc method)
1864private static bool IsActivatorAllocatorOf(MethodDesc method)
1878private static bool IsEETypePtrOf(MethodDesc method)
1892private static bool IsRuntimeHelpersIsReferenceOrContainsReferences(MethodDesc method)
1906private static bool IsMemoryMarshalGetArrayDataReference(MethodDesc method)
1920private static bool IsAsyncHelpersAwait(MethodDesc method)
1936private static bool IsAsyncHelpersAwaitAwaiter(MethodDesc method, out bool isUnsafe)
1960private static bool IsTaskConfigureAwait(MethodDesc method)
1980private static bool IsValueTaskAsTask(MethodDesc method)
1997private static bool IsValueTaskCtor(MethodDesc method)
2040MethodDesc taskReturningMethod = _canonMethod.GetTargetOfAsyncVariant();
2047MethodDesc runtimeDeterminedCaller = _canonMethod.GetSharedRuntimeFormMethodTarget();
2050MethodDesc runtimeDeterminedResult;
2069MethodDesc targetMethod = runtimeDeterminedResult.GetCanonMethodTarget(CanonicalFormKind.Specific);
IL\RvaIntrinsicPatternAnalyzer.cs (9)
161MethodDesc constructor = (MethodDesc)methodIL.GetObject(reader.PeekILToken());
210if (!TryGetCallTarget(opcode, reader, methodIL, out MethodDesc method)
224if (!TryGetCallTarget(opcode, reader, methodIL, out MethodDesc method)
243private static bool TryGetCallTarget(ILOpcode opcode, in ILReader reader, MethodIL methodIL, out MethodDesc method)
246&& methodIL.GetObject(reader.PeekILToken()) is MethodDesc targetMethod)
322private static bool IsRuntimeHelpersInitializeArray(MethodDesc method)
335private static bool IsRuntimeHelpersCreateSpan(MethodDesc method, out TypeDesc elementType)
354private static bool IsRuntimeHelpersIntrinsic(MethodDesc method)
IL\Stubs\StartupCode\StartupCodeMainMethod.cs (12)
22private IReadOnlyCollection<MethodDesc> _libraryInitializers;
25public StartupCodeMainMethod(TypeDesc owningType, MethodDesc mainMethod, IReadOnlyCollection<MethodDesc> libraryInitializers, bool generateLibraryAndModuleInitializers)
76foreach (MethodDesc method in _libraryInitializers)
88MethodDesc initArgs = startup?.GetMethod(initArgsName, null);
97MethodDesc initEntryAssembly = startup?.GetMethod("InitializeEntryAssembly"u8, null);
106MethodDesc initApartmentState = startup?.GetMethod("InitializeApartmentState"u8, null);
123MethodDesc runModuleInitializers = startup?.GetMethod("RunModuleInitializers"u8, null);
143MethodDesc setLatchedExitCode = startup?.GetMethod("SetLatchedExitCode"u8, null);
144MethodDesc shutdown = startup?.GetMethod("Shutdown"u8, null);
210public MainMethodWrapper(TypeDesc owningType, MethodDesc mainMethod)
216public MethodDesc WrappedMethod
parent\parent\Common\Compiler\CachingVirtualMethodAlgorithm.cs (19)
15private readonly ConcurrentDictionary<TypeDesc, (MethodDesc Slot, MethodDesc Implementation)[]> _vtableCache
16= new ConcurrentDictionary<TypeDesc, (MethodDesc Slot, MethodDesc Implementation)[]>();
18private readonly Func<TypeDesc, (MethodDesc Slot, MethodDesc Implementation)[]> _vtableCreator;
23private (MethodDesc Slot, MethodDesc Implementation)[] ComputeVtable(TypeDesc type)
28var result = new ArrayBuilder<(MethodDesc Slot, MethodDesc Implementation)>(3 /* At least Equals/GetHashCode/ToString */);
30foreach (MethodDesc slotDecl in base.ComputeAllVirtualSlots(type))
38public override IEnumerable<MethodDesc> ComputeAllVirtualSlots(TypeDesc type)
46static IEnumerable<MethodDesc> GetCachedSlots(CachingVirtualMethodAlgorithm thisObj, TypeDesc type)
48foreach ((MethodDesc slot, _) in thisObj._vtableCache.GetOrAdd(type.GetTypeDefinition(), thisObj._vtableCreator))
55public override MethodDesc FindVirtualFunctionTargetMethodOnObjectType(MethodDesc targetMethod, TypeDesc objectType)
58MethodDesc targetMethodDefinition = targetMethod.GetMethodDefinition();
60MethodDesc slotDefiningMethod = targetMethodDefinition;
71MethodDesc result = kvp.Implementation;
parent\parent\Common\Compiler\CompilerTypeSystemContext.Async.cs (47)
16public static IEnumerable<MethodDesc> GetAllMethodsAndAsyncVariants(this TypeDesc type)
31private MethodDesc DecomposeAsyncVariant(MethodDesc method, out bool isAsyncVariant)
37private MethodDesc WrapAsAsyncVariant(MethodDesc originalMethod, MethodDesc resolvedMethod)
42MethodDesc asyncVariant = _context.GetAsyncVariantMethod(resolvedMethod);
55public override MethodDesc FindVirtualFunctionTargetMethodOnObjectType(MethodDesc targetMethod, TypeDesc objectType)
58MethodDesc result = base.FindVirtualFunctionTargetMethodOnObjectType(targetMethod, objectType);
65public override DefaultInterfaceMethodResolution ResolveInterfaceMethodToDefaultImplementationOnType(MethodDesc interfaceMethod, TypeDesc currentType, out MethodDesc impl)
75public override MethodDesc ResolveInterfaceMethodToStaticVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
78MethodDesc result = base.ResolveInterfaceMethodToStaticVirtualMethodOnType(interfaceMethod, currentType);
84public override MethodDesc ResolveInterfaceMethodToVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
87MethodDesc result = base.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod, currentType);
93public override DefaultInterfaceMethodResolution ResolveVariantInterfaceMethodToDefaultImplementationOnType(MethodDesc interfaceMethod, TypeDesc currentType, out MethodDesc impl)
102public override MethodDesc ResolveVariantInterfaceMethodToStaticVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
105MethodDesc result = base.ResolveVariantInterfaceMethodToStaticVirtualMethodOnType(interfaceMethod, currentType);
111public override MethodDesc ResolveVariantInterfaceMethodToVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
114MethodDesc result = base.ResolveVariantInterfaceMethodToVirtualMethodOnType(interfaceMethod, currentType);
121public override IEnumerable<MethodDesc> ComputeAllVirtualSlots(TypeDesc type)
127internal static IEnumerable<MethodDesc> WithAsyncVariants(CompilerTypeSystemContext context, IEnumerable<MethodDesc> methods)
129foreach (MethodDesc method in methods)
172public MethodDesc GetTargetOfAsyncVariantMethod(MethodDesc asyncVariantMethod)
175MethodDesc result = asyncMethodVariantDefinition.Target;
191public MethodDesc GetAsyncVariantMethod(MethodDesc taskReturningMethod)
194MethodDesc taskReturningMethodDefinition = taskReturningMethod.GetTypicalMethodDefinition();
195MethodDesc result = _asyncVariantHashtable.GetOrCreateValue((EcmaMethod)taskReturningMethodDefinition);
210public MethodDesc GetTargetOfReturnDroppingThunk(MethodDesc returnDroppingThunk)
214MethodDesc result = returnDroppingThunkDefinition.AsyncVariantTarget;
241public MethodDesc GetReturnDroppingAsyncVariantMethod(MethodDesc asyncVariantMethod)
246MethodDesc typicalMethodDefinition = asyncVariantMethod.GetTypicalMethodDefinition();
247MethodDesc result = _returnDroppingHashtable.GetOrCreateValue((AsyncMethodVariant)typicalMethodDefinition);
273public AsyncResumptionStub GetAsyncResumptionStub(MethodDesc targetMethod, TypeDesc owningType)
280public readonly MethodDesc TargetMethod;
283public AsyncResumptionStubKey(MethodDesc targetMethod, TypeDesc owningType)
parent\parent\Common\Compiler\Dataflow\DynamicallyAccessedMembersBinder.cs (12)
38foreach (var c in typeDefinition.ApplyIncludeInherited(t => t.GetConstructorsOnType(filter: null, bindingFlags: BindingFlags.NonPublic), withInherited))
45foreach (var c in typeDefinition.ApplyIncludeInherited(t => t.GetConstructorsOnType(filter: null, bindingFlags: BindingFlags.Public), withInherited))
51foreach (var c in typeDefinition.GetConstructorsOnType(filter: m => m.IsPublic() && !m.HasMetadataParameters()))
58foreach (var m in typeDefinition.ApplyIncludeInherited(t => t.GetMethodsOnTypeHierarchy(filter: null, bindingFlags: BindingFlags.NonPublic | declaredOnlyFlags), withInherited))
64foreach (var m in typeDefinition.GetMethodsOnTypeHierarchy(filter: null, bindingFlags: BindingFlags.Public | declaredOnlyFlags))
140public static IEnumerable<MethodDesc> GetConstructorsOnType(this TypeDesc type, Func<MethodDesc, bool> filter, BindingFlags? bindingFlags = null)
148foreach (var method in type.GetMethods())
172public static IEnumerable<MethodDesc> GetMethodsOnTypeHierarchy(this TypeDesc type, Func<MethodDesc, bool> filter, BindingFlags? bindingFlags = null)
185foreach (var method in type.GetMethods())
493foreach (var m in type.GetMethods())
parent\parent\Common\Compiler\TypeExtensions.cs (25)
43public static bool RequiresInstArg(this MethodDesc method)
53public static bool RequiresInstMethodDescArg(this MethodDesc method)
62public static bool RequiresInstMethodTableArg(this MethodDesc method)
72public static bool AcquiresInstMethodTableFromThis(this MethodDesc method)
84public static bool IsArrayAddressMethod(this MethodDesc method)
94public static bool IsArrayMethod(this MethodDesc method)
133public static bool IsGenericDepthGreaterThan(this MethodDesc method, int depth)
407public static MethodDesc TryResolveConstraintMethodApprox(this TypeDesc constrainedType, TypeDesc interfaceType, MethodDesc interfaceMethod, out bool forceRuntimeLookup)
419public static MethodDesc TryResolveConstraintMethodApprox(this TypeDesc constrainedType, TypeDesc interfaceType, MethodDesc interfaceMethod, out bool forceRuntimeLookup, ref DefaultInterfaceMethodResolution staticResolution)
469MethodDesc staticMethodDef = interfaceMethod.GetMethodDefinition();
470MethodDesc exactInterfaceMethod = staticMethodDef;
475MethodDesc result = constrainedType.ResolveVariantInterfaceMethodToStaticVirtualMethodOnType(exactInterfaceMethod);
507MethodDesc genInterfaceMethod = interfaceMethod.GetMethodDefinition();
508MethodDesc method = null;
528MethodDesc potentialInterfaceMethod = genInterfaceMethod;
569MethodDesc exactInterfaceMethod = context.GetMethodForInstantiatedType(
592MethodDesc exactInterfaceMethod = genInterfaceMethod;
603MethodDesc targetMethod = interfaceType.FindMethodOnTypeWithMatchingTypicalMethod(genInterfaceMethod);
652public static MethodDesc TryGetRuntimeDeterminedConstrainedMethod(this TypeDesc constrainedType,
653MethodDesc method, Instantiation methodInstantiation)
659MethodDesc result;
819foreach (MethodDesc method in type.GetVirtualMethods())
849public static bool IsRawPInvoke(this MethodDesc method)
parent\parent\Common\TypeSystem\IL\HelperExtensions.cs (8)
30public static MethodDesc GetHelperEntryPoint(this TypeSystemContext context, ReadOnlySpan<byte> typeName, ReadOnlySpan<byte> methodName)
33MethodDesc helperMethod = helperType.GetKnownMethod(methodName, null);
37public static MethodDesc GetCoreLibEntryPoint(this TypeSystemContext context, ReadOnlySpan<byte> namespaceName, ReadOnlySpan<byte> typeName, ReadOnlySpan<byte> methodName, MethodSignature signature)
43public static MethodDesc GetOptionalHelperEntryPoint(this TypeSystemContext context, ReadOnlySpan<byte> typeName, ReadOnlySpan<byte> methodName)
46MethodDesc helperMethod = helperType?.GetMethod(methodName, null);
55public static void EmitCallThrowHelper(this ILCodeStream codeStream, ILEmitter emitter, MethodDesc method)
74public static MethodDesc GetKnownMethod(this TypeDesc type, ReadOnlySpan<byte> name, MethodSignature signature)
76MethodDesc method = type.GetMethod(name, signature);
parent\parent\Common\TypeSystem\Interop\IL\Marshaller.Aot.cs (38)
111var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "AllocMemoryForAnsiCharArray"u8);
123var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "WideCharArrayToAnsiCharArray"u8);
135var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "AnsiCharArrayToWideCharArray"u8);
148var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "WideCharToAnsiChar"u8);
160var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "AnsiCharToWideChar"u8);
209var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, helperMethodName);
221var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, helperMethodName);
236var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, helperMethodName);
560protected abstract MethodDesc GetManagedToNativeHelper();
562protected abstract MethodDesc GetNativeToManagedHelper();
619protected override MethodDesc GetManagedToNativeHelper()
624protected override MethodDesc GetNativeToManagedHelper()
640protected override MethodDesc GetManagedToNativeHelper()
645protected override MethodDesc GetNativeToManagedHelper()
879MethodDesc getNativeSizeHelper = Context.GetHelperEntryPoint("InteropHelpers"u8, "AsAnyGetNativeSize"u8);
984MethodDesc guidCtorHandleMethod =
988MethodDesc helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "ConvertManagedComInterfaceToNative"u8);
998MethodDesc helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "ConvertManagedComInterfaceToIUnknown"u8);
1010MethodDesc helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "ConvertNativeComInterfaceToManaged"u8);
1029var helper = InteropTypes.GetMarshal(Context).GetKnownMethod("FreeBSTR"u8, null);
1037var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "StringToAnsiBstrBuffer"u8);
1048var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "AnsiBstrBufferToString"u8);
1062var helper = InteropTypes.GetMarshal(Context).GetKnownMethod("FreeBSTR"u8, null);
1070var helper = InteropTypes.GetMarshal(Context).GetKnownMethod("StringToBSTR"u8, null);
1081var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "BstrBufferToString"u8);
1095var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "DateTimeToOleDateTime"u8);
1106var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "OleDateTimeToDateTime"u8);
1120var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "DecimalToOleCurrency"u8);
1131var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "OleCurrencyToDecimal"u8);
1171var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "ConvertObjectToVariant"u8);
1186var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "VariantToObject"u8);
1203var helper = Context.GetHelperEntryPoint("InteropHelpers"u8, "CleanupVariant"u8);
1227var getInstanceMethod = marshallerType.GetMethod(
1235var initializeCustomMarshallerMethod = Context.GetHelperEntryPoint("InteropHelpers"u8, "InitializeCustomMarshaller"u8);
1267var manageToNativeMethod = customMarshallerType.GetKnownMethod(
1296var marshalNativeToManagedMethod = customMarshallerType.GetKnownMethod(
1314var cleanupManagedDataMethod = customMarshallerType.GetKnownMethod(
1331var cleanupNativeDataMethod = customMarshallerType.GetKnownMethod(
Compiler\CallChainProfile.cs (21)
43private readonly Dictionary<MethodDesc, Dictionary<MethodDesc, int>> _resolvedProfileData;
64private Dictionary<MethodDesc, Dictionary<MethodDesc, int>> ResolveMethods(Dictionary<string, Dictionary<string, int>> profileData, CompilerTypeSystemContext context)
66var resolvedProfileData = new Dictionary<MethodDesc, Dictionary<MethodDesc, int>>();
67Dictionary<string, MethodDesc> nameToMethodDescMap = new Dictionary<string, MethodDesc>();
72var resolvedKeyMethod = CachedResolveMethodName(nameToMethodDescMap, keyAndMethods.Key, context);
80var resolvedCalledMethod = CachedResolveMethodName(nameToMethodDescMap ,methodAndHitCount.Key, context);
86resolvedProfileData.Add(resolvedKeyMethod, new Dictionary<MethodDesc, int>());
100private MethodDesc CachedResolveMethodName(Dictionary<string, MethodDesc> nameToMethodDescMap, string methodName, CompilerTypeSystemContext context)
102MethodDesc resolvedMethod = null;
126private MethodDesc ResolveMethodName(CompilerTypeSystemContext context, string methodName)
186var resolvedMethod = ResolveMethodName(context, resolvedModule, namespaceAndTypeName, methodNameWithoutType);
207var resolvedMethod = ResolveMethodName(context, module, namespaceAndTypeName, methodNameWithoutType);
228private MethodDesc ResolveMethodName(CompilerTypeSystemContext context, ModuleDesc module, string namespaceAndTypeName, string methodName)
235var resolvedMethod = resolvedType.GetMethod(Encoding.UTF8.GetBytes(methodName), null);
325public IReadOnlyDictionary<MethodDesc, Dictionary<MethodDesc, int>> ResolvedProfileData => _resolvedProfileData;
Compiler\DependencyAnalysis\ReadyToRun\MethodWithGCInfo.cs (15)
47private readonly MethodDesc _method;
63private MethodDesc[] _inlinedMethods;
111public MethodWithGCInfo(MethodDesc methodDesc)
137foreach (var inlinee in _inlinedMethods)
139MethodDesc inlineeDefinition = inlinee.GetTypicalMethodDefinition();
169public MethodDesc Method => _method;
523public void AddRuntimeDeterminedStaticDependencies(DependencySink sink, NodeFactory factory, MethodDesc concreteMethod)
542public void AddRuntimeDeterminedConditionalDependencies(DependencySink sink, NodeFactory factory, MethodDesc concreteMethod)
546private static void AddRuntimeDeterminedDependency(DependencySink sink, NodeFactory factory, MethodDesc concreteMethod, object dependency)
587public MethodDesc[] InlinedMethods => _inlinedMethods;
662MethodDesc methodLayoutAnchor = GetMethodLayoutAnchor(_method, out int methodLayoutRank);
663MethodDesc otherLayoutAnchor = GetMethodLayoutAnchor(otherNode._method, out int otherLayoutRank);
679static MethodDesc GetMethodLayoutAnchor(MethodDesc method, out int layoutRank)
693public void InitializeInliningInfo(MethodDesc[] inlinedMethods, NodeFactory factory)
Compiler\DependencyAnalysis\ReadyToRunCodegenNodeFactory.cs (34)
75public HashSet<MethodDesc> CompiledMethodDefs;
144private NodeCache<MethodDesc, MethodWithGCInfo> _localMethodCache;
146public MethodWithGCInfo CompiledMethodNode(MethodDesc method)
153private bool CanPrecompileUnboxingStub(MethodDesc targetMethod)
175public bool NeedsUnboxingStub(MethodDesc method)
184public DependencyNodeCore<NodeFactory> UnboxingStub(MethodDesc targetMethod)
194MethodDesc thunk = targetMethod.IsSharedByGenericInstantiations && !targetMethod.HasInstantiation
201private WasmUnboxingStubTargetNode CreateWasmUnboxingStubTargetNode(MethodDesc targetMethod)
204MethodDesc thunk = targetMethod.IsSharedByGenericInstantiations && !targetMethod.HasInstantiation
265private NodeCache<MethodDesc, GVMDependenciesNode> _gvmDependenciesNode;
267public GVMDependenciesNode GVMDependencies(MethodDesc method)
270MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific);
271MethodDesc canonSlotMethodDefinition = MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(canonMethod.GetMethodDefinition());
275private NodeCache<MethodDesc, VirtualMethodUseNode> _virtualMethodUseNodes;
277public VirtualMethodUseNode VirtualMethodUse(MethodDesc method)
281MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific);
413_gvmDependenciesNode = new NodeCache<MethodDesc, GVMDependenciesNode>(method =>
423_virtualMethodUseNodes = new NodeCache<MethodDesc, VirtualMethodUseNode>(method =>
495_wasmUnboxingStubTargets = new NodeCache<MethodDesc, WasmUnboxingStubTargetNode>(CreateWasmUnboxingStubTargetNode);
499_localMethodCache = new NodeCache<MethodDesc, MethodWithGCInfo>(key =>
553_copiedMethodIL = new NodeCache<MethodDesc, CopiedMethodILNode>(method =>
690MethodDesc compilableMethod = method.Method.GetCanonMethodTarget(CanonicalFormKind.Specific);
736MethodDesc method = methodNode.Method;
765public HashSet<MethodDesc> BuildCompiledMethodDefsSet()
769var set = new HashSet<MethodDesc>();
898public readonly MethodDesc Method;
900public ILBodyFixupSignatureFixupKey(ReadyToRunFixupKind fixupKind, MethodDesc method)
915public ILBodyFixupSignature ILBodyFixupSignature(ReadyToRunFixupKind fixupKind, MethodDesc method)
1291foreach (MethodDesc method in ProfileDataManager.GetInputProfileDataMethodsForModule(inputModule))
1491private NodeCache<MethodDesc, CopiedMethodILNode> _copiedMethodIL;
1533public bool CanBeInGenericCycle(MethodDesc method)
1538MethodDesc methodDefinition = method.GetTypicalMethodDefinition();
1583private NodeCache<MethodDesc, WasmUnboxingStubTargetNode> _wasmUnboxingStubTargets;
1598public WasmTypeNode WasmTypeNode(MethodDesc method)
Compiler\ProfileData.cs (10)
37public MethodProfileData(MethodDesc method, MethodProfilingDataFlags flags, double exclusiveWeight, Dictionary<MethodDesc, int> callWeights, uint scenarioMask, PgoSchemaElem[] schemaData)
49public readonly MethodDesc Method;
53public readonly Dictionary<MethodDesc, int> CallWeights;
61public abstract MethodProfileData GetMethodProfileData(MethodDesc m);
63public abstract byte[] GetMethodBlockCount(MethodDesc m);
65public static void MergeProfileData(Dictionary<MethodDesc, MethodProfileData> mergedProfileData, ProfileData profileData)
81mergedCallWeights = new Dictionary<MethodDesc, int>(data.CallWeights);
135public override MethodProfileData GetMethodProfileData(MethodDesc m)
145public override byte[] GetMethodBlockCount(MethodDesc m)
Compiler\ProfileDataManager.cs (31)
45Func<MethodDesc, bool> canBeIncludedInCurrentCompilation,
102public IEnumerable<MethodDesc> GetInputProfileDataMethodsForModule(ModuleDesc moduleDesc)
107public bool IsMethodInInputProfileData(MethodDesc method)
112public MethodProfileData this[MethodDesc method]
133public MethodProfileData GetAllowSynthesis(Compilation comp, MethodDesc method, out bool isSynthesized)
176private PgoSchemaElem[] SynthesizeSchema(Compilation comp, MethodDesc method)
198MethodDesc targetMeth = obj as MethodDesc;
264IList<MethodDesc> compatible = _gdvEntityFinder.GetCompatibleWithDelegateInvoke(delegateSignature);
284Debug.Assert(value is MethodDesc or TypeDesc);
285if (value is MethodDesc md)
322private readonly Dictionary<MethodDesc, MethodProfileData> _profileData = new();
323private readonly Dictionary<ModuleDesc, HashSet<MethodDesc>> _placedProfileMethods = new();
324private readonly HashSet<MethodDesc> _placedProfileMethodsAll = new();
332public MethodProfileData this[MethodDesc method]
344foreach ((MethodDesc method, MethodProfileData profileData) in _profileData)
350public bool Contains(MethodDesc md) => _profileData.ContainsKey(md);
352private void AssociateMethodProfileDataWithModule(MethodDesc method, MethodProfileData profileData)
383if (!_placedProfileMethods.TryGetValue(home, out HashSet<MethodDesc> set))
384_placedProfileMethods.Add(home, set = new HashSet<MethodDesc>());
391public IEnumerable<MethodDesc> GetPlacedMethodsForModuleDesc(ModuleDesc moduleDesc)
396return Array.Empty<MethodDesc>();
412private readonly Dictionary<MethodSignature, List<MethodDesc>> _delegateTargets;
417Dictionary<MethodSignature, HashSet<MethodDesc>> delegateTargets = new();
426foreach (MethodDesc method in type.GetMethods())
434if (!delegateTargets.TryGetValue(method.Signature, out HashSet<MethodDesc> set))
435delegateTargets.Add(method.Signature, set = new HashSet<MethodDesc>());
480List<MethodDesc> list = new(kvp.Value);
493public IList<MethodDesc> GetCompatibleWithDelegateInvoke(MethodSignature delegateInvokeSignature)
495return _delegateTargets.TryGetValue(delegateInvokeSignature, out List<MethodDesc> methods) ? methods : Array.Empty<MethodDesc>();
Compiler\ReadyToRunCodegenCompilation.cs (51)
80public bool CanInline(MethodDesc caller, MethodDesc callee)
106MethodDesc calleeMethodImpl = callee.OwningType.FindVirtualFunctionTargetMethodOnObjectType(callee);
118public virtual MethodIL GetMethodIL(MethodDesc method)
128public bool IsEffectivelySealed(MethodDesc method)
133public MethodDesc ResolveVirtualMethod(MethodDesc declMethod, TypeDesc implType, out CORINFO_DEVIRTUALIZATION_DETAIL devirtualizationDetail)
183public sealed class ILCache : LockFreeReaderHashtable<MethodDesc, ILCache.MethodILData>
196protected override int GetKeyHashCode(MethodDesc key)
204protected override bool CompareKeyToValue(MethodDesc key, MethodILData value)
212protected override MethodILData CreateValueFromKey(MethodDesc key)
227public MethodDesc Method;
259public void AddCompilationRoot(MethodDesc method, bool rootMinimalDependencies, string reason, bool isJitHelper = false)
261MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific);
310private readonly Func<MethodDesc, string> _printReproInstructions;
314private readonly HashSet<MethodDesc> _methodsWhichNeedMutableILBodies = new HashSet<MethodDesc>();
316private HashSet<MethodDesc> _directManagedHelpers;
317private HashSet<MethodDesc> _deniedManagedHelpers;
328internal bool IsDirectManagedHelperEligible(MethodDesc method)
333HashSet<MethodDesc> directManagedHelpers = Volatile.Read(ref _directManagedHelpers);
363Func<MethodDesc, string> printReproInstructions,
484HashSet<MethodDesc> compiledMethodDefs = null;
512private void RewriteComponentFile(string inputFile, string outputFile, string ownerExecutableName, HashSet<MethodDesc> compiledMethodDefs)
730public void PrepareForCompilationRetry(MethodWithGCInfo methodToBeRecompiled, IEnumerable<MethodDesc> methodsThatNeedILBodies)
737foreach (var method in methodsThatNeedILBodies)
778var method = methodCodeNodeNeedingCode.Method;
779var typicalDef = method.GetTypicalMethodDefinition();
856void EnsureGeneratedILTokensAreAvailable(MethodDesc method)
920MethodDesc[] mutableMethodBodyNeedList = new MethodDesc[_methodsWhichNeedMutableILBodies.Count];
924Comparison<MethodDesc> comparison = (MethodDesc a, MethodDesc b) => comparer.Compare(a, b);
928foreach (MethodDesc method in mutableMethodBodyNeedList)
949HashSet<MethodDesc> deniedHelpers = new HashSet<MethodDesc>();
956HashSet<MethodDesc> newlyDeniedHelpers = new HashSet<MethodDesc>();
990foreach (MethodDesc method in probeResult.MethodsRequiringILBodies)
1054HashSet<MethodDesc> deniedHelpers)
1056HashSet<MethodDesc> directManagedHelpers = new HashSet<MethodDesc>();
1096private void LogManagedHelperProbeFailure(MethodDesc method, string reason)
1160MethodDesc method = methodCodeNodeNeedingCode.Method;
1212private void EnsureInstantiationReferencesArePresentForExternalMethod(MethodDesc method)
1223private void AddNecessaryAsyncReferences(MethodDesc method)
1248MethodDesc[] requiredMethods =
1292private void AddNecessaryDelegateCtorReferences(MethodDesc method)
1303MethodDesc[] requiredMethods =
1334public string GetReproInstructions(MethodDesc method)
Compiler\ReadyToRunCompilationModuleGroupBase.cs (30)
56private readonly ConcurrentDictionary<MethodDesc, bool> _versionsWithMethodCache = new ConcurrentDictionary<MethodDesc, bool>();
57private readonly Func<MethodDesc, bool> _versionsWithMethodUncached;
58private readonly ConcurrentDictionary<MethodDesc, bool> _crossModuleInlineableCache = new ConcurrentDictionary<MethodDesc, bool>();
59private readonly Func<MethodDesc, bool> _crossModuleInlineableCacheUncached;
62private readonly ConcurrentDictionary<MethodDesc, bool> _crossModuleCompilableCache = new ConcurrentDictionary<MethodDesc, bool>();
63private readonly Func<MethodDesc, bool> _crossModuleCompilableCacheUncached;
110public bool IsDirectPInvoke(MethodDesc method)
136private static string GetEntryPointName(MethodDesc method) => method.GetPInvokeMethodMetadata().Name ?? method.GetName();
140var methodsByEntryPoint = new Dictionary<string, List<MethodDesc>>(StringComparer.Ordinal);
143MethodDesc method = module.GetMethod(handle);
153if (!methodsByEntryPoint.TryGetValue(entryPoint, out List<MethodDesc> methods))
159foreach ((string entryPoint, List<MethodDesc> methods) in methodsByEntryPoint)
175public sealed override bool ContainsMethodBody(MethodDesc method, bool unboxingStub)
193protected abstract bool ContainsMethodBodyCore(MethodDesc method, bool unboxingStub);
211protected bool CompileVersionBubbleGenericsIntoCurrentModule(MethodDesc method)
476public sealed override bool VersionsWithMethodBody(MethodDesc method)
481private bool VersionsWithMethodUncached(MethodDesc method)
497public sealed override bool CanInline(MethodDesc callerMethod, MethodDesc calleeMethod)
514public bool IsNonVersionableWithILTokensThatDoNotNeedTranslation(MethodDesc method)
522public override bool CrossModuleCompileable(MethodDesc method)
530private bool CrossModuleCompileableUncached(MethodDesc method)
597public override bool CrossModuleInlineable(MethodDesc method)
606private bool CrossModuleInlineableInternal(MethodDesc method)
611private bool CrossModuleInlineableUncached(MethodDesc method)
798public sealed override bool GeneratesPInvoke(MethodDesc method)
982entityDefinitionInstantiation = ((MethodDesc)entityWithInstantiation).GetTypicalMethodDefinition().Instantiation;
JitInterface\CorInfoImpl.ReadyToRun.cs (86)
143public readonly MethodDesc Method;
150public MethodWithToken(MethodDesc method, ModuleToken token, TypeDesc constrainedType, bool unboxing, TypeSystemEntity genericContextObject, TypeDesc devirtualizedMethodOwner = null, bool forceOwningTypeFromMethodDesc = false)
153Debug.Assert(genericContextObject is null or MethodDesc or TypeDesc);
218if (genericContextObject is MethodDesc methodContext)
438public TypeDesc ContextType { get { return (Context is MethodDesc contextAsMethod ? contextAsMethod.OwningType : (TypeDesc)Context); } }
440public MethodDesc ContextMethod { get { return (MethodDesc)Context; } }
455if (Context is MethodDesc contextAsMethod)
480MethodDesc[] methodsRequiringILBodies)
485public MethodDesc[] MethodsRequiringILBodies { get; } = methodsRequiringILBodies;
496private HashSet<MethodDesc> _inlinedMethods;
500private List<MethodDesc> _ilBodiesNeeded;
502private HashSet<MethodDesc> _synthesizedPgoDependencies;
538MethodDesc asyncResumptionStub = _compilation.TypeSystemContext.GetAsyncResumptionStub(MethodBeingCompiled, MethodBeingCompiled.OwningType);
570public static bool ShouldSkipCompilation(InstructionSetSupport instructionSetSupport, MethodDesc methodNeedingCode, ReadyToRunCodegenCompilation compilation = null)
613public static bool ShouldCodeNotBeCompiledIntoFinalImage(InstructionSetSupport instructionSetSupport, MethodDesc method)
728private static ConditionalWeakTable<MethodDesc, DeterminismData> _determinismTable = new ConditionalWeakTable<MethodDesc, DeterminismData>();
793public static bool IsMethodCompilable(Compilation compilation, MethodDesc method, bool isJitHelper)
817public ManagedHelperProbeResult ProbeManagedHelper(MethodDesc method, Logger logger)
871var typicalDef = MethodBeingCompiled.GetTypicalMethodDefinition();
902_ilBodiesNeeded = _ilBodiesNeeded ?? new List<MethodDesc>();
928MethodDesc[] methodsRequiringILBodies = _ilBodiesNeeded is null ? null : [.. _ilBodiesNeeded];
1066MethodDesc targetMethodDesc = HandleToObject(pTargetMethod.hMethod);
1113private void AddManagedHelperDependency(MethodDesc helperMethod)
1127private ISymbolNode GetHelperFtnUncached(CorInfoHelpFunc ftnNum, out MethodDesc helperMethod)
1129MethodDesc managedHelper = ReadyToRunJitHelperRootProvider.GetManagedHelper(
1494var method = HandleToObject(ftn);
1514MethodDesc targetMethod = HandleToObject(targetMethodHnd);
1515MethodDesc delegateInvoke = HandleToObject(clsHnd).GetKnownMethod("Invoke"u8, null);
1535private MethodWithToken ComputeMethodWithToken(MethodDesc method, ref CORINFO_RESOLVED_TOKEN pResolvedToken, TypeDesc constrainedType, bool unboxing)
1550ModuleToken _HandleToModuleToken(ref CORINFO_RESOLVED_TOKEN pResolvedToken, MethodDesc methodDesc, out TypeSystemEntity context, ref TypeDesc constrainedType, out bool strippedInstantiation)
1610if (resultDef is MethodDesc resultMethod)
1617var primaryMethod = resultMethod.GetPrimaryMethodDesc();
1939MethodDesc callerMethod = HandleToObject(callerHandle);
2103out MethodDesc methodToCall,
2104out MethodDesc targetMethod,
2106out MethodDesc originalMethod,
2108out MethodDesc callerMethod,
2136MethodDesc versioningCallerMethod = _compilation.TypeSystemContext.IsUnboxingThunk(callerMethod)
2180MethodDesc methodAfterConstraintResolution = originalMethod;
2195MethodDesc methodOnUnderlyingType = constrainedType.UnderlyingType.FindVirtualFunctionTargetMethodOnObjectType(originalMethod);
2203MethodDesc directMethod = constrainedType.TryResolveConstraintMethodApprox(exactType, originalMethod, out forceUseRuntimeLookup, ref dimResolution);
2295var rawMethod = (MethodDesc)methodIL.GetMethodILScopeDefinition().GetObject((int)pResolvedToken.token);
2387MethodDesc canonMethod = (isArrayConstructor ? null : targetMethod.GetCanonMethodTarget(CanonicalFormKind.Specific));
2591MethodDesc method = HandleToObject(ftn);
2596private void PrepareForUseAsAFunctionPointer(MethodDesc method)
2647private void UpdateConstLookupWithRequiresRuntimeJitSymbolIfNeeded(ref CORINFO_CONST_LOOKUP constLookup, MethodDesc method)
2669MethodDesc methodToCall;
2670MethodDesc targetMethod;
2672MethodDesc originalMethod;
2674MethodDesc callerMethod;
2784MethodDesc nonUnboxingMethod = methodToCall;
2812MethodDesc compilableTarget = nonUnboxingMethod.GetCanonMethodTarget(CanonicalFormKind.Specific);
2897MethodDesc canonMethod = targetMethod.GetCanonMethodTarget(CanonicalFormKind.Specific);
2980MethodDesc templateMethod,
2981MethodDesc callerHandle,
2999MethodDesc contextMethod = callerHandle;
3066if (helperArg is MethodDesc methodDesc)
3069MethodDesc sharedMethod = methodIL.OwningMethod.GetSharedRuntimeFormMethodTarget();
3093HandleToObject(pResolvedToken.hMethod) is MethodDesc declaringMethod &&
3130MethodDesc templateMethod = null;
3134MethodDesc md = HandleToObject(pResolvedToken.hMethod);
3166MethodDesc declaringMethod = HandleToObject(pResolvedToken.hMethod);
3285MethodDesc md = HandleToObject(pResolvedToken.hMethod);
3319private MethodDesc getUnboxingThunk(MethodDesc method)
3327MethodDesc methodDesc = HandleToObject(handle);
3346private void PreventRecursiveFieldInlinesOutsideVersionBubble(FieldDesc field, MethodDesc callerMethod)
3356private void EncodeFieldBaseOffset(FieldDesc field, ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_FIELD_INFO* pResult, MethodDesc callerMethod)
3564: _compilation.NodeFactory.CompiledMethodNode((MethodDesc)targetObject);
3661MethodDesc methodDesc = HandleToObject(method);
3689var method = HandleToObject(handle);
3824private readonly Stack<HashSet<MethodDesc>> _stashedInlinedMethods = new Stack<HashSet<MethodDesc>>();
3842MethodDesc inlinee = HandleToObject(inlineeHnd);
3872HashSet<MethodDesc> previouslyStashedInlinees = _stashedInlinedMethods.Pop();
3875previouslyStashedInlinees = previouslyStashedInlinees ?? new HashSet<MethodDesc>();
3876foreach (var inlineeInHashSet in _inlinedMethods)
3881_inlinedMethods = _inlinedMethods ?? new HashSet<MethodDesc>();
3885var typicalMethod = inlinee.GetTypicalMethodDefinition();
3892_ilBodiesNeeded = _ilBodiesNeeded ?? new List<MethodDesc>();
3925_ilBodiesNeeded = _ilBodiesNeeded ?? new List<MethodDesc>();
4087MethodDesc method = HandleToObject(ftn);
4117MethodDesc method = methodHandle is null ? null : HandleToObject(methodHandle);
ObjectWriter\ProfileFileBuilder.cs (9)
33public readonly MethodDesc Caller;
36public readonly MethodDesc Callee;
42public CallInfo(MethodDesc caller, OutputNode callerNode, int callerRVA, MethodDesc callee, OutputNode calleeNode, int calleeRVA, int callCount, CrossPageCall callType)
60private Dictionary<MethodDesc, ISymbolDefinitionNode> _symbolMethodMap;
135_symbolMethodMap = new Dictionary<MethodDesc, ISymbolDefinitionNode>();
153foreach (KeyValuePair<MethodDesc, Dictionary<MethodDesc, int>> kvpCallerCalleeCount in _callChainProfile.ResolvedProfileData)
163foreach (KeyValuePair<MethodDesc, int> kvpCalleeCount in kvpCallerCalleeCount.Value)
parent\parent\Common\Compiler\CachingVirtualMethodAlgorithm.cs (19)
15private readonly ConcurrentDictionary<TypeDesc, (MethodDesc Slot, MethodDesc Implementation)[]> _vtableCache
16= new ConcurrentDictionary<TypeDesc, (MethodDesc Slot, MethodDesc Implementation)[]>();
18private readonly Func<TypeDesc, (MethodDesc Slot, MethodDesc Implementation)[]> _vtableCreator;
23private (MethodDesc Slot, MethodDesc Implementation)[] ComputeVtable(TypeDesc type)
28var result = new ArrayBuilder<(MethodDesc Slot, MethodDesc Implementation)>(3 /* At least Equals/GetHashCode/ToString */);
30foreach (MethodDesc slotDecl in base.ComputeAllVirtualSlots(type))
38public override IEnumerable<MethodDesc> ComputeAllVirtualSlots(TypeDesc type)
46static IEnumerable<MethodDesc> GetCachedSlots(CachingVirtualMethodAlgorithm thisObj, TypeDesc type)
48foreach ((MethodDesc slot, _) in thisObj._vtableCache.GetOrAdd(type.GetTypeDefinition(), thisObj._vtableCreator))
55public override MethodDesc FindVirtualFunctionTargetMethodOnObjectType(MethodDesc targetMethod, TypeDesc objectType)
58MethodDesc targetMethodDefinition = targetMethod.GetMethodDefinition();
60MethodDesc slotDefiningMethod = targetMethodDefinition;
71MethodDesc result = kvp.Implementation;
parent\parent\Common\Compiler\CompilerTypeSystemContext.Async.cs (47)
16public static IEnumerable<MethodDesc> GetAllMethodsAndAsyncVariants(this TypeDesc type)
31private MethodDesc DecomposeAsyncVariant(MethodDesc method, out bool isAsyncVariant)
37private MethodDesc WrapAsAsyncVariant(MethodDesc originalMethod, MethodDesc resolvedMethod)
42MethodDesc asyncVariant = _context.GetAsyncVariantMethod(resolvedMethod);
55public override MethodDesc FindVirtualFunctionTargetMethodOnObjectType(MethodDesc targetMethod, TypeDesc objectType)
58MethodDesc result = base.FindVirtualFunctionTargetMethodOnObjectType(targetMethod, objectType);
65public override DefaultInterfaceMethodResolution ResolveInterfaceMethodToDefaultImplementationOnType(MethodDesc interfaceMethod, TypeDesc currentType, out MethodDesc impl)
75public override MethodDesc ResolveInterfaceMethodToStaticVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
78MethodDesc result = base.ResolveInterfaceMethodToStaticVirtualMethodOnType(interfaceMethod, currentType);
84public override MethodDesc ResolveInterfaceMethodToVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
87MethodDesc result = base.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod, currentType);
93public override DefaultInterfaceMethodResolution ResolveVariantInterfaceMethodToDefaultImplementationOnType(MethodDesc interfaceMethod, TypeDesc currentType, out MethodDesc impl)
102public override MethodDesc ResolveVariantInterfaceMethodToStaticVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
105MethodDesc result = base.ResolveVariantInterfaceMethodToStaticVirtualMethodOnType(interfaceMethod, currentType);
111public override MethodDesc ResolveVariantInterfaceMethodToVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
114MethodDesc result = base.ResolveVariantInterfaceMethodToVirtualMethodOnType(interfaceMethod, currentType);
121public override IEnumerable<MethodDesc> ComputeAllVirtualSlots(TypeDesc type)
127internal static IEnumerable<MethodDesc> WithAsyncVariants(CompilerTypeSystemContext context, IEnumerable<MethodDesc> methods)
129foreach (MethodDesc method in methods)
172public MethodDesc GetTargetOfAsyncVariantMethod(MethodDesc asyncVariantMethod)
175MethodDesc result = asyncMethodVariantDefinition.Target;
191public MethodDesc GetAsyncVariantMethod(MethodDesc taskReturningMethod)
194MethodDesc taskReturningMethodDefinition = taskReturningMethod.GetTypicalMethodDefinition();
195MethodDesc result = _asyncVariantHashtable.GetOrCreateValue((EcmaMethod)taskReturningMethodDefinition);
210public MethodDesc GetTargetOfReturnDroppingThunk(MethodDesc returnDroppingThunk)
214MethodDesc result = returnDroppingThunkDefinition.AsyncVariantTarget;
241public MethodDesc GetReturnDroppingAsyncVariantMethod(MethodDesc asyncVariantMethod)
246MethodDesc typicalMethodDefinition = asyncVariantMethod.GetTypicalMethodDefinition();
247MethodDesc result = _returnDroppingHashtable.GetOrCreateValue((AsyncMethodVariant)typicalMethodDefinition);
273public AsyncResumptionStub GetAsyncResumptionStub(MethodDesc targetMethod, TypeDesc owningType)
280public readonly MethodDesc TargetMethod;
283public AsyncResumptionStubKey(MethodDesc targetMethod, TypeDesc owningType)
parent\parent\Common\Compiler\Dataflow\DynamicallyAccessedMembersBinder.cs (12)
38foreach (var c in typeDefinition.ApplyIncludeInherited(t => t.GetConstructorsOnType(filter: null, bindingFlags: BindingFlags.NonPublic), withInherited))
45foreach (var c in typeDefinition.ApplyIncludeInherited(t => t.GetConstructorsOnType(filter: null, bindingFlags: BindingFlags.Public), withInherited))
51foreach (var c in typeDefinition.GetConstructorsOnType(filter: m => m.IsPublic() && !m.HasMetadataParameters()))
58foreach (var m in typeDefinition.ApplyIncludeInherited(t => t.GetMethodsOnTypeHierarchy(filter: null, bindingFlags: BindingFlags.NonPublic | declaredOnlyFlags), withInherited))
64foreach (var m in typeDefinition.GetMethodsOnTypeHierarchy(filter: null, bindingFlags: BindingFlags.Public | declaredOnlyFlags))
140public static IEnumerable<MethodDesc> GetConstructorsOnType(this TypeDesc type, Func<MethodDesc, bool> filter, BindingFlags? bindingFlags = null)
148foreach (var method in type.GetMethods())
172public static IEnumerable<MethodDesc> GetMethodsOnTypeHierarchy(this TypeDesc type, Func<MethodDesc, bool> filter, BindingFlags? bindingFlags = null)
185foreach (var method in type.GetMethods())
493foreach (var m in type.GetMethods())
parent\parent\Common\Compiler\TypeExtensions.cs (25)
43public static bool RequiresInstArg(this MethodDesc method)
53public static bool RequiresInstMethodDescArg(this MethodDesc method)
62public static bool RequiresInstMethodTableArg(this MethodDesc method)
72public static bool AcquiresInstMethodTableFromThis(this MethodDesc method)
84public static bool IsArrayAddressMethod(this MethodDesc method)
94public static bool IsArrayMethod(this MethodDesc method)
133public static bool IsGenericDepthGreaterThan(this MethodDesc method, int depth)
407public static MethodDesc TryResolveConstraintMethodApprox(this TypeDesc constrainedType, TypeDesc interfaceType, MethodDesc interfaceMethod, out bool forceRuntimeLookup)
419public static MethodDesc TryResolveConstraintMethodApprox(this TypeDesc constrainedType, TypeDesc interfaceType, MethodDesc interfaceMethod, out bool forceRuntimeLookup, ref DefaultInterfaceMethodResolution staticResolution)
469MethodDesc staticMethodDef = interfaceMethod.GetMethodDefinition();
470MethodDesc exactInterfaceMethod = staticMethodDef;
475MethodDesc result = constrainedType.ResolveVariantInterfaceMethodToStaticVirtualMethodOnType(exactInterfaceMethod);
507MethodDesc genInterfaceMethod = interfaceMethod.GetMethodDefinition();
508MethodDesc method = null;
528MethodDesc potentialInterfaceMethod = genInterfaceMethod;
569MethodDesc exactInterfaceMethod = context.GetMethodForInstantiatedType(
592MethodDesc exactInterfaceMethod = genInterfaceMethod;
603MethodDesc targetMethod = interfaceType.FindMethodOnTypeWithMatchingTypicalMethod(genInterfaceMethod);
652public static MethodDesc TryGetRuntimeDeterminedConstrainedMethod(this TypeDesc constrainedType,
653MethodDesc method, Instantiation methodInstantiation)
659MethodDesc result;
819foreach (MethodDesc method in type.GetVirtualMethods())
849public static bool IsRawPInvoke(this MethodDesc method)
parent\parent\Common\JitInterface\CorInfoImpl.cs (82)
81private Dictionary<MethodDesc, PgoInstrumentationResults> _pgoResults = new Dictionary<MethodDesc, PgoInstrumentationResults>();
319MethodDesc method = (MethodDesc)handleToObject[likelyClassMethods->handle];
586MethodDesc[] inlineeArray;
589inlineeArray = new MethodDesc[_inlinedMethods.Count];
595inlineeArray = Array.Empty<MethodDesc>();
704private MethodDesc MethodBeingCompiled
812private Dictionary<MethodDesc, IntPtr> _methodILScopeToHandle = new Dictionary<MethodDesc, IntPtr>(new JitObjectComparer());
848private MethodDesc HandleToObject(CORINFO_METHOD_STRUCT_* method) => (MethodDesc)HandleToObject((void*)method);
849private CORINFO_METHOD_STRUCT_* ObjectToHandle(MethodDesc method) => (CORINFO_METHOD_STRUCT_*)ObjectToHandle((object)method);
862MethodDesc owningMethod = methodIL.OwningMethod;
868private bool Get_CORINFO_METHOD_INFO(MethodDesc method, MethodIL methodIL, CORINFO_METHOD_INFO* methodInfo)
937private void Get_CORINFO_SIG_INFO(MethodDesc method, CORINFO_SIG_INFO* sig, MethodILScope scope, bool suppressHiddenArgument = false)
1102private CORINFO_CONTEXT_STRUCT* contextFromMethod(MethodDesc method)
1117private MethodDesc methodFromContext(CORINFO_CONTEXT_STRUCT* contextStruct)
1163MethodDesc method = HandleToObject(ftn);
1169MethodDesc method = HandleToObject(ftn);
1208private uint getMethodAttribsInternal(MethodDesc method)
1329MethodDesc caller = HandleToObject(callerHnd);
1351MethodDesc callee = exactCalleeHnd == null ? null : HandleToObject(exactCalleeHnd);
1363MethodDesc method = HandleToObject(ftn);
1396MethodDesc method = HandleToObject(ftn);
1401if (ctx is MethodDesc methodFromCtx && context != contextFromMethodBeingCompiled())
1408MethodDesc instantiatedMethod = _compilation.TypeSystemContext.GetMethodForInstantiatedType(method.GetTypicalMethodDefinition(), instantiatedCtxType);
1430MethodDesc meth1 = HandleToObject(methHnd1);
1431MethodDesc meth2 = HandleToObject(methHnd2);
1442MethodDesc callerMethod = HandleToObject(callerHnd);
1443MethodDesc calleeMethod = HandleToObject(calleeHnd);
1518var m = HandleToObject(method);
1539MethodDesc decl = HandleToObject(info->virtualMethod);
1554MethodDesc originalImpl = _compilation.ResolveVirtualMethod(decl, objType, out info->detail);
1577MethodDesc impl = originalImpl.GetCanonMethodTarget(CanonicalFormKind.Specific);
1581MethodDesc nonUnboxingImpl = impl;
1665MethodDesc instArgTarget = unboxingStub ? nonUnboxingImpl : impl;
1747static CORINFO_RESOLVED_TOKEN CreateResolvedTokenFromMethod(CorInfoImpl jitInterface, MethodDesc method
1787MethodDesc method = HandleToObject(ftn);
1880MethodDesc methodDesc = HandleToObject(method);
1892private static CorInfoCallConvExtension GetUnmanagedCallConv(MethodDesc methodDesc, out bool suppressGCTransition)
1976if (result is MethodDesc methodResult)
1994MethodDesc owningMethod = methodIL.OwningMethod;
2015var methodContext = (MethodDesc)typeOrMethodContext;
2058result = _compilation.TypeSystemContext.GetAsyncVariantMethod((MethodDesc)result);
2067if (result is MethodDesc method)
2071MethodDesc sharedMethod = methodIL.OwningMethod.GetSharedRuntimeFormMethodTarget();
2073Debug.Assert(((MethodDesc)result).IsRuntimeDeterminedExactMethod);
2080MethodDesc sharedMethod = methodIL.OwningMethod.GetSharedRuntimeFormMethodTarget();
2090MethodDesc sharedMethod = methodIL.OwningMethod.GetSharedRuntimeFormMethodTarget();
2130if (result is MethodDesc method)
2224private static bool HasCallableAsyncVariant(MethodDesc method)
2265Get_CORINFO_SIG_INFO(((MethodDesc)methodIL.GetObject((int)methTOK)), sig: sig, methodIL);
3031MethodDesc md = method == null ? MethodBeingCompiled : HandleToObject(method);
3816MethodDesc caller = HandleToObject(callerHandle);
3819MethodDesc taskReturningMethod = caller.GetTargetOfAsyncVariant();
3827MethodDesc runtimeDeterminedCaller = caller.GetSharedRuntimeFormMethodTarget();
3830MethodDesc result;
3831MethodDesc runtimeDeterminedResult;
3852MethodDesc targetMethod = runtimeDeterminedResult.GetCanonMethodTarget(CanonicalFormKind.Specific);
3894MethodDesc caller = HandleToObject(callerHandle);
3895MethodDesc awaitAwaiterMethod = HandleToObject(pResolvedToken.hMethod);
3901var runtimeDeterminedAwaitAwaiterMethod = (MethodDesc)GetRuntimeDeterminedObjectForToken(ref pResolvedToken);
3912MethodDesc typicalMethod = asyncHelpers.GetKnownMethod(
3915MethodDesc result = typicalMethod.MakeInstantiatedMethod(awaiterType);
3916MethodDesc runtimeDeterminedResult = typicalMethod.MakeInstantiatedMethod(runtimeDeterminedAwaiterType);
3918MethodDesc targetMethod = runtimeDeterminedResult.GetCanonMethodTarget(CanonicalFormKind.Specific);
3978MethodDesc method = HandleToObject(hMethod);
3985MethodDesc methodDefinition = method.GetTypicalMethodDefinition();
4015MethodDesc method = HandleToObject(ftn);
4019private static string getMethodNameFromMetadataImpl(MethodDesc method, out string className, out string namespaceName, string[] enclosingClassName)
4051MethodDesc method = HandleToObject(ftn);
4216private Dictionary<CorInfoHelpFunc, (ISymbolNode EntryPoint, MethodDesc Method)> _helperCache =
4217new Dictionary<CorInfoHelpFunc, (ISymbolNode EntryPoint, MethodDesc Method)>();
4226if (!_helperCache.TryGetValue(ftnNum, out (ISymbolNode EntryPoint, MethodDesc Method) helper))
4228ISymbolNode entryPoint = GetHelperFtnUncached(ftnNum, out MethodDesc method);
4290private static CORINFO_RUNTIME_LOOKUP_KIND GetGenericRuntimeLookupKind(MethodDesc method)
4305MethodDesc method = HandleToObject(context);
5214MethodDesc methodDesc = HandleToObject(ftnHnd);
5224_synthesizedPgoDependencies = new HashSet<MethodDesc>();
parent\parent\Common\TypeSystem\IL\HelperExtensions.cs (8)
30public static MethodDesc GetHelperEntryPoint(this TypeSystemContext context, ReadOnlySpan<byte> typeName, ReadOnlySpan<byte> methodName)
33MethodDesc helperMethod = helperType.GetKnownMethod(methodName, null);
37public static MethodDesc GetCoreLibEntryPoint(this TypeSystemContext context, ReadOnlySpan<byte> namespaceName, ReadOnlySpan<byte> typeName, ReadOnlySpan<byte> methodName, MethodSignature signature)
43public static MethodDesc GetOptionalHelperEntryPoint(this TypeSystemContext context, ReadOnlySpan<byte> typeName, ReadOnlySpan<byte> methodName)
46MethodDesc helperMethod = helperType?.GetMethod(methodName, null);
55public static void EmitCallThrowHelper(this ILCodeStream codeStream, ILEmitter emitter, MethodDesc method)
74public static MethodDesc GetKnownMethod(this TypeDesc type, ReadOnlySpan<byte> name, MethodSignature signature)
76MethodDesc method = type.GetMethod(name, signature);
PortableCallHelpers\PInvokeCollector.cs (6)
132public void CollectPInvokes(List<PInvokeInfo> pinvokes, List<PInvokeCallback> callbacks, Dictionary<string, MethodDesc> signatures, EcmaType type)
134foreach (MethodDesc methodDesc in type.GetMethods())
161MethodDesc invokeMethod = type.GetMethod("Invoke"u8, null);
188private void CollectUnmanagedCalliSignatures(Dictionary<string, MethodDesc> signatures, EcmaMethod method)
257private void AddSignature(Dictionary<string, MethodDesc> signatures, MethodDesc method, WasmLowering.LoweringFlags flags, string kind)
parent\parent\Common\TypeSystem\Common\MetadataVirtualMethodAlgorithm.cs (134)
14private sealed class MethodDescHashtable : LockFreeReaderHashtable<MethodDesc, MethodDesc>
16protected override int GetKeyHashCode(MethodDesc key)
21protected override int GetValueHashCode(MethodDesc value)
26protected override bool CompareKeyToValue(MethodDesc key, MethodDesc value)
32protected override bool CompareValueToValue(MethodDesc value1, MethodDesc value2)
38protected override MethodDesc CreateValueFromKey(MethodDesc key)
46private MethodDesc[] _members = MethodDesc.EmptyMethods;
49private MethodDesc[] _methodsRequiringSlotUnification = MethodDesc.EmptyMethods;
57private MethodDesc[] _arrayToEnumerate;
59private MethodDesc _current;
61internal Enumerator(MethodDesc[] arrayToEnumerate)
65_current = default(MethodDesc);
80_current = default(MethodDesc);
84public MethodDesc Current
95private readonly MethodDesc[] _arrayToEnumerate;
97public Enumerable(MethodDesc[] arrayToEnumerate)
108public UnificationGroup(MethodDesc definingMethod)
114public MethodDesc DefiningMethod;
120public void AddMethodRequiringSlotUnification(MethodDesc method)
133public bool RequiresSlotUnification(MethodDesc method)
143public void SetDefiningMethod(MethodDesc newDefiningMethod)
151MethodDesc oldDefiningMethod = DefiningMethod;
159public void AddToGroup(MethodDesc method)
182public void RemoveFromGroup(MethodDesc method)
198public bool IsInGroupOrIsDefiningSlot(MethodDesc method)
206public bool IsInGroup(MethodDesc method)
218public override MethodDesc FindVirtualFunctionTargetMethodOnObjectType(MethodDesc targetMethod, TypeDesc objectType)
229private static MethodDesc FindVirtualFunctionTargetMethodOnObjectType(MethodDesc targetMethod, MetadataType objectType)
233MethodDesc initialTargetMethod = targetMethod;
242MethodDesc initialTargetMethodDefinition = targetMethod;
253MethodDesc resolutionTarget = FindNameSigOverrideForVirtualMethod(group.DefiningMethod, uninstantiatedType);
281private static MethodDesc FindImplFromDeclFromMethodImpls(MetadataType type, MethodDesc decl)
293MethodDesc recordDecl = record.Decl;
309private static MethodDesc FindInterfaceImplFromDeclFromMethodImpls(MetadataType type, MethodDesc decl)
322MethodDesc recordDecl = foundMethodImpls[i].Decl;
381private static MethodDesc FindMatchingVirtualMethodOnTypeByNameAndSig(MethodDesc targetMethod, DefType currentType, bool reverseMethodSearch, Func<MethodDesc, MethodDesc, bool> nameSigMatchMethodIsValidCandidate)
386MethodDesc implMethod = null;
387MethodDesc implMethodEquivalent = null;
388foreach (MethodDesc candidate in currentType.GetAllVirtualMethods())
420private static MethodDesc FindNameSigOverrideForVirtualMethod(MethodDesc targetMethod, MetadataType currentType)
424MethodDesc nameSigOverride = FindMatchingVirtualMethodOnTypeByNameAndSigWithSlotCheck(targetMethod, currentType, reverseMethodSearch:true);
440public static MethodDesc FindSlotDefiningMethodForVirtualMethod(MethodDesc method)
452MethodDesc foundMethod = FindMatchingVirtualMethodOnTypeByNameAndSig(method, currentType, reverseMethodSearch: true, nameSigMatchMethodIsValidCandidate:null);
476private static MethodDesc FindMatchingVirtualMethodOnTypeByNameAndSigWithSlotCheck(MethodDesc method, DefType currentType, bool reverseMethodSearch)
481private static readonly Func<MethodDesc, MethodDesc, bool> s_VerifyMethodsHaveTheSameVirtualSlot = VerifyMethodsHaveTheSameVirtualSlot;
484private static bool VerifyMethodsHaveTheSameVirtualSlot(MethodDesc slotDefiningMethod, MethodDesc methodToVerify)
486MethodDesc slotDefiningMethodOfMethodToVerify = FindSlotDefiningMethodForVirtualMethod(methodToVerify);
490private static readonly Func<MethodDesc, MethodDesc, bool> s_VerifyMethodIsPublic = VerifyMethodIsPublic;
493private static bool VerifyMethodIsPublic(MethodDesc slotDefiningMethod, MethodDesc methodToVerify)
500MethodDesc originalDefiningMethod = unificationGroup.DefiningMethod;
502MethodDesc methodImpl = FindImplFromDeclFromMethodImpls(currentType, unificationGroup.DefiningMethod);
513MethodDesc nameSigMatchMethod = FindMatchingVirtualMethodOnTypeByNameAndSigWithSlotCheck(unificationGroup.DefiningMethod, currentType, reverseMethodSearch: true);
550foreach (MethodDesc memberMethod in unificationGroup.Members)
557MethodDesc nameSigMatchMemberMethod = FindMatchingVirtualMethodOnTypeByNameAndSigWithSlotCheck(memberMethod, currentType, reverseMethodSearch: true);
567foreach (MethodDesc separatedMethod in MethodDescHashtable.Enumerator.Get(separatedMethods))
576MethodDesc declSlot = FindSlotDefiningMethodForVirtualMethod(methodImplRecord.Decl);
577MethodDesc implSlot = FindSlotDefiningMethodForVirtualMethod(methodImplRecord.Body);
611foreach (MethodDesc methodImplRequiredToRemainInEffect in addDeclGroup.MethodsRequiringSlotUnification)
623foreach (MethodDesc addDeclGroupMemberMethod in addDeclGroup.Members)
653public override MethodDesc ResolveInterfaceMethodToVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
658public override MethodDesc ResolveVariantInterfaceMethodToVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
663public override MethodDesc ResolveInterfaceMethodToStaticVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
668public override MethodDesc ResolveVariantInterfaceMethodToStaticVirtualMethodOnType(MethodDesc interfaceMethod, TypeDesc currentType)
698private static MethodDesc ResolveInterfaceMethodToVirtualMethodOnType(MethodDesc interfaceMethod, MetadataType currentType, bool returnRecursive = false)
707MethodDesc methodImpl = FindImplFromDeclFromMethodImpls(currentType, interfaceMethod);
719MethodDesc foundOnCurrentType = FindMatchingVirtualMethodOnTypeByNameAndSig(interfaceMethod, currentType,
750MethodDesc baseClassImplementationOfInterfaceMethod = ResolveInterfaceMethodToVirtualMethodOnTypeRecursive(interfaceMethod, baseType);
757MethodDesc foundOnCurrentType = FindMatchingVirtualMethodOnTypeByNameAndSig(interfaceMethod, currentType,
771public static MethodDesc ResolveVariantInterfaceMethodToVirtualMethodOnType(MethodDesc interfaceMethod, MetadataType currentType)
777MethodDesc implMethod;
802private static MethodDesc ResolveInterfaceMethodToVirtualMethodOnTypeRecursive(MethodDesc interfaceMethod, MetadataType currentType)
817MethodDesc currentTypeInterfaceResolution = ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod, currentType, returnRecursive: true);
826private static MethodDesc FindNameSigOverrideForInterfaceMethodRecursive(MethodDesc interfaceMethod, MetadataType currentType)
833MethodDesc nameSigOverride = FindMatchingVirtualMethodOnTypeByNameAndSig(interfaceMethod, currentType,
846public override DefaultInterfaceMethodResolution ResolveInterfaceMethodToDefaultImplementationOnType(MethodDesc interfaceMethod, TypeDesc currentType, out MethodDesc impl)
851public override DefaultInterfaceMethodResolution ResolveVariantInterfaceMethodToDefaultImplementationOnType(MethodDesc interfaceMethod, TypeDesc currentType, out MethodDesc impl)
856public static DefaultInterfaceMethodResolution ResolveVariantInterfaceMethodToDefaultImplementationOnType(MethodDesc interfaceMethod, MetadataType currentType, out MethodDesc impl)
867MethodDesc interfaceMethod,
870out MethodDesc candidateMD)
873MethodDesc interfaceMethodDefinition = interfaceMethod.GetMethodDefinition();
929MethodDesc interfaceMethod,
932out MethodDesc impl)
935MethodDesc interfaceMethodDefinition = interfaceMethod.GetMethodDefinition();
951MethodDesc[] candidateMethods = new MethodDesc[consideredInterfaces.Length];
971if (!TryGetCandidateImplementation(currentMT, interfaceMethod, interfaceMT, allowVariance, out MethodDesc currentMD))
1044MethodDesc bestCandidateMD = null;
1083public override IEnumerable<MethodDesc> ComputeAllVirtualSlots(TypeDesc type)
1089public static IEnumerable<MethodDesc> EnumAllVirtualSlots(MetadataType type)
1093private static IEnumerable<MethodDesc> EnumAllVirtualSlotsOnClass(MetadataType type)
1098foreach (MethodDesc m in type.GetAllVirtualMethods())
1100MethodDesc possibleVirtual = FindSlotDefiningMethodForVirtualMethod(m);
1118public static MethodDesc ResolveInterfaceMethodToStaticVirtualMethodOnType(MethodDesc interfaceMethod, MetadataType currentType)
1128MethodDesc resolvedMethodOnType = TryResolveVirtualStaticMethodOnThisType(typeToCheck, interfaceMethod);
1143public static MethodDesc ResolveVariantInterfaceMethodToStaticVirtualMethodOnType(MethodDesc interfaceMethod, MetadataType currentType)
1150MethodDesc resolvedMethodOnType = TryResolveVirtualStaticMethodOnThisType(typeToCheck, interfaceMethod);
1175MethodDesc runtimeInterfaceMethod = runtimeInterfaceType.FindMethodOnExactTypeWithMatchingTypicalMethod(interfaceMethod);
1193private static MethodDesc TryResolveVirtualStaticMethodOnThisType(MetadataType constrainedType, MethodDesc interfaceMethod)
1201MethodDesc interfaceMethodDefinition = interfaceMethod.GetMethodDefinition();
1206MethodDesc resolvedMethodImpl = methodImpl.Body;
parent\parent\Common\TypeSystem\Common\TypeSystemHelpers.cs (35)
30public static InstantiatedMethod MakeInstantiatedMethod(this MethodDesc methodDef, Instantiation instantiation)
35public static InstantiatedMethod MakeInstantiatedMethod(this MethodDesc methodDef, params TypeDesc[] genericParameters)
86public static MethodDesc GetParameterlessConstructor(this TypeDesc type)
98internal static MethodDesc FindMethodOnExactTypeWithMatchingTypicalMethod(this TypeDesc type, MethodDesc method)
100MethodDesc methodTypicalDefinition = method.GetTypicalMethodDefinition();
129public static MethodDesc FindMethodOnTypeWithMatchingTypicalMethod(this TypeDesc targetType, MethodDesc method)
152MethodDesc matchingMethod = targetOrBase.FindMethodOnExactTypeWithMatchingTypicalMethod(method);
165public static IEnumerable<MethodDesc> GetAllMethods(this TypeDesc type)
173public static IEnumerable<MethodDesc> GetAllVirtualMethods(this TypeDesc type)
178public static IEnumerable<MethodDesc> EnumAllVirtualSlots(this TypeDesc type)
187public static MethodDesc ResolveInterfaceMethodToVirtualMethodOnType(this TypeDesc type, MethodDesc interfaceMethod)
192public static MethodDesc ResolveVariantInterfaceMethodToVirtualMethodOnType(this TypeDesc type, MethodDesc interfaceMethod)
197public static MethodDesc ResolveInterfaceMethodToStaticVirtualMethodOnType(this TypeDesc type, MethodDesc interfaceMethod)
202public static MethodDesc ResolveVariantInterfaceMethodToStaticVirtualMethodOnType(this TypeDesc type, MethodDesc interfaceMethod)
207public static DefaultInterfaceMethodResolution ResolveInterfaceMethodToDefaultImplementationOnType(this TypeDesc type, MethodDesc interfaceMethod, out MethodDesc implMethod)
212public static DefaultInterfaceMethodResolution ResolveVariantInterfaceMethodToDefaultImplementationOnType(this TypeDesc type, MethodDesc interfaceMethod, out MethodDesc implMethod)
220public static MethodDesc FindVirtualFunctionTargetMethodOnObjectType(this TypeDesc type, MethodDesc targetMethod)
271public static MethodDesc InstantiateAsOpen(this MethodDesc method)
290public static MethodDesc ResolveInterfaceMethodTarget(this TypeDesc thisType, MethodDesc interfaceMethodToResolve)
294MethodDesc result;
310public static MethodDesc ResolveInterfaceMethodTargetWithVariance(this TypeDesc thisType, MethodDesc interfaceMethodToResolve)
314MethodDesc result;
374public static bool RequiresSlotUnification(this MethodDesc method)
parent\parent\Common\TypeSystem\IL\HelperExtensions.cs (8)
30public static MethodDesc GetHelperEntryPoint(this TypeSystemContext context, ReadOnlySpan<byte> typeName, ReadOnlySpan<byte> methodName)
33MethodDesc helperMethod = helperType.GetKnownMethod(methodName, null);
37public static MethodDesc GetCoreLibEntryPoint(this TypeSystemContext context, ReadOnlySpan<byte> namespaceName, ReadOnlySpan<byte> typeName, ReadOnlySpan<byte> methodName, MethodSignature signature)
43public static MethodDesc GetOptionalHelperEntryPoint(this TypeSystemContext context, ReadOnlySpan<byte> typeName, ReadOnlySpan<byte> methodName)
46MethodDesc helperMethod = helperType?.GetMethod(methodName, null);
55public static void EmitCallThrowHelper(this ILCodeStream codeStream, ILEmitter emitter, MethodDesc method)
74public static MethodDesc GetKnownMethod(this TypeDesc type, ReadOnlySpan<byte> name, MethodSignature signature)
76MethodDesc method = type.GetMethod(name, signature);