Skip to content

Commit

Permalink
Remove unused System.Reflection.Emit leftovers
Browse files Browse the repository at this point in the history
Follow up to dotnet#56153
  • Loading branch information
i3arnon committed Aug 1, 2021
1 parent 26ddd7a commit 75e06f1
Show file tree
Hide file tree
Showing 13 changed files with 4 additions and 1,013 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
Expand Down Expand Up @@ -136,7 +136,6 @@
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\StackFrame.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\StackFrameHelper.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\StackTrace.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\SymbolStore\ISymWriter.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\SymbolStore\SymAddressKind.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\SymbolStore\Token.cs" />
<Compile Include="$(BclSourcesRoot)\System\Enum.CoreCLR.cs" />
Expand Down Expand Up @@ -166,7 +165,6 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\FieldBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\GenericTypeParameterBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\ILGenerator.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\ISymWrapperCore.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\LocalBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\MethodBuilder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\MethodBuilderInstantiation.cs" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -304,18 +304,15 @@ internal static AssemblyBuilder InternalDefineDynamicAssembly(
/// a transient module.
/// </summary>
[DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod.
public ModuleBuilder DefineDynamicModule(string name) =>
DefineDynamicModuleInternal(name, emitSymbolInfo: false);

private ModuleBuilder DefineDynamicModuleInternal(string name, bool emitSymbolInfo)
public ModuleBuilder DefineDynamicModule(string name)
{
lock (SyncRoot)
{
return DefineDynamicModuleInternalNoLock(name, emitSymbolInfo);
return DefineDynamicModuleInternalNoLock(name);
}
}

private ModuleBuilder DefineDynamicModuleInternalNoLock(string name, bool emitSymbolInfo)
private ModuleBuilder DefineDynamicModuleInternalNoLock(string name)
{
if (name == null)
{
Expand All @@ -341,19 +338,6 @@ private ModuleBuilder DefineDynamicModuleInternalNoLock(string name, bool emitSy
// Init(...) has already been called on _manifestModuleBuilder in InitManifestModule()
ModuleBuilder dynModule = _manifestModuleBuilder;

// Create the symbol writer
ISymbolWriter? writer = null;
if (emitSymbolInfo)
{
writer = SymWrapperCore.SymWriter.CreateSymWriter();

// Pass the "real" module to the VM.
// This symfile is never written to disk so filename does not matter.
IntPtr pInternalSymWriter = ModuleBuilder.nCreateISymWriterForDynamicModule(dynModule.InternalModule, "Unused");
((SymWrapperCore.SymWriter)writer).InternalSetUnderlyingWriter(pInternalSymWriter);
}

dynModule.SetSymWriter(writer);
_assemblyData._moduleBuilderList.Add(dynModule);

if (dynModule == _manifestModuleBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1681,25 +1681,6 @@ internal void EnsureCapacity()
}
}

internal void EmitScopeTree(ISymbolWriter symWriter)
{
for (int i = 0; i < m_iCount; i++)
{
if (m_ScopeActions[i] == ScopeAction.Open)
{
symWriter.OpenScope(m_iOffsets[i]);
}
else
{
symWriter.CloseScope(m_iOffsets[i]);
}
if (m_localSymInfos[i] is LocalSymInfo lsi)
{
lsi.EmitLocalSymInfo(symWriter);
}
}
}

internal int[] m_iOffsets = null!; // array of offsets
internal ScopeAction[] m_ScopeActions = null!; // array of scope actions
internal int m_iCount; // how many entries in the arrays are occupied
Expand Down Expand Up @@ -1780,12 +1761,6 @@ private void EnsureCapacity()
}
}

internal void EmitLineNumberInfo(ISymbolWriter symWriter)
{
for (int i = 0; i < m_DocumentCount; i++)
m_Documents[i].EmitLineNumberInfo(symWriter);
}

private int m_DocumentCount; // how many documents that we have right now
private REDocument[] m_Documents = null!; // array of documents
private const int InitialSize = 16;
Expand Down Expand Up @@ -1866,29 +1841,6 @@ private void EnsureCapacity()
}
}

internal void EmitLineNumberInfo(ISymbolWriter symWriter)
{
if (m_iLineNumberCount == 0)
return;
// reduce the array size to be exact
int[] iOffsetsTemp = new int[m_iLineNumberCount];
Array.Copy(m_iOffsets, iOffsetsTemp, m_iLineNumberCount);

int[] iLinesTemp = new int[m_iLineNumberCount];
Array.Copy(m_iLines, iLinesTemp, m_iLineNumberCount);

int[] iColumnsTemp = new int[m_iLineNumberCount];
Array.Copy(m_iColumns, iColumnsTemp, m_iLineNumberCount);

int[] iEndLinesTemp = new int[m_iLineNumberCount];
Array.Copy(m_iEndLines, iEndLinesTemp, m_iLineNumberCount);

int[] iEndColumnsTemp = new int[m_iLineNumberCount];
Array.Copy(m_iEndColumns, iEndColumnsTemp, m_iLineNumberCount);

symWriter.DefineSequencePoints(m_document, iOffsetsTemp, iLinesTemp, iColumnsTemp, iEndLinesTemp, iEndColumnsTemp);
}

private int[] m_iOffsets = null!; // array of offsets
private int[] m_iLines = null!; // array of offsets
private int[] m_iColumns = null!; // array of offsets
Expand Down
Loading

0 comments on commit 75e06f1

Please sign in to comment.