Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,10 +96,10 @@ private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, In

// Rehydrate any dehydrated data structures
IntPtr dehydratedDataSection = RuntimeImports.RhGetModuleSection(
handle, ReadyToRunSectionType.DehydratedData, out int dehydratedDataLength);
handle, ReadyToRunSectionType.DehydratedData, out _);
if (dehydratedDataSection != IntPtr.Zero)
{
RehydrateData(dehydratedDataSection, dehydratedDataLength);
RehydrateData(dehydratedDataSection);
}

pHandles[moduleIndex++] = handle;
Expand DownExpand Up@@ -244,13 +244,16 @@ private static unsafe object[] InitializeStatics(IntPtr gcStaticRegionStart, int
=> (byte*)address + *(int*)address;
}

private static unsafe void RehydrateData(IntPtr dehydratedData, int length)
private static unsafe void RehydrateData(IntPtr dehydratedData)
{
// Destination for the hydrated data is in the first 32-bit relative pointer
byte* pDest = (byte*)ReadRelPtr32((void*)dehydratedData);

// Next is length of the dehydrated data
int length = *(int*)(dehydratedData + sizeof(int));

// The dehydrated data follows
byte* pCurrent = (byte*)dehydratedData + sizeof(int);
byte* pCurrent = (byte*)dehydratedData + sizeof(int) * 2;
byte* pEnd = (byte*)dehydratedData + length;

// Fixup table immediately follows the command stream
Expand Down
19 changes: 1 addition & 18 deletions src/coreclr/nativeaot/Runtime/TypeManager.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ void * TypeManager::GetModuleSection(ReadyToRunSectionType sectionId, int * leng
ModuleInfoRow * pCurrent = pModuleInfoRows + i;
if ((int32_t)sectionId == pCurrent->SectionId)
{
*length = pCurrent->GetLength();
*length = pCurrent->Length;
return pCurrent->Start;
}
}
Expand All@@ -79,23 +79,6 @@ void * TypeManager::GetClasslibFunction(ClasslibFunctionId functionId)
return m_pClasslibFunctions[id];
}

bool TypeManager::ModuleInfoRow::HasEndPointer()
{
return Flags & (int32_t)ModuleInfoFlags::HasEndPointer;
}

int TypeManager::ModuleInfoRow::GetLength()
{
if (HasEndPointer())
{
return (int)((uint8_t*)End - (uint8_t*)Start);
}
else
{
return sizeof(void*);
}
}

HANDLE TypeManager::GetOsModuleHandle()
{
return m_osModule;
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Runtime/TypeManager.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,12 +27,8 @@ class TypeManager
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
int32_t Length;
void * Start;
void * End;

bool HasEndPointer();
int GetLength();
};
};

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,8 +58,3 @@ enum class ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
};

enum class ModuleInfoFlags
{
HasEndPointer = 0x1,
};
Original file line numberDiff line numberDiff line change
Expand Up@@ -435,10 +435,8 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe

bool isMethod = node is IMethodBodyNode or AssemblyStubNode;
#if !READYTORUN
bool recordSize = isMethod;
long thumbBit = _nodeFactory.Target.Architecture == TargetArchitecture.ARM && isMethod ? 1 : 0;
#else
bool recordSize = true;
// R2R records the thumb bit in the addend when needed, so we don't have to do it here.
long thumbBit = 0;
#endif
Expand All@@ -462,7 +460,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
mangledName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0);
n.Offset == 0 ? nodeContents.Data.Length : 0);

_outputInfoBuilder?.AddSymbol(new OutputSymbol(sectionWriter.SectionIndex, (ulong)(sectionWriter.Position + n.Offset), mangledName));

Expand All@@ -473,7 +471,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
alternateCName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0,
n.Offset == 0 ? nodeContents.Data.Length : 0,
global: !isHidden);

if (n is IMethodNode)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,4 @@ enum ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
}

[Flags]
internal enum ModuleInfoFlags : int
{
HasEndPointer = 0x1,
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,18 +12,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of array types generated into the image.
/// </summary>
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode
{
private readonly ExternalReferencesTableNode _externalReferences;
private int? _size;

public ArrayMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__array_type_map"u8);
Expand DownExpand Up@@ -66,8 +63,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,16 +10,13 @@ namespace ILCompiler.DependencyAnalysis
/// by placing a starting symbol, followed by contents of <typeparamref name="TEmbedded"/> nodes (optionally
/// sorted using provided comparer), followed by ending symbol.
/// </summary>
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode, INodeWithSize
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode
where TEmbedded : EmbeddedObjectNode
{
private int? _size;
private HashSet<TEmbedded> _nestedNodes = new HashSet<TEmbedded>();
private List<TEmbedded> _nestedNodesList = new List<TEmbedded>();
private IComparer<TEmbedded> _sorter;

int INodeWithSize.Size => _size.Value;

public ArrayOfEmbeddedDataNode(string mangledName, IComparer<TEmbedded> nodeSorter) : base(mangledName)
{
_sorter = nodeSorter;
Expand DownExpand Up@@ -85,8 +82,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly)

GetElementDataForNodes(ref builder, factory, relocsOnly);

_size = builder.CountBytes;

ObjectData objData = builder.ToObjectData();
return objData;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,8 @@

namespace ILCompiler.DependencyAnalysis
{
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode, INodeWithSize
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode
{
private int? _size;
int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
=> sb.Append(nameMangler.CompilationUnitPrefix).Append("__FrozenSegmentStart"u8);
Expand DownExpand Up@@ -57,8 +55,6 @@ protected override ObjectData GetDehydratableData(NodeFactory factory, bool relo
AlignNextObject(ref builder, factory);
builder.EmitZeroPointer();

_size = builder.CountBytes;

return builder.ToObjectData();
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of ByRef types generated into the image.
/// </summary>
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;

public ByRefTypeMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__byref_type_map"u8);
Expand DownExpand Up@@ -61,8 +58,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@

namespace ILCompiler.DependencyAnalysis
{
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ClassConstructorContextMap(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__type_to_cctorContext_map"u8);
Expand DownExpand Up@@ -73,8 +70,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,8 @@ namespace ILCompiler.DependencyAnalysis
/// * Generate N bytes of zeros.
/// * Generate a relocation to Nth entry in the lookup table that supplements the dehydrated stream.
/// </remarks>
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;

public override bool IsShareable => false;

Expand All@@ -43,8 +42,6 @@ internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, IN

public int Offset => 0;

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__dehydrated_data"u8);
Expand DownExpand Up@@ -107,6 +104,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Array.Resize(ref relocSort, lastProfitableReloc);
var relocs = new Dictionary<ISymbolNode, int>(relocSort);

ObjectDataBuilder.Reservation dehydratedDataLengthReservation = builder.ReserveInt();

// Walk all the ObjectDatas and generate the dehydrated instruction stream.
byte[] buff = new byte[4];
int dehydratedSegmentPosition = 0;
Expand DownExpand Up@@ -309,7 +308,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
dehydratedSegmentPosition += o.Data.Length;
}

_size = builder.CountBytes;
builder.EmitInt(dehydratedDataLengthReservation, builder.CountBytes);

// Dehydrated data is followed by the reloc lookup table.
for (int i = 0; i < relocSort.Length; i++)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,9 +12,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of delegate marshalling stub types generated into the image.
/// </summary>
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;
private readonly InteropStateManager _interopStateManager;

Expand All@@ -24,8 +23,6 @@ public DelegateMarshallingStubMapNode(ExternalReferencesTableNode externalRefere
_interopStateManager = interopStateManager;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__delegate_marshalling_stub_map"u8);
Expand DownExpand Up@@ -70,8 +67,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,9 +14,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Hashtable of all exact (non-canonical) generic method instantiations compiled in the module.
/// </summary>
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ExactMethodInstantiationsNode(ExternalReferencesTableNode externalReferences)
Expand All@@ -29,7 +28,6 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
sb.Append(nameMangler.CompilationUnitPrefix).Append("__exact_method_instantiations"u8);
}

int INodeWithSize.Size => _size.Value;
public int Offset => 0;
public override bool IsShareable => false;
public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory);
Expand All@@ -50,7 +48,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Section nativeSection = nativeWriter.NewSection();
nativeSection.Place(hashtable);


foreach (MethodDesc method in factory.MetadataManager.GetExactMethodHashtableEntries())
{
// Get the method pointer vertex
Expand DownExpand Up@@ -98,8 +95,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] streamBytes = nativeWriter.Save();

_size = streamBytes.Length;

return new ObjectData(streamBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,9 +13,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a node that points to various symbols and can be sequentially addressed.
/// </summary>
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly string _blobName;
private readonly NodeFactory _nodeFactory;

Expand All@@ -28,8 +27,6 @@ public ExternalReferencesTableNode(string blobName, NodeFactory nodeFactory)
_nodeFactory = nodeFactory;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__external_" + _blobName + "_references");
Expand DownExpand Up@@ -102,8 +99,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
}
}

_size = builder.CountBytes;

builder.AddSymbol(this);

return builder.ToObjectData();
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,10 +96,10 @@ private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, In

// Rehydrate any dehydrated data structures
IntPtr dehydratedDataSection = RuntimeImports.RhGetModuleSection(
handle, ReadyToRunSectionType.DehydratedData, out int dehydratedDataLength);
handle, ReadyToRunSectionType.DehydratedData, out _);
if (dehydratedDataSection != IntPtr.Zero)
{
RehydrateData(dehydratedDataSection, dehydratedDataLength);
RehydrateData(dehydratedDataSection);
}

pHandles[moduleIndex++] = handle;
Expand DownExpand Up@@ -244,13 +244,16 @@ private static unsafe object[] InitializeStatics(IntPtr gcStaticRegionStart, int
=> (byte*)address + *(int*)address;
}

private static unsafe void RehydrateData(IntPtr dehydratedData, int length)
private static unsafe void RehydrateData(IntPtr dehydratedData)
{
// Destination for the hydrated data is in the first 32-bit relative pointer
byte* pDest = (byte*)ReadRelPtr32((void*)dehydratedData);

// Next is length of the dehydrated data
int length = *(int*)(dehydratedData + sizeof(int));

// The dehydrated data follows
byte* pCurrent = (byte*)dehydratedData + sizeof(int);
byte* pCurrent = (byte*)dehydratedData + sizeof(int) * 2;
byte* pEnd = (byte*)dehydratedData + length;

// Fixup table immediately follows the command stream
Expand Down
19 changes: 1 addition & 18 deletions src/coreclr/nativeaot/Runtime/TypeManager.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ void * TypeManager::GetModuleSection(ReadyToRunSectionType sectionId, int * leng
ModuleInfoRow * pCurrent = pModuleInfoRows + i;
if ((int32_t)sectionId == pCurrent->SectionId)
{
*length = pCurrent->GetLength();
*length = pCurrent->Length;
return pCurrent->Start;
}
}
Expand All@@ -79,23 +79,6 @@ void * TypeManager::GetClasslibFunction(ClasslibFunctionId functionId)
return m_pClasslibFunctions[id];
}

bool TypeManager::ModuleInfoRow::HasEndPointer()
{
return Flags & (int32_t)ModuleInfoFlags::HasEndPointer;
}

int TypeManager::ModuleInfoRow::GetLength()
{
if (HasEndPointer())
{
return (int)((uint8_t*)End - (uint8_t*)Start);
}
else
{
return sizeof(void*);
}
}

HANDLE TypeManager::GetOsModuleHandle()
{
return m_osModule;
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Runtime/TypeManager.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,12 +27,8 @@ class TypeManager
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
int32_t Length;
void * Start;
void * End;

bool HasEndPointer();
int GetLength();
};
};

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,8 +58,3 @@ enum class ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
};

enum class ModuleInfoFlags
{
HasEndPointer = 0x1,
};
Original file line numberDiff line numberDiff line change
Expand Up@@ -435,10 +435,8 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe

bool isMethod = node is IMethodBodyNode or AssemblyStubNode;
#if !READYTORUN
bool recordSize = isMethod;
long thumbBit = _nodeFactory.Target.Architecture == TargetArchitecture.ARM && isMethod ? 1 : 0;
#else
bool recordSize = true;
// R2R records the thumb bit in the addend when needed, so we don't have to do it here.
long thumbBit = 0;
#endif
Expand All@@ -462,7 +460,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
mangledName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0);
n.Offset == 0 ? nodeContents.Data.Length : 0);

