public ISymbolNode TypeGCStaticsSymbol(MetadataType type) { if (_compilationModuleGroup.ContainsType(type)) { return(_GCStatics.GetOrAdd(type)); } else { return(ExternSymbol(GCStaticsNode.GetMangledName(type, NodeFactory.NameMangler))); } }
public ISymbolNode TypeGCStaticsSymbol(MetadataType type) { Debug.Assert(!TypeCannotHaveEEType(type)); if (_compilationModuleGroup.ContainsType(type)) { return(_GCStatics.GetOrAdd(type)); } else { return(ExternSymbol(GCStaticsNode.GetMangledName(type, NameMangler))); } }
public override ISortableSymbolNode ImportedGCStaticNode(NodeFactory factory, MetadataType type) { return(new ExternSymbolNode(GCStaticsNode.GetMangledName(type, factory.NameMangler))); }
protected override sealed string GetNonImportedName(NameMangler nameMangler) => GCStaticsNode.GetMangledName(Type, nameMangler);
private void CreateNodeCaches() { _typeSymbols = new NodeCache <TypeDesc, IEETypeNode>((TypeDesc type) => { Debug.Assert(!_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); if (_compilationModuleGroup.ContainsType(type)) { if (type.IsGenericDefinition) { return(new GenericDefinitionEETypeNode(this, type)); } else if (type.IsCanonicalDefinitionType(CanonicalFormKind.Any)) { return(new CanonicalDefinitionEETypeNode(this, type)); } else if (type.IsCanonicalSubtype(CanonicalFormKind.Any)) { return(new NecessaryCanonicalEETypeNode(this, type)); } else { return(new EETypeNode(this, type)); } } else { return(new ExternEETypeSymbolNode(this, type)); } }); _constructedTypeSymbols = new NodeCache <TypeDesc, IEETypeNode>((TypeDesc type) => { // Canonical definition types are *not* constructed types (call NecessaryTypeSymbol to get them) Debug.Assert(!type.IsCanonicalDefinitionType(CanonicalFormKind.Any)); Debug.Assert(!_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); if (_compilationModuleGroup.ContainsType(type)) { if (type.IsCanonicalSubtype(CanonicalFormKind.Any)) { return(new CanonicalEETypeNode(this, type)); } else { return(new ConstructedEETypeNode(this, type)); } } else { return(new ExternEETypeSymbolNode(this, type)); } }); _clonedTypeSymbols = new NodeCache <TypeDesc, IEETypeNode>((TypeDesc type) => { // Only types that reside in other binaries should be cloned Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); return(new ClonedConstructedEETypeNode(this, type)); }); _importedTypeSymbols = new NodeCache <TypeDesc, IEETypeNode>((TypeDesc type) => { Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); return(new ImportedEETypeSymbolNode(this, type)); }); _nonGCStatics = new NodeCache <MetadataType, ISymbolNode>((MetadataType type) => { if (_compilationModuleGroup.ContainsType(type)) { return(new NonGCStaticsNode(type, this)); } else if (_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return(new ImportedNonGCStaticsNode(this, type)); } else { return(new ExternSymbolNode(NonGCStaticsNode.GetMangledName(type, NameMangler))); } }); _GCStatics = new NodeCache <MetadataType, ISymbolNode>((MetadataType type) => { if (_compilationModuleGroup.ContainsType(type)) { return(new GCStaticsNode(type)); } else if (_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return(new ImportedGCStaticsNode(this, type)); } else { return(new ExternSymbolNode(GCStaticsNode.GetMangledName(type, NameMangler))); } }); _GCStaticsPreInitDataNodes = new NodeCache <MetadataType, GCStaticsPreInitDataNode>((MetadataType type) => { ISymbolNode gcStaticsNode = TypeGCStaticsSymbol(type); Debug.Assert(gcStaticsNode is GCStaticsNode); return(((GCStaticsNode)gcStaticsNode).NewPreInitDataNode()); }); _GCStaticIndirectionNodes = new NodeCache <MetadataType, EmbeddedObjectNode>((MetadataType type) => { ISymbolNode gcStaticsNode = TypeGCStaticsSymbol(type); Debug.Assert(gcStaticsNode is GCStaticsNode); return(GCStaticsRegion.NewNode((GCStaticsNode)gcStaticsNode)); }); _threadStatics = new NodeCache <MetadataType, ISymbolDefinitionNode>(CreateThreadStaticsNode); _typeThreadStaticIndices = new NodeCache <MetadataType, TypeThreadStaticIndexNode>(type => { return(new TypeThreadStaticIndexNode(type)); }); _GCStaticEETypes = new NodeCache <GCPointerMap, GCStaticEETypeNode>((GCPointerMap gcMap) => { return(new GCStaticEETypeNode(Target, gcMap)); }); _readOnlyDataBlobs = new NodeCache <ReadOnlyDataBlobKey, BlobNode>(key => { return(new BlobNode(key.Name, ObjectNodeSection.ReadOnlyDataSection, key.Data, key.Alignment)); }); _externSymbols = new NodeCache <string, ExternSymbolNode>((string name) => { return(new ExternSymbolNode(name)); }); _pInvokeModuleFixups = new NodeCache <string, PInvokeModuleFixupNode>((string name) => { return(new PInvokeModuleFixupNode(name)); }); _pInvokeMethodFixups = new NodeCache <Tuple <string, string>, PInvokeMethodFixupNode>((Tuple <string, string> key) => { return(new PInvokeMethodFixupNode(key.Item1, key.Item2)); }); _methodEntrypoints = new NodeCache <MethodDesc, IMethodNode>(CreateMethodEntrypointNode); _unboxingStubs = new NodeCache <MethodDesc, IMethodNode>(CreateUnboxingStubNode); _fatFunctionPointers = new NodeCache <MethodKey, FatFunctionPointerNode>(method => { return(new FatFunctionPointerNode(method.Method, method.IsUnboxingStub)); }); _gvmDependenciesNode = new NodeCache <MethodDesc, GVMDependenciesNode>(method => { return(new GVMDependenciesNode(method)); }); _gvmTableEntries = new NodeCache <TypeDesc, TypeGVMEntriesNode>(type => { return(new TypeGVMEntriesNode(type)); }); _reflectableMethods = new NodeCache <MethodDesc, ReflectableMethodNode>(method => { return(new ReflectableMethodNode(method)); }); _shadowConcreteMethods = new NodeCache <MethodKey, IMethodNode>(methodKey => { MethodDesc canonMethod = methodKey.Method.GetCanonMethodTarget(CanonicalFormKind.Specific); if (methodKey.IsUnboxingStub) { return(new ShadowConcreteUnboxingThunkNode(methodKey.Method, MethodEntrypoint(canonMethod, true))); } else { return(new ShadowConcreteMethodNode(methodKey.Method, MethodEntrypoint(canonMethod))); } }); _runtimeDeterminedMethods = new NodeCache <MethodDesc, IMethodNode>(method => { return(new RuntimeDeterminedMethodNode(method, MethodEntrypoint(method.GetCanonMethodTarget(CanonicalFormKind.Specific)))); }); _virtMethods = new NodeCache <MethodDesc, VirtualMethodUseNode>((MethodDesc method) => { // We don't need to track virtual method uses for types that have a vtable with a known layout. // It's a waste of CPU time and memory. Debug.Assert(!VTable(method.OwningType).HasFixedSlots); return(new VirtualMethodUseNode(method)); }); _readyToRunHelpers = new NodeCache <ReadyToRunHelperKey, ISymbolNode>(CreateReadyToRunHelperNode); _genericReadyToRunHelpersFromDict = new NodeCache <ReadyToRunGenericHelperKey, ISymbolNode>(data => { return(new ReadyToRunGenericLookupFromDictionaryNode(this, data.HelperId, data.Target, data.DictionaryOwner)); }); _genericReadyToRunHelpersFromType = new NodeCache <ReadyToRunGenericHelperKey, ISymbolNode>(data => { return(new ReadyToRunGenericLookupFromTypeNode(this, data.HelperId, data.Target, data.DictionaryOwner)); }); _indirectionNodes = new NodeCache <ISymbolNode, ISymbolNode>(indirectedNode => { return(new IndirectionNode(Target, indirectedNode, 0)); }); _frozenStringNodes = new NodeCache <string, FrozenStringNode>((string data) => { return(new FrozenStringNode(data, Target)); }); _frozenArrayNodes = new NodeCache <PreInitFieldInfo, FrozenArrayNode>((PreInitFieldInfo fieldInfo) => { return(new FrozenArrayNode(fieldInfo)); }); _interfaceDispatchCells = new NodeCache <DispatchCellKey, InterfaceDispatchCellNode>(callSiteCell => { return(new InterfaceDispatchCellNode(callSiteCell.Target, callSiteCell.CallsiteId)); }); _interfaceDispatchMaps = new NodeCache <TypeDesc, InterfaceDispatchMapNode>((TypeDesc type) => { return(new InterfaceDispatchMapNode(type)); }); _runtimeMethodHandles = new NodeCache <MethodDesc, RuntimeMethodHandleNode>((MethodDesc method) => { return(new RuntimeMethodHandleNode(method)); }); _runtimeFieldHandles = new NodeCache <FieldDesc, RuntimeFieldHandleNode>((FieldDesc field) => { return(new RuntimeFieldHandleNode(field)); }); _interfaceDispatchMapIndirectionNodes = new NodeCache <TypeDesc, EmbeddedObjectNode>((TypeDesc type) => { var dispatchMap = InterfaceDispatchMap(type); return(DispatchMapTable.NewNodeWithSymbol(dispatchMap, (indirectionNode) => { dispatchMap.SetDispatchMapIndex(this, DispatchMapTable.IndexOfEmbeddedObject(indirectionNode)); })); }); _genericCompositions = new NodeCache <GenericCompositionDetails, GenericCompositionNode>((GenericCompositionDetails details) => { return(new GenericCompositionNode(details)); }); _eagerCctorIndirectionNodes = new NodeCache <MethodDesc, EmbeddedObjectNode>((MethodDesc method) => { Debug.Assert(method.IsStaticConstructor); Debug.Assert(TypeSystemContext.HasEagerStaticConstructor((MetadataType)method.OwningType)); return(EagerCctorTable.NewNode(MethodEntrypoint(method))); }); _namedJumpStubNodes = new NodeCache <Tuple <string, ISymbolNode>, NamedJumpStubNode>((Tuple <string, ISymbolNode> id) => { return(new NamedJumpStubNode(id.Item1, id.Item2)); }); _vTableNodes = new NodeCache <TypeDesc, VTableSliceNode>((TypeDesc type ) => { if (CompilationModuleGroup.ShouldProduceFullVTable(type)) { return(new EagerlyBuiltVTableSliceNode(type)); } else { return(_vtableSliceProvider.GetSlice(type)); } }); _methodGenericDictionaries = new NodeCache <MethodDesc, ISymbolNode>(method => { if (CompilationModuleGroup.ContainsMethodDictionary(method)) { return(new MethodGenericDictionaryNode(method, this)); } else { return(new ImportedMethodGenericDictionaryNode(this, method)); } }); _typeGenericDictionaries = new NodeCache <TypeDesc, ISymbolNode>(type => { if (CompilationModuleGroup.ContainsType(type)) { Debug.Assert(!this.LazyGenericsPolicy.UsesLazyGenerics(type)); return(new TypeGenericDictionaryNode(type, this)); } else { return(new ImportedTypeGenericDictionaryNode(this, type)); } }); _typesWithMetadata = new NodeCache <MetadataType, TypeMetadataNode>(type => { return(new TypeMetadataNode(type)); }); _methodsWithMetadata = new NodeCache <MethodDesc, MethodMetadataNode>(method => { return(new MethodMetadataNode(method)); }); _fieldsWithMetadata = new NodeCache <FieldDesc, FieldMetadataNode>(field => { return(new FieldMetadataNode(field)); }); _modulesWithMetadata = new NodeCache <ModuleDesc, ModuleMetadataNode>(module => { return(new ModuleMetadataNode(module)); }); _genericDictionaryLayouts = new NodeCache <TypeSystemEntity, DictionaryLayoutNode>(_dictionaryLayoutProvider.GetLayout); _stringAllocators = new NodeCache <MethodDesc, IMethodNode>(constructor => { return(new StringAllocatorMethodNode(constructor)); }); NativeLayout = new NativeLayoutHelper(this); WindowsDebugData = new WindowsDebugDataHelper(this); }
public ImportedGCStaticsNode(NodeFactory factory, MetadataType type) : base("__imp_" + GCStaticsNode.GetMangledName(type, factory.NameMangler)) { }