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 number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ public void WriteBytes(byte[] buffer, int start, int byteCount)
WriteBytes(buffer.AsSpan(start, byteCount));
}

private void WriteBytes(ReadOnlySpan<byte> buffer)
internal void WriteBytes(ReadOnlySpan<byte> buffer)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move below public methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to not move it to minimize changes. It will become public with #85280 either way.

{
if (!IsHead)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public ManagedTextSection(

public const int ManagedResourcesDataAlignment = 8;

private const string CorEntryPointDll = "mscoree.dll";
private string CorEntryPointName => (ImageCharacteristics & Characteristics.Dll) != 0 ? "_CorDllMain" : "_CorExeMain";
private static ReadOnlySpan<byte> CorEntryPointDll => "mscoree.dll"u8;
private ReadOnlySpan<byte> CorEntryPointName => (ImageCharacteristics & Characteristics.Dll) != 0 ? "_CorDllMain"u8 : "_CorExeMain"u8;

private int SizeOfImportAddressTable => RequiresStartupStub ? (Is32Bit ? 2 * sizeof(uint) : 2 * sizeof(ulong)) : 0;

Expand Down Expand Up @@ -365,11 +365,7 @@ private void WriteImportTable(BlobBuilder builder, int importTableRva, int impor
// Hint table
builder.WriteUInt16(0); // Hint 54|58

foreach (char ch in CorEntryPointName)
{
builder.WriteByte((byte)ch); // 65|69
}

builder.WriteBytes(CorEntryPointName); // 65|69
builder.WriteByte(0); // 66|70
Debug.Assert(builder.Count - start == SizeOfImportTable);
}
Expand All @@ -378,11 +374,7 @@ private static void WriteNameTable(BlobBuilder builder)
{
int start = builder.Count;

foreach (char ch in CorEntryPointDll)
{
builder.WriteByte((byte)ch);
}

builder.WriteBytes(CorEntryPointDll);
builder.WriteByte(0);
builder.WriteUInt16(0);
Debug.Assert(builder.Count - start == SizeOfNameTable);
Expand Down