_outputInfoBuilder?.AddSymbol(new OutputSymbol(sectionWriter.SectionIndex, (ulong)(sectionWriter.Position + n.Offset), mangledName));

Expand All@@ -473,7 +471,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
alternateCName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0,
n.Offset == 0 ? nodeContents.Data.Length : 0,
global: !isHidden);

if (n is IMethodNode)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,4 @@ enum ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
}

[Flags]
internal enum ModuleInfoFlags : int
{
HasEndPointer = 0x1,
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,18 +12,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of array types generated into the image.
/// </summary>
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode
{
private readonly ExternalReferencesTableNode _externalReferences;
private int? _size;

public ArrayMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__array_type_map"u8);
Expand DownExpand Up@@ -66,8 +63,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,16 +10,13 @@ namespace ILCompiler.DependencyAnalysis
/// by placing a starting symbol, followed by contents of <typeparamref name="TEmbedded"/> nodes (optionally
/// sorted using provided comparer), followed by ending symbol.
/// </summary>
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode, INodeWithSize
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode
where TEmbedded : EmbeddedObjectNode
{
private int? _size;
private HashSet<TEmbedded> _nestedNodes = new HashSet<TEmbedded>();
private List<TEmbedded> _nestedNodesList = new List<TEmbedded>();
private IComparer<TEmbedded> _sorter;

int INodeWithSize.Size => _size.Value;

public ArrayOfEmbeddedDataNode(string mangledName, IComparer<TEmbedded> nodeSorter) : base(mangledName)
{
_sorter = nodeSorter;
Expand DownExpand Up@@ -85,8 +82,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly)

GetElementDataForNodes(ref builder, factory, relocsOnly);

_size = builder.CountBytes;

ObjectData objData = builder.ToObjectData();
return objData;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,8 @@

namespace ILCompiler.DependencyAnalysis
{
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode, INodeWithSize
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode
{
private int? _size;
int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
=> sb.Append(nameMangler.CompilationUnitPrefix).Append("__FrozenSegmentStart"u8);
Expand DownExpand Up@@ -57,8 +55,6 @@ protected override ObjectData GetDehydratableData(NodeFactory factory, bool relo
AlignNextObject(ref builder, factory);
builder.EmitZeroPointer();

_size = builder.CountBytes;

return builder.ToObjectData();
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of ByRef types generated into the image.
/// </summary>
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;

public ByRefTypeMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__byref_type_map"u8);
Expand DownExpand Up@@ -61,8 +58,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@

namespace ILCompiler.DependencyAnalysis
{
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ClassConstructorContextMap(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__type_to_cctorContext_map"u8);
Expand DownExpand Up@@ -73,8 +70,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,8 @@ namespace ILCompiler.DependencyAnalysis
/// * Generate N bytes of zeros.
/// * Generate a relocation to Nth entry in the lookup table that supplements the dehydrated stream.
/// </remarks>
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;

public override bool IsShareable => false;

Expand All@@ -43,8 +42,6 @@ internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, IN

public int Offset => 0;

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__dehydrated_data"u8);
Expand DownExpand Up@@ -107,6 +104,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Array.Resize(ref relocSort, lastProfitableReloc);
var relocs = new Dictionary<ISymbolNode, int>(relocSort);

ObjectDataBuilder.Reservation dehydratedDataLengthReservation = builder.ReserveInt();

// Walk all the ObjectDatas and generate the dehydrated instruction stream.
byte[] buff = new byte[4];
int dehydratedSegmentPosition = 0;
Expand DownExpand Up@@ -309,7 +308,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
dehydratedSegmentPosition += o.Data.Length;
}

_size = builder.CountBytes;
builder.EmitInt(dehydratedDataLengthReservation, builder.CountBytes);

// Dehydrated data is followed by the reloc lookup table.
for (int i = 0; i < relocSort.Length; i++)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,9 +12,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of delegate marshalling stub types generated into the image.
/// </summary>
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;
private readonly InteropStateManager _interopStateManager;

Expand All@@ -24,8 +23,6 @@ public DelegateMarshallingStubMapNode(ExternalReferencesTableNode externalRefere
_interopStateManager = interopStateManager;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__delegate_marshalling_stub_map"u8);
Expand DownExpand Up@@ -70,8 +67,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,9 +14,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Hashtable of all exact (non-canonical) generic method instantiations compiled in the module.
/// </summary>
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ExactMethodInstantiationsNode(ExternalReferencesTableNode externalReferences)
Expand All@@ -29,7 +28,6 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
sb.Append(nameMangler.CompilationUnitPrefix).Append("__exact_method_instantiations"u8);
}

int INodeWithSize.Size => _size.Value;
public int Offset => 0;
public override bool IsShareable => false;
public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory);
Expand All@@ -50,7 +48,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Section nativeSection = nativeWriter.NewSection();
nativeSection.Place(hashtable);


foreach (MethodDesc method in factory.MetadataManager.GetExactMethodHashtableEntries())
{
// Get the method pointer vertex
Expand DownExpand Up@@ -98,8 +95,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] streamBytes = nativeWriter.Save();

_size = streamBytes.Length;

return new ObjectData(streamBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,9 +13,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a node that points to various symbols and can be sequentially addressed.
/// </summary>
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly string _blobName;
private readonly NodeFactory _nodeFactory;

Expand All@@ -28,8 +27,6 @@ public ExternalReferencesTableNode(string blobName, NodeFactory nodeFactory)
_nodeFactory = nodeFactory;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__external_" + _blobName + "_references");
Expand DownExpand Up@@ -102,8 +99,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
}
}

_size = builder.CountBytes;

builder.AddSymbol(this);

return builder.ToObjectData();
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,10 +96,10 @@ private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, In

// Rehydrate any dehydrated data structures
IntPtr dehydratedDataSection = RuntimeImports.RhGetModuleSection(
handle, ReadyToRunSectionType.DehydratedData, out int dehydratedDataLength);
handle, ReadyToRunSectionType.DehydratedData, out _);
if (dehydratedDataSection != IntPtr.Zero)
{
RehydrateData(dehydratedDataSection, dehydratedDataLength);
RehydrateData(dehydratedDataSection);
}

pHandles[moduleIndex++] = handle;
Expand DownExpand Up@@ -244,13 +244,16 @@ private static unsafe object[] InitializeStatics(IntPtr gcStaticRegionStart, int
=> (byte*)address + *(int*)address;
}

private static unsafe void RehydrateData(IntPtr dehydratedData, int length)
private static unsafe void RehydrateData(IntPtr dehydratedData)
{
// Destination for the hydrated data is in the first 32-bit relative pointer
byte* pDest = (byte*)ReadRelPtr32((void*)dehydratedData);

// Next is length of the dehydrated data
int length = *(int*)(dehydratedData + sizeof(int));

// The dehydrated data follows
byte* pCurrent = (byte*)dehydratedData + sizeof(int);
byte* pCurrent = (byte*)dehydratedData + sizeof(int) * 2;
byte* pEnd = (byte*)dehydratedData + length;

// Fixup table immediately follows the command stream
Expand Down
19 changes: 1 addition & 18 deletions src/coreclr/nativeaot/Runtime/TypeManager.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ void * TypeManager::GetModuleSection(ReadyToRunSectionType sectionId, int * leng
ModuleInfoRow * pCurrent = pModuleInfoRows + i;
if ((int32_t)sectionId == pCurrent->SectionId)
{
*length = pCurrent->GetLength();
*length = pCurrent->Length;
return pCurrent->Start;
}
}
Expand All@@ -79,23 +79,6 @@ void * TypeManager::GetClasslibFunction(ClasslibFunctionId functionId)
return m_pClasslibFunctions[id];
}

bool TypeManager::ModuleInfoRow::HasEndPointer()
{
return Flags & (int32_t)ModuleInfoFlags::HasEndPointer;
}

int TypeManager::ModuleInfoRow::GetLength()
{
if (HasEndPointer())
{
return (int)((uint8_t*)End - (uint8_t*)Start);
}
else
{
return sizeof(void*);
}
}

HANDLE TypeManager::GetOsModuleHandle()
{
return m_osModule;
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Runtime/TypeManager.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,12 +27,8 @@ class TypeManager
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
int32_t Length;
void * Start;
void * End;

bool HasEndPointer();
int GetLength();
};
};

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,8 +58,3 @@ enum class ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
};

enum class ModuleInfoFlags
{
HasEndPointer = 0x1,
};
Original file line numberDiff line numberDiff line change
Expand Up@@ -435,10 +435,8 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe

bool isMethod = node is IMethodBodyNode or AssemblyStubNode;
#if !READYTORUN
bool recordSize = isMethod;
long thumbBit = _nodeFactory.Target.Architecture == TargetArchitecture.ARM && isMethod ? 1 : 0;
#else
bool recordSize = true;
// R2R records the thumb bit in the addend when needed, so we don't have to do it here.
long thumbBit = 0;
#endif
Expand All@@ -462,7 +460,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
mangledName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0);
n.Offset == 0 ? nodeContents.Data.Length : 0);

