public static DependencyList GetGenericMethodsHashtableDependenciesForMethod(NodeFactory factory, MethodDesc method) { Debug.Assert(method.HasInstantiation && !method.IsCanonicalMethod(CanonicalFormKind.Any)); DependencyList dependencies = new DependencyList(); // Method's containing type IEETypeNode containingTypeNode = factory.NecessaryTypeSymbol(method.OwningType); dependencies.Add(new DependencyListEntry(containingTypeNode, "GenericMethodsHashtable entry containing type")); // Method's instantiation arguments for (int i = 0; i < method.Instantiation.Length; i++) { IEETypeNode argNode = factory.NecessaryTypeSymbol(method.Instantiation[i]); dependencies.Add(new DependencyListEntry(argNode, "GenericMethodsHashtable entry instantiation argument")); } // Method name and signature NativeLayoutVertexNode nameAndSig = factory.NativeLayout.MethodNameAndSignatureVertex(method.GetTypicalMethodDefinition()); NativeLayoutSavedVertexNode placedNameAndSig = factory.NativeLayout.PlacedSignatureVertex(nameAndSig); dependencies.Add(new DependencyListEntry(placedNameAndSig, "GenericMethodsHashtable entry signature")); GenericDictionaryNode dictionaryNode = factory.MethodGenericDictionary(method); dependencies.Add(new DependencyListEntry(dictionaryNode, "GenericMethodsHashtable entry dictionary")); return(dependencies); }
public override void EmitDictionaryEntry(ref ObjectDataBuilder builder, NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { TypeDesc instantiatedType = _type.InstantiateSignature(typeInstantiation, methodInstantiation); int typeSize; if (_type.IsDefType) { typeSize = ((DefType)_type).InstanceFieldSize.AsInt; } else { typeSize = factory.TypeSystemContext.Target.PointerSize; } builder.EmitNaturalInt(typeSize); }
public virtual void EmitDictionaryEntry(ref ObjectDataBuilder builder, NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { ISymbolNode target = GetTarget(factory, typeInstantiation, methodInstantiation, dictionary); if (LookupResultReferenceType(factory) == GenericLookupResultReferenceType.ConditionalIndirect) { builder.EmitPointerRelocOrIndirectionReference(target); } else { builder.EmitPointerReloc(target); } }
public override void EmitDictionaryData(ref ObjectDataBuilder builder, NodeFactory factory, GenericDictionaryNode dictionary, bool fixedLayoutOnly) => throw new NotImplementedException();
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { // We are getting a constructed type symbol because this might be something passed to newobj. TypeDesc instantiatedType = _type.InstantiateSignature(typeInstantiation, methodInstantiation); return(factory.ConstructedTypeSymbol(instantiatedType)); }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { var instantiatedType = (MetadataType)_type.InstantiateSignature(typeInstantiation, methodInstantiation); return(factory.TypeGCStaticsSymbol(instantiatedType)); }
public InterfaceDispatchCellNode GetInterfaceDispatchCell(NodeFactory factory, GenericDictionaryNode dictionary) { MethodDesc instantiatedMethod = _method.InstantiateSignature(dictionary.TypeInstantiation, dictionary.MethodInstantiation); return(factory.InterfaceDispatchCell(instantiatedMethod, dictionary.GetMangledName())); }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { if (factory.Target.Abi == TargetAbi.CoreRT) { MethodDesc instantiatedMethod = _method.InstantiateSignature(typeInstantiation, methodInstantiation); // https://github.com/dotnet/corert/issues/2342 - we put a pointer to the virtual call helper into the dictionary // but this should be something that will let us compute the target of the dipatch (e.g. interface dispatch cell). return(factory.ReadyToRunHelper(ReadyToRunHelperId.VirtualCall, instantiatedMethod)); } else { return(GetInterfaceDispatchCell(factory, dictionary)); } }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { MethodDesc instantiatedMethod = _method.InstantiateSignature(typeInstantiation, methodInstantiation); ISymbolNode methodDictionaryNode = factory.MethodGenericDictionary(instantiatedMethod); if (methodDictionaryNode.RepresentsIndirectionCell) { // Imported method dictionary needs another indirection. Setting the lowest bit to indicate that. Debug.Assert(LookupResultReferenceType(factory) == GenericLookupResultReferenceType.ConditionalIndirect); return(factory.Indirection(methodDictionaryNode, 1)); } else { return(methodDictionaryNode); } }
public override void EmitDictionaryEntry(ref ObjectDataBuilder builder, NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { FieldDesc instantiatedField = _field.InstantiateSignature(typeInstantiation, methodInstantiation); int offset = instantiatedField.Offset.AsInt; builder.EmitNaturalInt(offset); }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { MethodDesc instantiatedConstrainedMethod = _constrainedMethod.InstantiateSignature(typeInstantiation, methodInstantiation); TypeDesc instantiatedConstraintType = _constraintType.InstantiateSignature(typeInstantiation, methodInstantiation); MethodDesc implMethod = instantiatedConstraintType.GetClosestDefType().ResolveInterfaceMethodToVirtualMethodOnType(instantiatedConstrainedMethod); // AOT use of this generic lookup is restricted to finding methods on valuetypes (runtime usage of this slot in universal generics is more flexible) Debug.Assert(instantiatedConstraintType.IsValueType); Debug.Assert(implMethod.OwningType == instantiatedConstraintType); if (implMethod.HasInstantiation && implMethod.GetCanonMethodTarget(CanonicalFormKind.Specific) != implMethod) { return(factory.FatFunctionPointer(implMethod)); } else { return(factory.MethodEntrypoint(implMethod)); } }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { var instantiatedType = (MetadataType)_type.InstantiateSignature(typeInstantiation, methodInstantiation); // TODO The ProjectN abi should have an indirection here. return(factory.TypeGCStaticsSymbol(instantiatedType)); }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { if (factory.Target.Abi == TargetAbi.CoreRT) { MethodDesc instantiatedMethod = _method.InstantiateSignature(typeInstantiation, methodInstantiation); return(factory.InterfaceDispatchCell(instantiatedMethod)); } else { MethodDesc instantiatedMethod = _method.InstantiateSignature(dictionary.TypeInstantiation, dictionary.MethodInstantiation); return(factory.InterfaceDispatchCell(instantiatedMethod, dictionary.GetMangledName(factory.NameMangler))); } }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { MethodDesc instantiatedMethod = _method.InstantiateSignature(typeInstantiation, methodInstantiation); return(factory.FatFunctionPointer(instantiatedMethod, _isUnboxingThunk)); }
public override void EmitDictionaryEntry(ref ObjectDataBuilder builder, NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { builder.EmitPointerReloc(GetTarget(factory, typeInstantiation, methodInstantiation, dictionary), FatFunctionPointerConstants.Offset); }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { var instantiatedType = (MetadataType)_type.InstantiateSignature(typeInstantiation, methodInstantiation); ISymbolNode target = factory.TypeNonGCStaticsSymbol(instantiatedType); // The dictionary entry always points to the beginning of the data. if (factory.TypeSystemContext.HasLazyStaticConstructor(instantiatedType)) { return(factory.Indirection(target, NonGCStaticsNode.GetClassConstructorContextStorageSize(factory.Target, instantiatedType))); } else { return(factory.Indirection(target)); } }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { if (factory.Target.Abi == TargetAbi.CoreRT) { MethodDesc instantiatedMethod = _method.InstantiateSignature(typeInstantiation, methodInstantiation); return(factory.ReadyToRunHelper(ReadyToRunHelperId.VirtualCall, instantiatedMethod)); } else { return(GetInterfaceDispatchCell(factory, dictionary)); } }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { // We are getting a constructed type symbol because this might be something passed to newobj. TypeDesc instantiatedType = _type.InstantiateSignature(typeInstantiation, methodInstantiation); IEETypeNode typeNode = factory.ConstructedTypeSymbol(instantiatedType); if (typeNode.RepresentsIndirectionCell) { // Imported eetype needs another indirection. Setting the lowest bit to indicate that. Debug.Assert(LookupResultReferenceType(factory) == GenericLookupResultReferenceType.ConditionalIndirect); return(factory.Indirection(typeNode, 1)); } else { return(typeNode); } }
public abstract ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary);
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { UtcNodeFactory utcNodeFactory = factory as UtcNodeFactory; Debug.Assert(utcNodeFactory != null); TypeDesc instantiatedType = _type.InstantiateSignature(typeInstantiation, methodInstantiation); Debug.Assert(instantiatedType is MetadataType); return(factory.Indirection(utcNodeFactory.TypeThreadStaticsOffsetSymbol(instantiatedType as MetadataType))); }
public virtual void EmitDictionaryEntry(ref ObjectDataBuilder builder, NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { builder.EmitPointerReloc(GetTarget(factory, typeInstantiation, methodInstantiation, dictionary)); }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { TypeDesc instantiatedType = _type.InstantiateSignature(typeInstantiation, methodInstantiation); MethodDesc defaultCtor = instantiatedType.GetDefaultConstructor(); if (defaultCtor == null) { // If there isn't a default constructor, use the fallback one. MetadataType missingCtorType = factory.TypeSystemContext.SystemModule.GetKnownType("System", "Activator"); missingCtorType = missingCtorType.GetNestedType("ClassWithMissingConstructor"); Debug.Assert(missingCtorType != null); defaultCtor = missingCtorType.GetParameterlessConstructor(); } else { defaultCtor = defaultCtor.GetCanonMethodTarget(CanonicalFormKind.Specific); } return(factory.MethodEntrypoint(defaultCtor)); }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { TypeDesc instantiatedType = _type.InstantiateSignature(typeInstantiation, methodInstantiation); Debug.Assert(instantiatedType.IsArray); return(factory.ExternSymbol(JitHelper.GetNewArrayHelperForType(instantiatedType))); }
public override void EmitDictionaryEntry(ref ObjectDataBuilder builder, NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { Debug.Assert(false, "CallingConventionConverterLookupResult contents should only be generated into generic dictionaries at runtime"); builder.EmitNaturalInt(0); }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { MethodDesc instantiatedMethod = _method.InstantiateSignature(typeInstantiation, methodInstantiation); return(factory.RuntimeMethodHandle(instantiatedMethod)); }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { Debug.Assert(false, "GetTarget for a TypeSizeLookupResult doesn't make sense. It isn't a pointer being emitted"); return(null); }
public virtual void EmitDictionaryData(ref ObjectDataBuilder builder, NodeFactory factory, GenericDictionaryNode dictionary) { var context = new GenericLookupResultContext(dictionary.OwningEntity, dictionary.TypeInstantiation, dictionary.MethodInstantiation); foreach (GenericLookupResult lookupResult in Entries) { #if DEBUG int offsetBefore = builder.CountBytes; #endif lookupResult.EmitDictionaryEntry(ref builder, factory, context); #if DEBUG Debug.Assert(builder.CountBytes - offsetBefore == factory.Target.PointerSize); #endif } }
public override ISymbolNode GetTarget(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation, GenericDictionaryNode dictionary) { TypeDesc instantiatedType = _type.InstantiateSignature(typeInstantiation, methodInstantiation); // Unwrap the nullable type if necessary if (instantiatedType.IsNullable) { instantiatedType = instantiatedType.Instantiation[0]; } // We are getting a constructed type symbol because this might be something passed to newobj. return(factory.ConstructedTypeSymbol(instantiatedType)); }