public void AddEmbeddedObject(EmbeddedObjectNode symbol) { if (_nestedNodes.Add(symbol)) { _nestedNodesList.Add(symbol); } }
public ArrayOfEmbeddedDataNode(string startSymbolMangledName, string endSymbolMangledName, IComparer <TEmbedded> nodeSorter, EmbeddedObjectNode endOfArraySentinel) { _startSymbol = new ObjectAndOffsetSymbolNode(this, 0, startSymbolMangledName); _endSymbol = new ObjectAndOffsetSymbolNode(this, 0, endSymbolMangledName); _sorter = nodeSorter; _endOfArraySentinel = endOfArraySentinel; }
public static string GetBaseSymbolName(ISymbolNode symbol, NameMangler nameMangler, bool objectWriterUse = false) { if (symbol is WebAssemblyMethodCodeNode) { return(symbol.GetMangledName(nameMangler)); } if (symbol is ObjectNode) { ObjectNode objNode = (ObjectNode)symbol; ISymbolDefinitionNode symbolDefNode = (ISymbolDefinitionNode)symbol; if (symbolDefNode.Offset == 0) { return(symbol.GetMangledName(nameMangler)); } else { return(symbol.GetMangledName(nameMangler) + "___REALBASE"); } } else if (symbol is ObjectAndOffsetSymbolNode) { ObjectAndOffsetSymbolNode objAndOffset = (ObjectAndOffsetSymbolNode)symbol; if (objAndOffset.Target is IHasStartSymbol) { ISymbolNode startSymbol = ((IHasStartSymbol)objAndOffset.Target).StartSymbol; if (startSymbol == symbol) { Debug.Assert(startSymbol.Offset == 0); return(symbol.GetMangledName(nameMangler)); } return(GetBaseSymbolName(startSymbol, nameMangler, objectWriterUse)); } return(GetBaseSymbolName((ISymbolNode)objAndOffset.Target, nameMangler, objectWriterUse)); } else if (symbol is EmbeddedObjectNode) { EmbeddedObjectNode embeddedNode = (EmbeddedObjectNode)symbol; return(GetBaseSymbolName(embeddedNode.ContainingNode.StartSymbol, nameMangler, objectWriterUse)); } else { return(null); } }
protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory factory) { DependencyList dependencies = new DependencyList(); dependencies.Add(StartSymbol, "StartSymbol"); dependencies.Add(EndSymbol, "EndSymbol"); lock (this) { if (_pointerFromImportTablesTable == null) { _pointerFromImportTablesTable = factory.ImportAddressTablesTable.NewNode(this); } } dependencies.Add(_pointerFromImportTablesTable, "Pointer from ImportTablesTableNode"); return(dependencies); }
private static int GetNumericOffsetFromBaseSymbolValue(ISymbolNode symbol) { if (symbol is WebAssemblyMethodCodeNode) { return(0); } if (symbol is ObjectNode) { ISymbolDefinitionNode symbolDefNode = (ISymbolDefinitionNode)symbol; return(symbolDefNode.Offset); } else if (symbol is ObjectAndOffsetSymbolNode) { ObjectAndOffsetSymbolNode objAndOffset = (ObjectAndOffsetSymbolNode)symbol; ISymbolDefinitionNode symbolDefNode = (ISymbolDefinitionNode)symbol; if (objAndOffset.Target is IHasStartSymbol) { ISymbolNode startSymbol = ((IHasStartSymbol)objAndOffset.Target).StartSymbol; if (startSymbol == symbol) { Debug.Assert(symbolDefNode.Offset == 0); return(symbolDefNode.Offset); } return(symbolDefNode.Offset); } int baseOffset = GetNumericOffsetFromBaseSymbolValue((ISymbolNode)objAndOffset.Target); return(baseOffset + symbolDefNode.Offset); } else if (symbol is EmbeddedObjectNode) { EmbeddedObjectNode embeddedNode = (EmbeddedObjectNode)symbol; int baseOffset = GetNumericOffsetFromBaseSymbolValue(embeddedNode.ContainingNode.StartSymbol); return(baseOffset + ((ISymbolDefinitionNode)embeddedNode).Offset); } else { ThrowHelper.ThrowInvalidProgramException(); return(0); } }