_outputInfoBuilder?.AddSymbol(new OutputSymbol(sectionWriter.SectionIndex, (ulong)(sectionWriter.Position + n.Offset), mangledName));

Expand All@@ -473,7 +471,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
alternateCName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0,
n.Offset == 0 ? nodeContents.Data.Length : 0,
global: !isHidden);

if (n is IMethodNode)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,4 @@ enum ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
}

[Flags]
internal enum ModuleInfoFlags : int
{
HasEndPointer = 0x1,
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,18 +12,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of array types generated into the image.
/// </summary>
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode
{
private readonly ExternalReferencesTableNode _externalReferences;
private int? _size;

public ArrayMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__array_type_map"u8);
Expand DownExpand Up@@ -66,8 +63,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,16 +10,13 @@ namespace ILCompiler.DependencyAnalysis
/// by placing a starting symbol, followed by contents of <typeparamref name="TEmbedded"/> nodes (optionally
/// sorted using provided comparer), followed by ending symbol.
/// </summary>
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode, INodeWithSize
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode
where TEmbedded : EmbeddedObjectNode
{
private int? _size;
private HashSet<TEmbedded> _nestedNodes = new HashSet<TEmbedded>();
private List<TEmbedded> _nestedNodesList = new List<TEmbedded>();
private IComparer<TEmbedded> _sorter;

int INodeWithSize.Size => _size.Value;

public ArrayOfEmbeddedDataNode(string mangledName, IComparer<TEmbedded> nodeSorter) : base(mangledName)
{
_sorter = nodeSorter;
Expand DownExpand Up@@ -85,8 +82,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly)

GetElementDataForNodes(ref builder, factory, relocsOnly);

_size = builder.CountBytes;

ObjectData objData = builder.ToObjectData();
return objData;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,8 @@

namespace ILCompiler.DependencyAnalysis
{
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode, INodeWithSize
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode
{
private int? _size;
int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
=> sb.Append(nameMangler.CompilationUnitPrefix).Append("__FrozenSegmentStart"u8);
Expand DownExpand Up@@ -57,8 +55,6 @@ protected override ObjectData GetDehydratableData(NodeFactory factory, bool relo
AlignNextObject(ref builder, factory);
builder.EmitZeroPointer();

_size = builder.CountBytes;

return builder.ToObjectData();
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of ByRef types generated into the image.
/// </summary>
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;

public ByRefTypeMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__byref_type_map"u8);
Expand DownExpand Up@@ -61,8 +58,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@

namespace ILCompiler.DependencyAnalysis
{
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ClassConstructorContextMap(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__type_to_cctorContext_map"u8);
Expand DownExpand Up@@ -73,8 +70,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,8 @@ namespace ILCompiler.DependencyAnalysis
/// * Generate N bytes of zeros.
/// * Generate a relocation to Nth entry in the lookup table that supplements the dehydrated stream.
/// </remarks>
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;

public override bool IsShareable => false;

Expand All@@ -43,8 +42,6 @@ internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, IN

public int Offset => 0;

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__dehydrated_data"u8);
Expand DownExpand Up@@ -107,6 +104,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Array.Resize(ref relocSort, lastProfitableReloc);
var relocs = new Dictionary<ISymbolNode, int>(relocSort);

ObjectDataBuilder.Reservation dehydratedDataLengthReservation = builder.ReserveInt();

// Walk all the ObjectDatas and generate the dehydrated instruction stream.
byte[] buff = new byte[4];
int dehydratedSegmentPosition = 0;
Expand DownExpand Up@@ -309,7 +308,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
dehydratedSegmentPosition += o.Data.Length;
}

_size = builder.CountBytes;
builder.EmitInt(dehydratedDataLengthReservation, builder.CountBytes);

// Dehydrated data is followed by the reloc lookup table.
for (int i = 0; i < relocSort.Length; i++)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,9 +12,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of delegate marshalling stub types generated into the image.
/// </summary>
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;
private readonly InteropStateManager _interopStateManager;

Expand All@@ -24,8 +23,6 @@ public DelegateMarshallingStubMapNode(ExternalReferencesTableNode externalRefere
_interopStateManager = interopStateManager;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__delegate_marshalling_stub_map"u8);
Expand DownExpand Up@@ -70,8 +67,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,9 +14,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Hashtable of all exact (non-canonical) generic method instantiations compiled in the module.
/// </summary>
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ExactMethodInstantiationsNode(ExternalReferencesTableNode externalReferences)
Expand All@@ -29,7 +28,6 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
sb.Append(nameMangler.CompilationUnitPrefix).Append("__exact_method_instantiations"u8);
}

int INodeWithSize.Size => _size.Value;
public int Offset => 0;
public override bool IsShareable => false;
public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory);
Expand All@@ -50,7 +48,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Section nativeSection = nativeWriter.NewSection();
nativeSection.Place(hashtable);


foreach (MethodDesc method in factory.MetadataManager.GetExactMethodHashtableEntries())
{
// Get the method pointer vertex
Expand DownExpand Up@@ -98,8 +95,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] streamBytes = nativeWriter.Save();

_size = streamBytes.Length;

return new ObjectData(streamBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,9 +13,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a node that points to various symbols and can be sequentially addressed.
/// </summary>
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly string _blobName;
private readonly NodeFactory _nodeFactory;

Expand All@@ -28,8 +27,6 @@ public ExternalReferencesTableNode(string blobName, NodeFactory nodeFactory)
_nodeFactory = nodeFactory;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__external_" + _blobName + "_references");
Expand DownExpand Up@@ -102,8 +99,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
}
}

_size = builder.CountBytes;

builder.AddSymbol(this);

return builder.ToObjectData();
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,10 +96,10 @@ private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, In

// Rehydrate any dehydrated data structures
IntPtr dehydratedDataSection = RuntimeImports.RhGetModuleSection(
handle, ReadyToRunSectionType.DehydratedData, out int dehydratedDataLength);
handle, ReadyToRunSectionType.DehydratedData, out _);
if (dehydratedDataSection != IntPtr.Zero)
{
RehydrateData(dehydratedDataSection, dehydratedDataLength);
RehydrateData(dehydratedDataSection);
}

pHandles[moduleIndex++] = handle;
Expand DownExpand Up@@ -244,13 +244,16 @@ private static unsafe object[] InitializeStatics(IntPtr gcStaticRegionStart, int
=> (byte*)address + *(int*)address;
}

private static unsafe void RehydrateData(IntPtr dehydratedData, int length)
private static unsafe void RehydrateData(IntPtr dehydratedData)
{
// Destination for the hydrated data is in the first 32-bit relative pointer
byte* pDest = (byte*)ReadRelPtr32((void*)dehydratedData);

// Next is length of the dehydrated data
int length = *(int*)(dehydratedData + sizeof(int));

// The dehydrated data follows
byte* pCurrent = (byte*)dehydratedData + sizeof(int);
byte* pCurrent = (byte*)dehydratedData + sizeof(int) * 2;
byte* pEnd = (byte*)dehydratedData + length;

// Fixup table immediately follows the command stream
Expand Down
19 changes: 1 addition & 18 deletions src/coreclr/nativeaot/Runtime/TypeManager.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ void * TypeManager::GetModuleSection(ReadyToRunSectionType sectionId, int * leng
ModuleInfoRow * pCurrent = pModuleInfoRows + i;
if ((int32_t)sectionId == pCurrent->SectionId)
{
*length = pCurrent->GetLength();
*length = pCurrent->Length;
return pCurrent->Start;
}
}
Expand All@@ -79,23 +79,6 @@ void * TypeManager::GetClasslibFunction(ClasslibFunctionId functionId)
return m_pClasslibFunctions[id];
}

bool TypeManager::ModuleInfoRow::HasEndPointer()
{
return Flags & (int32_t)ModuleInfoFlags::HasEndPointer;
}

int TypeManager::ModuleInfoRow::GetLength()
{
if (HasEndPointer())
{
return (int)((uint8_t*)End - (uint8_t*)Start);
}
else
{
return sizeof(void*);
}
}

HANDLE TypeManager::GetOsModuleHandle()
{
return m_osModule;
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Runtime/TypeManager.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,12 +27,8 @@ class TypeManager
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
int32_t Length;
void * Start;
void * End;

bool HasEndPointer();
int GetLength();
};
};

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,8 +58,3 @@ enum class ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
};

enum class ModuleInfoFlags
{
HasEndPointer = 0x1,
};
Original file line numberDiff line numberDiff line change
Expand Up@@ -435,10 +435,8 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe

bool isMethod = node is IMethodBodyNode or AssemblyStubNode;
#if !READYTORUN
bool recordSize = isMethod;
long thumbBit = _nodeFactory.Target.Architecture == TargetArchitecture.ARM && isMethod ? 1 : 0;
#else
bool recordSize = true;
// R2R records the thumb bit in the addend when needed, so we don't have to do it here.
long thumbBit = 0;
#endif
Expand All@@ -462,7 +460,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
mangledName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0);
n.Offset == 0 ? nodeContents.Data.Length : 0);

_outputInfoBuilder?.AddSymbol(new OutputSymbol(sectionWriter.SectionIndex, (ulong)(sectionWriter.Position + n.Offset), mangledName));

Expand All@@ -473,7 +471,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
alternateCName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0,
n.Offset == 0 ? nodeContents.Data.Length : 0,
global: !isHidden);

if (n is IMethodNode)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,4 @@ enum ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
}

[Flags]
internal enum ModuleInfoFlags : int
{
HasEndPointer = 0x1,
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,18 +12,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of array types generated into the image.
/// </summary>
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode
{
private readonly ExternalReferencesTableNode _externalReferences;
private int? _size;

public ArrayMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__array_type_map"u8);
Expand DownExpand Up@@ -66,8 +63,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,16 +10,13 @@ namespace ILCompiler.DependencyAnalysis
/// by placing a starting symbol, followed by contents of <typeparamref name="TEmbedded"/> nodes (optionally
/// sorted using provided comparer), followed by ending symbol.
/// </summary>
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode, INodeWithSize
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode
where TEmbedded : EmbeddedObjectNode
{
private int? _size;
private HashSet<TEmbedded> _nestedNodes = new HashSet<TEmbedded>();
private List<TEmbedded> _nestedNodesList = new List<TEmbedded>();
private IComparer<TEmbedded> _sorter;

int INodeWithSize.Size => _size.Value;

public ArrayOfEmbeddedDataNode(string mangledName, IComparer<TEmbedded> nodeSorter) : base(mangledName)
{
_sorter = nodeSorter;
Expand DownExpand Up@@ -85,8 +82,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly)

GetElementDataForNodes(ref builder, factory, relocsOnly);

_size = builder.CountBytes;

ObjectData objData = builder.ToObjectData();
return objData;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,8 @@

namespace ILCompiler.DependencyAnalysis
{
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode, INodeWithSize
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode
{
private int? _size;
int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
=> sb.Append(nameMangler.CompilationUnitPrefix).Append("__FrozenSegmentStart"u8);
Expand DownExpand Up@@ -57,8 +55,6 @@ protected override ObjectData GetDehydratableData(NodeFactory factory, bool relo
AlignNextObject(ref builder, factory);
builder.EmitZeroPointer();

_size = builder.CountBytes;

return builder.ToObjectData();
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of ByRef types generated into the image.
/// </summary>
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;

public ByRefTypeMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__byref_type_map"u8);
Expand DownExpand Up@@ -61,8 +58,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@

namespace ILCompiler.DependencyAnalysis
{
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ClassConstructorContextMap(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__type_to_cctorContext_map"u8);
Expand DownExpand Up@@ -73,8 +70,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,8 @@ namespace ILCompiler.DependencyAnalysis
/// * Generate N bytes of zeros.
/// * Generate a relocation to Nth entry in the lookup table that supplements the dehydrated stream.
/// </remarks>
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;

public override bool IsShareable => false;

Expand All@@ -43,8 +42,6 @@ internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, IN

public int Offset => 0;

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__dehydrated_data"u8);
Expand DownExpand Up@@ -107,6 +104,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Array.Resize(ref relocSort, lastProfitableReloc);
var relocs = new Dictionary<ISymbolNode, int>(relocSort);

ObjectDataBuilder.Reservation dehydratedDataLengthReservation = builder.ReserveInt();

// Walk all the ObjectDatas and generate the dehydrated instruction stream.
byte[] buff = new byte[4];
int dehydratedSegmentPosition = 0;
Expand DownExpand Up@@ -309,7 +308,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
dehydratedSegmentPosition += o.Data.Length;
}

_size = builder.CountBytes;
builder.EmitInt(dehydratedDataLengthReservation, builder.CountBytes);

// Dehydrated data is followed by the reloc lookup table.
for (int i = 0; i < relocSort.Length; i++)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,9 +12,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of delegate marshalling stub types generated into the image.
/// </summary>
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;
private readonly InteropStateManager _interopStateManager;

Expand All@@ -24,8 +23,6 @@ public DelegateMarshallingStubMapNode(ExternalReferencesTableNode externalRefere
_interopStateManager = interopStateManager;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__delegate_marshalling_stub_map"u8);
Expand DownExpand Up@@ -70,8 +67,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,9 +14,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Hashtable of all exact (non-canonical) generic method instantiations compiled in the module.
/// </summary>
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ExactMethodInstantiationsNode(ExternalReferencesTableNode externalReferences)
Expand All@@ -29,7 +28,6 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
sb.Append(nameMangler.CompilationUnitPrefix).Append("__exact_method_instantiations"u8);
}

int INodeWithSize.Size => _size.Value;
public int Offset => 0;
public override bool IsShareable => false;
public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory);
Expand All@@ -50,7 +48,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Section nativeSection = nativeWriter.NewSection();
nativeSection.Place(hashtable);


foreach (MethodDesc method in factory.MetadataManager.GetExactMethodHashtableEntries())
{
// Get the method pointer vertex
Expand DownExpand Up@@ -98,8 +95,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] streamBytes = nativeWriter.Save();

_size = streamBytes.Length;

return new ObjectData(streamBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,9 +13,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a node that points to various symbols and can be sequentially addressed.
/// </summary>
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly string _blobName;
private readonly NodeFactory _nodeFactory;

Expand All@@ -28,8 +27,6 @@ public ExternalReferencesTableNode(string blobName, NodeFactory nodeFactory)
_nodeFactory = nodeFactory;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__external_" + _blobName + "_references");
Expand DownExpand Up@@ -102,8 +99,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
}
}

_size = builder.CountBytes;

builder.AddSymbol(this);

return builder.ToObjectData();
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,10 +96,10 @@ private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, In

// Rehydrate any dehydrated data structures
IntPtr dehydratedDataSection = RuntimeImports.RhGetModuleSection(
handle, ReadyToRunSectionType.DehydratedData, out int dehydratedDataLength);
handle, ReadyToRunSectionType.DehydratedData, out _);
if (dehydratedDataSection != IntPtr.Zero)
{
RehydrateData(dehydratedDataSection, dehydratedDataLength);
RehydrateData(dehydratedDataSection);
}

pHandles[moduleIndex++] = handle;
Expand DownExpand Up@@ -244,13 +244,16 @@ private static unsafe object[] InitializeStatics(IntPtr gcStaticRegionStart, int
=> (byte*)address + *(int*)address;
}

private static unsafe void RehydrateData(IntPtr dehydratedData, int length)
private static unsafe void RehydrateData(IntPtr dehydratedData)
{
// Destination for the hydrated data is in the first 32-bit relative pointer
byte* pDest = (byte*)ReadRelPtr32((void*)dehydratedData);

// Next is length of the dehydrated data
int length = *(int*)(dehydratedData + sizeof(int));

// The dehydrated data follows
byte* pCurrent = (byte*)dehydratedData + sizeof(int);
byte* pCurrent = (byte*)dehydratedData + sizeof(int) * 2;
byte* pEnd = (byte*)dehydratedData + length;

// Fixup table immediately follows the command stream
Expand Down
19 changes: 1 addition & 18 deletions src/coreclr/nativeaot/Runtime/TypeManager.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ void * TypeManager::GetModuleSection(ReadyToRunSectionType sectionId, int * leng
ModuleInfoRow * pCurrent = pModuleInfoRows + i;
if ((int32_t)sectionId == pCurrent->SectionId)
{
*length = pCurrent->GetLength();
*length = pCurrent->Length;
return pCurrent->Start;
}
}
Expand All@@ -79,23 +79,6 @@ void * TypeManager::GetClasslibFunction(ClasslibFunctionId functionId)
return m_pClasslibFunctions[id];
}

bool TypeManager::ModuleInfoRow::HasEndPointer()
{
return Flags & (int32_t)ModuleInfoFlags::HasEndPointer;
}

int TypeManager::ModuleInfoRow::GetLength()
{
if (HasEndPointer())
{
return (int)((uint8_t*)End - (uint8_t*)Start);
}
else
{
return sizeof(void*);
}
}

HANDLE TypeManager::GetOsModuleHandle()
{
return m_osModule;
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Runtime/TypeManager.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,12 +27,8 @@ class TypeManager
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
int32_t Length;
void * Start;
void * End;

bool HasEndPointer();
int GetLength();
};
};

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,8 +58,3 @@ enum class ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
};

enum class ModuleInfoFlags
{
HasEndPointer = 0x1,
};
Original file line numberDiff line numberDiff line change
Expand Up@@ -435,10 +435,8 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe

bool isMethod = node is IMethodBodyNode or AssemblyStubNode;
#if !READYTORUN
bool recordSize = isMethod;
long thumbBit = _nodeFactory.Target.Architecture == TargetArchitecture.ARM && isMethod ? 1 : 0;
#else
bool recordSize = true;
// R2R records the thumb bit in the addend when needed, so we don't have to do it here.
long thumbBit = 0;
#endif
Expand All@@ -462,7 +460,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
mangledName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0);
n.Offset == 0 ? nodeContents.Data.Length : 0);

_outputInfoBuilder?.AddSymbol(new OutputSymbol(sectionWriter.SectionIndex, (ulong)(sectionWriter.Position + n.Offset), mangledName));

Expand All@@ -473,7 +471,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
alternateCName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0,
n.Offset == 0 ? nodeContents.Data.Length : 0,
global: !isHidden);

if (n is IMethodNode)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,4 @@ enum ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
}

[Flags]
internal enum ModuleInfoFlags : int
{
HasEndPointer = 0x1,
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,18 +12,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of array types generated into the image.
/// </summary>
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode
{
private readonly ExternalReferencesTableNode _externalReferences;
private int? _size;

public ArrayMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__array_type_map"u8);
Expand DownExpand Up@@ -66,8 +63,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,16 +10,13 @@ namespace ILCompiler.DependencyAnalysis
/// by placing a starting symbol, followed by contents of <typeparamref name="TEmbedded"/> nodes (optionally
/// sorted using provided comparer), followed by ending symbol.
/// </summary>
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode, INodeWithSize
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode
where TEmbedded : EmbeddedObjectNode
{
private int? _size;
private HashSet<TEmbedded> _nestedNodes = new HashSet<TEmbedded>();
private List<TEmbedded> _nestedNodesList = new List<TEmbedded>();
private IComparer<TEmbedded> _sorter;

int INodeWithSize.Size => _size.Value;

public ArrayOfEmbeddedDataNode(string mangledName, IComparer<TEmbedded> nodeSorter) : base(mangledName)
{
_sorter = nodeSorter;
Expand DownExpand Up@@ -85,8 +82,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly)

GetElementDataForNodes(ref builder, factory, relocsOnly);

_size = builder.CountBytes;

ObjectData objData = builder.ToObjectData();
return objData;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,8 @@

namespace ILCompiler.DependencyAnalysis
{
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode, INodeWithSize
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode
{
private int? _size;
int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
=> sb.Append(nameMangler.CompilationUnitPrefix).Append("__FrozenSegmentStart"u8);
Expand DownExpand Up@@ -57,8 +55,6 @@ protected override ObjectData GetDehydratableData(NodeFactory factory, bool relo
AlignNextObject(ref builder, factory);
builder.EmitZeroPointer();

_size = builder.CountBytes;

return builder.ToObjectData();
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of ByRef types generated into the image.
/// </summary>
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;

public ByRefTypeMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__byref_type_map"u8);
Expand DownExpand Up@@ -61,8 +58,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@

namespace ILCompiler.DependencyAnalysis
{
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ClassConstructorContextMap(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__type_to_cctorContext_map"u8);
Expand DownExpand Up@@ -73,8 +70,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,8 @@ namespace ILCompiler.DependencyAnalysis
/// * Generate N bytes of zeros.
/// * Generate a relocation to Nth entry in the lookup table that supplements the dehydrated stream.
/// </remarks>
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;

public override bool IsShareable => false;

Expand All@@ -43,8 +42,6 @@ internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, IN

public int Offset => 0;

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__dehydrated_data"u8);
Expand DownExpand Up@@ -107,6 +104,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Array.Resize(ref relocSort, lastProfitableReloc);
var relocs = new Dictionary<ISymbolNode, int>(relocSort);

ObjectDataBuilder.Reservation dehydratedDataLengthReservation = builder.ReserveInt();

// Walk all the ObjectDatas and generate the dehydrated instruction stream.
byte[] buff = new byte[4];
int dehydratedSegmentPosition = 0;
Expand DownExpand Up@@ -309,7 +308,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
dehydratedSegmentPosition += o.Data.Length;
}

_size = builder.CountBytes;
builder.EmitInt(dehydratedDataLengthReservation, builder.CountBytes);

// Dehydrated data is followed by the reloc lookup table.
for (int i = 0; i < relocSort.Length; i++)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,9 +12,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of delegate marshalling stub types generated into the image.
/// </summary>
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;
private readonly InteropStateManager _interopStateManager;

Expand All@@ -24,8 +23,6 @@ public DelegateMarshallingStubMapNode(ExternalReferencesTableNode externalRefere
_interopStateManager = interopStateManager;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__delegate_marshalling_stub_map"u8);
Expand DownExpand Up@@ -70,8 +67,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,9 +14,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Hashtable of all exact (non-canonical) generic method instantiations compiled in the module.
/// </summary>
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ExactMethodInstantiationsNode(ExternalReferencesTableNode externalReferences)
Expand All@@ -29,7 +28,6 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
sb.Append(nameMangler.CompilationUnitPrefix).Append("__exact_method_instantiations"u8);
}

int INodeWithSize.Size => _size.Value;
public int Offset => 0;
public override bool IsShareable => false;
public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory);
Expand All@@ -50,7 +48,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Section nativeSection = nativeWriter.NewSection();
nativeSection.Place(hashtable);


foreach (MethodDesc method in factory.MetadataManager.GetExactMethodHashtableEntries())
{
// Get the method pointer vertex
Expand DownExpand Up@@ -98,8 +95,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] streamBytes = nativeWriter.Save();

_size = streamBytes.Length;

return new ObjectData(streamBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,9 +13,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a node that points to various symbols and can be sequentially addressed.
/// </summary>
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly string _blobName;
private readonly NodeFactory _nodeFactory;

Expand All@@ -28,8 +27,6 @@ public ExternalReferencesTableNode(string blobName, NodeFactory nodeFactory)
_nodeFactory = nodeFactory;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__external_" + _blobName + "_references");
Expand DownExpand Up@@ -102,8 +99,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
}
}

_size = builder.CountBytes;

builder.AddSymbol(this);

return builder.ToObjectData();
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,10 +96,10 @@ private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, In

// Rehydrate any dehydrated data structures
IntPtr dehydratedDataSection = RuntimeImports.RhGetModuleSection(
handle, ReadyToRunSectionType.DehydratedData, out int dehydratedDataLength);
handle, ReadyToRunSectionType.DehydratedData, out _);
if (dehydratedDataSection != IntPtr.Zero)
{
RehydrateData(dehydratedDataSection, dehydratedDataLength);
RehydrateData(dehydratedDataSection);
}

pHandles[moduleIndex++] = handle;
Expand DownExpand Up@@ -244,13 +244,16 @@ private static unsafe object[] InitializeStatics(IntPtr gcStaticRegionStart, int
=> (byte*)address + *(int*)address;
}

private static unsafe void RehydrateData(IntPtr dehydratedData, int length)
private static unsafe void RehydrateData(IntPtr dehydratedData)
{
// Destination for the hydrated data is in the first 32-bit relative pointer
byte* pDest = (byte*)ReadRelPtr32((void*)dehydratedData);

// Next is length of the dehydrated data
int length = *(int*)(dehydratedData + sizeof(int));

// The dehydrated data follows
byte* pCurrent = (byte*)dehydratedData + sizeof(int);
byte* pCurrent = (byte*)dehydratedData + sizeof(int) * 2;
byte* pEnd = (byte*)dehydratedData + length;

// Fixup table immediately follows the command stream
Expand Down
19 changes: 1 addition & 18 deletions src/coreclr/nativeaot/Runtime/TypeManager.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ void * TypeManager::GetModuleSection(ReadyToRunSectionType sectionId, int * leng
ModuleInfoRow * pCurrent = pModuleInfoRows + i;
if ((int32_t)sectionId == pCurrent->SectionId)
{
*length = pCurrent->GetLength();
*length = pCurrent->Length;
return pCurrent->Start;
}
}
Expand All@@ -79,23 +79,6 @@ void * TypeManager::GetClasslibFunction(ClasslibFunctionId functionId)
return m_pClasslibFunctions[id];
}

bool TypeManager::ModuleInfoRow::HasEndPointer()
{
return Flags & (int32_t)ModuleInfoFlags::HasEndPointer;
}

int TypeManager::ModuleInfoRow::GetLength()
{
if (HasEndPointer())
{
return (int)((uint8_t*)End - (uint8_t*)Start);
}
else
{
return sizeof(void*);
}
}

HANDLE TypeManager::GetOsModuleHandle()
{
return m_osModule;
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Runtime/TypeManager.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,12 +27,8 @@ class TypeManager
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
int32_t Length;
void * Start;
void * End;

bool HasEndPointer();
int GetLength();
};
};

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,8 +58,3 @@ enum class ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
};

enum class ModuleInfoFlags
{
HasEndPointer = 0x1,
};
Original file line numberDiff line numberDiff line change
Expand Up@@ -435,10 +435,8 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe

bool isMethod = node is IMethodBodyNode or AssemblyStubNode;
#if !READYTORUN
bool recordSize = isMethod;
long thumbBit = _nodeFactory.Target.Architecture == TargetArchitecture.ARM && isMethod ? 1 : 0;
#else
bool recordSize = true;
// R2R records the thumb bit in the addend when needed, so we don't have to do it here.
long thumbBit = 0;
#endif
Expand All@@ -462,7 +460,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
mangledName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0);
n.Offset == 0 ? nodeContents.Data.Length : 0);

_outputInfoBuilder?.AddSymbol(new OutputSymbol(sectionWriter.SectionIndex, (ulong)(sectionWriter.Position + n.Offset), mangledName));

Expand All@@ -473,7 +471,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
alternateCName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0,
n.Offset == 0 ? nodeContents.Data.Length : 0,
global: !isHidden);

if (n is IMethodNode)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,4 @@ enum ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
}

[Flags]
internal enum ModuleInfoFlags : int
{
HasEndPointer = 0x1,
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,18 +12,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of array types generated into the image.
/// </summary>
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode
{
private readonly ExternalReferencesTableNode _externalReferences;
private int? _size;

public ArrayMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__array_type_map"u8);
Expand DownExpand Up@@ -66,8 +63,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,16 +10,13 @@ namespace ILCompiler.DependencyAnalysis
/// by placing a starting symbol, followed by contents of <typeparamref name="TEmbedded"/> nodes (optionally
/// sorted using provided comparer), followed by ending symbol.
/// </summary>
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode, INodeWithSize
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode
where TEmbedded : EmbeddedObjectNode
{
private int? _size;
private HashSet<TEmbedded> _nestedNodes = new HashSet<TEmbedded>();
private List<TEmbedded> _nestedNodesList = new List<TEmbedded>();
private IComparer<TEmbedded> _sorter;

int INodeWithSize.Size => _size.Value;

public ArrayOfEmbeddedDataNode(string mangledName, IComparer<TEmbedded> nodeSorter) : base(mangledName)
{
_sorter = nodeSorter;
Expand DownExpand Up@@ -85,8 +82,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly)

GetElementDataForNodes(ref builder, factory, relocsOnly);

_size = builder.CountBytes;

ObjectData objData = builder.ToObjectData();
return objData;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,8 @@

namespace ILCompiler.DependencyAnalysis
{
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode, INodeWithSize
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode
{
private int? _size;
int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
=> sb.Append(nameMangler.CompilationUnitPrefix).Append("__FrozenSegmentStart"u8);
Expand DownExpand Up@@ -57,8 +55,6 @@ protected override ObjectData GetDehydratableData(NodeFactory factory, bool relo
AlignNextObject(ref builder, factory);
builder.EmitZeroPointer();

_size = builder.CountBytes;

return builder.ToObjectData();
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of ByRef types generated into the image.
/// </summary>
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;

public ByRefTypeMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__byref_type_map"u8);
Expand DownExpand Up@@ -61,8 +58,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@

namespace ILCompiler.DependencyAnalysis
{
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ClassConstructorContextMap(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__type_to_cctorContext_map"u8);
Expand DownExpand Up@@ -73,8 +70,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,8 @@ namespace ILCompiler.DependencyAnalysis
/// * Generate N bytes of zeros.
/// * Generate a relocation to Nth entry in the lookup table that supplements the dehydrated stream.
/// </remarks>
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;

public override bool IsShareable => false;

Expand All@@ -43,8 +42,6 @@ internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, IN

public int Offset => 0;

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__dehydrated_data"u8);
Expand DownExpand Up@@ -107,6 +104,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Array.Resize(ref relocSort, lastProfitableReloc);
var relocs = new Dictionary<ISymbolNode, int>(relocSort);

ObjectDataBuilder.Reservation dehydratedDataLengthReservation = builder.ReserveInt();

// Walk all the ObjectDatas and generate the dehydrated instruction stream.
byte[] buff = new byte[4];
int dehydratedSegmentPosition = 0;
Expand DownExpand Up@@ -309,7 +308,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
dehydratedSegmentPosition += o.Data.Length;
}

_size = builder.CountBytes;
builder.EmitInt(dehydratedDataLengthReservation, builder.CountBytes);

// Dehydrated data is followed by the reloc lookup table.
for (int i = 0; i < relocSort.Length; i++)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,9 +12,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of delegate marshalling stub types generated into the image.
/// </summary>
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;
private readonly InteropStateManager _interopStateManager;

Expand All@@ -24,8 +23,6 @@ public DelegateMarshallingStubMapNode(ExternalReferencesTableNode externalRefere
_interopStateManager = interopStateManager;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__delegate_marshalling_stub_map"u8);
Expand DownExpand Up@@ -70,8 +67,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,9 +14,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Hashtable of all exact (non-canonical) generic method instantiations compiled in the module.
/// </summary>
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ExactMethodInstantiationsNode(ExternalReferencesTableNode externalReferences)
Expand All@@ -29,7 +28,6 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
sb.Append(nameMangler.CompilationUnitPrefix).Append("__exact_method_instantiations"u8);
}

int INodeWithSize.Size => _size.Value;
public int Offset => 0;
public override bool IsShareable => false;
public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory);
Expand All@@ -50,7 +48,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Section nativeSection = nativeWriter.NewSection();
nativeSection.Place(hashtable);


foreach (MethodDesc method in factory.MetadataManager.GetExactMethodHashtableEntries())
{
// Get the method pointer vertex
Expand DownExpand Up@@ -98,8 +95,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] streamBytes = nativeWriter.Save();

_size = streamBytes.Length;

return new ObjectData(streamBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,9 +13,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a node that points to various symbols and can be sequentially addressed.
/// </summary>
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly string _blobName;
private readonly NodeFactory _nodeFactory;

Expand All@@ -28,8 +27,6 @@ public ExternalReferencesTableNode(string blobName, NodeFactory nodeFactory)
_nodeFactory = nodeFactory;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__external_" + _blobName + "_references");
Expand DownExpand Up@@ -102,8 +99,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
}
}

_size = builder.CountBytes;

builder.AddSymbol(this);

return builder.ToObjectData();
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,10 +96,10 @@ private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, In

// Rehydrate any dehydrated data structures
IntPtr dehydratedDataSection = RuntimeImports.RhGetModuleSection(
handle, ReadyToRunSectionType.DehydratedData, out int dehydratedDataLength);
handle, ReadyToRunSectionType.DehydratedData, out _);
if (dehydratedDataSection != IntPtr.Zero)
{
RehydrateData(dehydratedDataSection, dehydratedDataLength);
RehydrateData(dehydratedDataSection);
}

pHandles[moduleIndex++] = handle;
Expand DownExpand Up@@ -244,13 +244,16 @@ private static unsafe object[] InitializeStatics(IntPtr gcStaticRegionStart, int
=> (byte*)address + *(int*)address;
}

private static unsafe void RehydrateData(IntPtr dehydratedData, int length)
private static unsafe void RehydrateData(IntPtr dehydratedData)
{
// Destination for the hydrated data is in the first 32-bit relative pointer
byte* pDest = (byte*)ReadRelPtr32((void*)dehydratedData);

// Next is length of the dehydrated data
int length = *(int*)(dehydratedData + sizeof(int));

// The dehydrated data follows
byte* pCurrent = (byte*)dehydratedData + sizeof(int);
byte* pCurrent = (byte*)dehydratedData + sizeof(int) * 2;
byte* pEnd = (byte*)dehydratedData + length;

// Fixup table immediately follows the command stream
Expand Down
19 changes: 1 addition & 18 deletions src/coreclr/nativeaot/Runtime/TypeManager.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ void * TypeManager::GetModuleSection(ReadyToRunSectionType sectionId, int * leng
ModuleInfoRow * pCurrent = pModuleInfoRows + i;
if ((int32_t)sectionId == pCurrent->SectionId)
{
*length = pCurrent->GetLength();
*length = pCurrent->Length;
return pCurrent->Start;
}
}
Expand All@@ -79,23 +79,6 @@ void * TypeManager::GetClasslibFunction(ClasslibFunctionId functionId)
return m_pClasslibFunctions[id];
}

bool TypeManager::ModuleInfoRow::HasEndPointer()
{
return Flags & (int32_t)ModuleInfoFlags::HasEndPointer;
}

int TypeManager::ModuleInfoRow::GetLength()
{
if (HasEndPointer())
{
return (int)((uint8_t*)End - (uint8_t*)Start);
}
else
{
return sizeof(void*);
}
}

HANDLE TypeManager::GetOsModuleHandle()
{
return m_osModule;
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Runtime/TypeManager.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,12 +27,8 @@ class TypeManager
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
int32_t Length;
void * Start;
void * End;

bool HasEndPointer();
int GetLength();
};
};

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,8 +58,3 @@ enum class ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
};

enum class ModuleInfoFlags
{
HasEndPointer = 0x1,
};
Original file line numberDiff line numberDiff line change
Expand Up@@ -435,10 +435,8 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe

bool isMethod = node is IMethodBodyNode or AssemblyStubNode;
#if !READYTORUN
bool recordSize = isMethod;
long thumbBit = _nodeFactory.Target.Architecture == TargetArchitecture.ARM && isMethod ? 1 : 0;
#else
bool recordSize = true;
// R2R records the thumb bit in the addend when needed, so we don't have to do it here.
long thumbBit = 0;
#endif
Expand All@@ -462,7 +460,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
mangledName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0);
n.Offset == 0 ? nodeContents.Data.Length : 0);

_outputInfoBuilder?.AddSymbol(new OutputSymbol(sectionWriter.SectionIndex, (ulong)(sectionWriter.Position + n.Offset), mangledName));

Expand All@@ -473,7 +471,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
alternateCName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0,
n.Offset == 0 ? nodeContents.Data.Length : 0,
global: !isHidden);

if (n is IMethodNode)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,4 @@ enum ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
}

[Flags]
internal enum ModuleInfoFlags : int
{
HasEndPointer = 0x1,
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,18 +12,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of array types generated into the image.
/// </summary>
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode
{
private readonly ExternalReferencesTableNode _externalReferences;
private int? _size;

public ArrayMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__array_type_map"u8);
Expand DownExpand Up@@ -66,8 +63,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,16 +10,13 @@ namespace ILCompiler.DependencyAnalysis
/// by placing a starting symbol, followed by contents of <typeparamref name="TEmbedded"/> nodes (optionally
/// sorted using provided comparer), followed by ending symbol.
/// </summary>
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode, INodeWithSize
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode
where TEmbedded : EmbeddedObjectNode
{
private int? _size;
private HashSet<TEmbedded> _nestedNodes = new HashSet<TEmbedded>();
private List<TEmbedded> _nestedNodesList = new List<TEmbedded>();
private IComparer<TEmbedded> _sorter;

int INodeWithSize.Size => _size.Value;

public ArrayOfEmbeddedDataNode(string mangledName, IComparer<TEmbedded> nodeSorter) : base(mangledName)
{
_sorter = nodeSorter;
Expand DownExpand Up@@ -85,8 +82,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly)

GetElementDataForNodes(ref builder, factory, relocsOnly);

_size = builder.CountBytes;

ObjectData objData = builder.ToObjectData();
return objData;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,8 @@

namespace ILCompiler.DependencyAnalysis
{
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode, INodeWithSize
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode
{
private int? _size;
int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
=> sb.Append(nameMangler.CompilationUnitPrefix).Append("__FrozenSegmentStart"u8);
Expand DownExpand Up@@ -57,8 +55,6 @@ protected override ObjectData GetDehydratableData(NodeFactory factory, bool relo
AlignNextObject(ref builder, factory);
builder.EmitZeroPointer();

_size = builder.CountBytes;

return builder.ToObjectData();
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of ByRef types generated into the image.
/// </summary>
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;

public ByRefTypeMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__byref_type_map"u8);
Expand DownExpand Up@@ -61,8 +58,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@

namespace ILCompiler.DependencyAnalysis
{
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ClassConstructorContextMap(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__type_to_cctorContext_map"u8);
Expand DownExpand Up@@ -73,8 +70,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,8 @@ namespace ILCompiler.DependencyAnalysis
/// * Generate N bytes of zeros.
/// * Generate a relocation to Nth entry in the lookup table that supplements the dehydrated stream.
/// </remarks>
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;

public override bool IsShareable => false;

Expand All@@ -43,8 +42,6 @@ internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, IN

public int Offset => 0;

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__dehydrated_data"u8);
Expand DownExpand Up@@ -107,6 +104,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Array.Resize(ref relocSort, lastProfitableReloc);
var relocs = new Dictionary<ISymbolNode, int>(relocSort);

ObjectDataBuilder.Reservation dehydratedDataLengthReservation = builder.ReserveInt();

// Walk all the ObjectDatas and generate the dehydrated instruction stream.
byte[] buff = new byte[4];
int dehydratedSegmentPosition = 0;
Expand DownExpand Up@@ -309,7 +308,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
dehydratedSegmentPosition += o.Data.Length;
}

_size = builder.CountBytes;
builder.EmitInt(dehydratedDataLengthReservation, builder.CountBytes);

// Dehydrated data is followed by the reloc lookup table.
for (int i = 0; i < relocSort.Length; i++)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,9 +12,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of delegate marshalling stub types generated into the image.
/// </summary>
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;
private readonly InteropStateManager _interopStateManager;

Expand All@@ -24,8 +23,6 @@ public DelegateMarshallingStubMapNode(ExternalReferencesTableNode externalRefere
_interopStateManager = interopStateManager;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__delegate_marshalling_stub_map"u8);
Expand DownExpand Up@@ -70,8 +67,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,9 +14,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Hashtable of all exact (non-canonical) generic method instantiations compiled in the module.
/// </summary>
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ExactMethodInstantiationsNode(ExternalReferencesTableNode externalReferences)
Expand All@@ -29,7 +28,6 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
sb.Append(nameMangler.CompilationUnitPrefix).Append("__exact_method_instantiations"u8);
}

int INodeWithSize.Size => _size.Value;
public int Offset => 0;
public override bool IsShareable => false;
public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory);
Expand All@@ -50,7 +48,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Section nativeSection = nativeWriter.NewSection();
nativeSection.Place(hashtable);


foreach (MethodDesc method in factory.MetadataManager.GetExactMethodHashtableEntries())
{
// Get the method pointer vertex
Expand DownExpand Up@@ -98,8 +95,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] streamBytes = nativeWriter.Save();

_size = streamBytes.Length;

return new ObjectData(streamBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,9 +13,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a node that points to various symbols and can be sequentially addressed.
/// </summary>
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly string _blobName;
private readonly NodeFactory _nodeFactory;

Expand All@@ -28,8 +27,6 @@ public ExternalReferencesTableNode(string blobName, NodeFactory nodeFactory)
_nodeFactory = nodeFactory;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__external_" + _blobName + "_references");
Expand DownExpand Up@@ -102,8 +99,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
}
}

_size = builder.CountBytes;

builder.AddSymbol(this);

return builder.ToObjectData();
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,10 +96,10 @@ private static unsafe TypeManagerHandle[] CreateTypeManagers(IntPtr osModule, In

// Rehydrate any dehydrated data structures
IntPtr dehydratedDataSection = RuntimeImports.RhGetModuleSection(
handle, ReadyToRunSectionType.DehydratedData, out int dehydratedDataLength);
handle, ReadyToRunSectionType.DehydratedData, out _);
if (dehydratedDataSection != IntPtr.Zero)
{
RehydrateData(dehydratedDataSection, dehydratedDataLength);
RehydrateData(dehydratedDataSection);
}

pHandles[moduleIndex++] = handle;
Expand DownExpand Up@@ -244,13 +244,16 @@ private static unsafe object[] InitializeStatics(IntPtr gcStaticRegionStart, int
=> (byte*)address + *(int*)address;
}

private static unsafe void RehydrateData(IntPtr dehydratedData, int length)
private static unsafe void RehydrateData(IntPtr dehydratedData)
{
// Destination for the hydrated data is in the first 32-bit relative pointer
byte* pDest = (byte*)ReadRelPtr32((void*)dehydratedData);

// Next is length of the dehydrated data
int length = *(int*)(dehydratedData + sizeof(int));

// The dehydrated data follows
byte* pCurrent = (byte*)dehydratedData + sizeof(int);
byte* pCurrent = (byte*)dehydratedData + sizeof(int) * 2;
byte* pEnd = (byte*)dehydratedData + length;

// Fixup table immediately follows the command stream
Expand Down
19 changes: 1 addition & 18 deletions src/coreclr/nativeaot/Runtime/TypeManager.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,7 +60,7 @@ void * TypeManager::GetModuleSection(ReadyToRunSectionType sectionId, int * leng
ModuleInfoRow * pCurrent = pModuleInfoRows + i;
if ((int32_t)sectionId == pCurrent->SectionId)
{
*length = pCurrent->GetLength();
*length = pCurrent->Length;
return pCurrent->Start;
}
}
Expand All@@ -79,23 +79,6 @@ void * TypeManager::GetClasslibFunction(ClasslibFunctionId functionId)
return m_pClasslibFunctions[id];
}

bool TypeManager::ModuleInfoRow::HasEndPointer()
{
return Flags & (int32_t)ModuleInfoFlags::HasEndPointer;
}

int TypeManager::ModuleInfoRow::GetLength()
{
if (HasEndPointer())
{
return (int)((uint8_t*)End - (uint8_t*)Start);
}
else
{
return sizeof(void*);
}
}

HANDLE TypeManager::GetOsModuleHandle()
{
return m_osModule;
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/nativeaot/Runtime/TypeManager.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,12 +27,8 @@ class TypeManager
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
int32_t Length;
void * Start;
void * End;

bool HasEndPointer();
int GetLength();
};
};

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,8 +58,3 @@ enum class ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
};

enum class ModuleInfoFlags
{
HasEndPointer = 0x1,
};
Original file line numberDiff line numberDiff line change
Expand Up@@ -435,10 +435,8 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe

bool isMethod = node is IMethodBodyNode or AssemblyStubNode;
#if !READYTORUN
bool recordSize = isMethod;
long thumbBit = _nodeFactory.Target.Architecture == TargetArchitecture.ARM && isMethod ? 1 : 0;
#else
bool recordSize = true;
// R2R records the thumb bit in the addend when needed, so we don't have to do it here.
long thumbBit = 0;
#endif
Expand All@@ -462,7 +460,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
mangledName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0);
n.Offset == 0 ? nodeContents.Data.Length : 0);

_outputInfoBuilder?.AddSymbol(new OutputSymbol(sectionWriter.SectionIndex, (ulong)(sectionWriter.Position + n.Offset), mangledName));

Expand All@@ -473,7 +471,7 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection<Depe
sectionWriter.EmitSymbolDefinition(
alternateCName,
n.Offset + thumbBit,
n.Offset == 0 && recordSize ? nodeContents.Data.Length : 0,
n.Offset == 0 ? nodeContents.Data.Length : 0,
global: !isHidden);

if (n is IMethodNode)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,10 +102,4 @@ enum ReadyToRunSectionType
ReadonlyBlobRegionStart = 300,
ReadonlyBlobRegionEnd = 399,
}

[Flags]
internal enum ModuleInfoFlags : int
{
HasEndPointer = 0x1,
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,18 +12,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of array types generated into the image.
/// </summary>
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ArrayMapNode : ObjectNode, ISymbolDefinitionNode
{
private readonly ExternalReferencesTableNode _externalReferences;
private int? _size;

public ArrayMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__array_type_map"u8);
Expand DownExpand Up@@ -66,8 +63,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,16 +10,13 @@ namespace ILCompiler.DependencyAnalysis
/// by placing a starting symbol, followed by contents of <typeparamref name="TEmbedded"/> nodes (optionally
/// sorted using provided comparer), followed by ending symbol.
/// </summary>
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode, INodeWithSize
public class ArrayOfEmbeddedDataNode<TEmbedded> : EmbeddedDataContainerNode
where TEmbedded : EmbeddedObjectNode
{
private int? _size;
private HashSet<TEmbedded> _nestedNodes = new HashSet<TEmbedded>();
private List<TEmbedded> _nestedNodesList = new List<TEmbedded>();
private IComparer<TEmbedded> _sorter;

int INodeWithSize.Size => _size.Value;

public ArrayOfEmbeddedDataNode(string mangledName, IComparer<TEmbedded> nodeSorter) : base(mangledName)
{
_sorter = nodeSorter;
Expand DownExpand Up@@ -85,8 +82,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly)

GetElementDataForNodes(ref builder, factory, relocsOnly);

_size = builder.CountBytes;

ObjectData objData = builder.ToObjectData();
return objData;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,8 @@

namespace ILCompiler.DependencyAnalysis
{
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode, INodeWithSize
public class ArrayOfFrozenObjectsNode : DehydratableObjectNode, ISymbolDefinitionNode
{
private int? _size;
int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
=> sb.Append(nameMangler.CompilationUnitPrefix).Append("__FrozenSegmentStart"u8);
Expand DownExpand Up@@ -57,8 +55,6 @@ protected override ObjectData GetDehydratableData(NodeFactory factory, bool relo
AlignNextObject(ref builder, factory);
builder.EmitZeroPointer();

_size = builder.CountBytes;

return builder.ToObjectData();
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of ByRef types generated into the image.
/// </summary>
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ByRefTypeMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;

public ByRefTypeMapNode(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__byref_type_map"u8);
Expand DownExpand Up@@ -61,8 +58,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,18 +11,15 @@

namespace ILCompiler.DependencyAnalysis
{
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class ClassConstructorContextMap : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ClassConstructorContextMap(ExternalReferencesTableNode externalReferences)
{
_externalReferences = externalReferences;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__type_to_cctorContext_map"u8);
Expand DownExpand Up@@ -73,8 +70,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,8 @@ namespace ILCompiler.DependencyAnalysis
/// * Generate N bytes of zeros.
/// * Generate a relocation to Nth entry in the lookup table that supplements the dehydrated stream.
/// </remarks>
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;

public override bool IsShareable => false;

Expand All@@ -43,8 +42,6 @@ internal sealed class DehydratedDataNode : ObjectNode, ISymbolDefinitionNode, IN

public int Offset => 0;

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__dehydrated_data"u8);
Expand DownExpand Up@@ -107,6 +104,8 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Array.Resize(ref relocSort, lastProfitableReloc);
var relocs = new Dictionary<ISymbolNode, int>(relocSort);

ObjectDataBuilder.Reservation dehydratedDataLengthReservation = builder.ReserveInt();

// Walk all the ObjectDatas and generate the dehydrated instruction stream.
byte[] buff = new byte[4];
int dehydratedSegmentPosition = 0;
Expand DownExpand Up@@ -309,7 +308,7 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
dehydratedSegmentPosition += o.Data.Length;
}

_size = builder.CountBytes;
builder.EmitInt(dehydratedDataLengthReservation, builder.CountBytes);

// Dehydrated data is followed by the reloc lookup table.
for (int i = 0; i < relocSort.Length; i++)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,9 +12,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a hash table of delegate marshalling stub types generated into the image.
/// </summary>
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
internal sealed class DelegateMarshallingStubMapNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly ExternalReferencesTableNode _externalReferences;
private readonly InteropStateManager _interopStateManager;

Expand All@@ -24,8 +23,6 @@ public DelegateMarshallingStubMapNode(ExternalReferencesTableNode externalRefere
_interopStateManager = interopStateManager;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__delegate_marshalling_stub_map"u8);
Expand DownExpand Up@@ -70,8 +67,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] hashTableBytes = writer.Save();

_size = hashTableBytes.Length;

return new ObjectData(hashTableBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,9 +14,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Hashtable of all exact (non-canonical) generic method instantiations compiled in the module.
/// </summary>
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExactMethodInstantiationsNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private ExternalReferencesTableNode _externalReferences;

public ExactMethodInstantiationsNode(ExternalReferencesTableNode externalReferences)
Expand All@@ -29,7 +28,6 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
sb.Append(nameMangler.CompilationUnitPrefix).Append("__exact_method_instantiations"u8);
}

int INodeWithSize.Size => _size.Value;
public int Offset => 0;
public override bool IsShareable => false;
public override ObjectNodeSection GetSection(NodeFactory factory) => _externalReferences.GetSection(factory);
Expand All@@ -50,7 +48,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
Section nativeSection = nativeWriter.NewSection();
nativeSection.Place(hashtable);


foreach (MethodDesc method in factory.MetadataManager.GetExactMethodHashtableEntries())
{
// Get the method pointer vertex
Expand DownExpand Up@@ -98,8 +95,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)

byte[] streamBytes = nativeWriter.Save();

_size = streamBytes.Length;

return new ObjectData(streamBytes, Array.Empty<Relocation>(), 1, new ISymbolDefinitionNode[] { this });
}

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,9 +13,8 @@ namespace ILCompiler.DependencyAnalysis
/// <summary>
/// Represents a node that points to various symbols and can be sequentially addressed.
/// </summary>
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode, INodeWithSize
public sealed class ExternalReferencesTableNode : ObjectNode, ISymbolDefinitionNode
{
private int? _size;
private readonly string _blobName;
private readonly NodeFactory _nodeFactory;

Expand All@@ -28,8 +27,6 @@ public ExternalReferencesTableNode(string blobName, NodeFactory nodeFactory)
_nodeFactory = nodeFactory;
}

int INodeWithSize.Size => _size.Value;

public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.CompilationUnitPrefix).Append("__external_" + _blobName + "_references");
Expand DownExpand Up@@ -102,8 +99,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
}
}

_size = builder.CountBytes;

builder.AddSymbol(this);

return builder.ToObjectData();
Expand Down
Loading
Loading