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
6 changes: 3 additions & 3 deletions docs/design/datacontracts/Loader.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ enum ClrModifiableAssemblies : uint
| `CGrowableSymbolStream` | `Buffer` | `pointer` | Pointer to the in-memory symbol stream buffer |
| `CGrowableSymbolStream` | `Size` | `uint32` | Size of the symbol stream buffer in bytes |
| `DynamicILBlobTable` | *(type size)* | `uint32` | Size in bytes of each table entry |
| `DynamicILBlobTable` | `EntryIL` | `pointer` | Offset of the IL pointer within each dynamic IL table entry |
| `DynamicILBlobTable` | `EntryMethodToken` | `uint32` | Offset of the method token within each dynamic IL table entry |
| `DynamicILBlobTable` | `EntryIL` | `pointer` | Offset of the IL-body or RVA-field-data pointer within each entry |
| `DynamicILBlobTable` | `EntryMethodToken` | `uint32` | Offset of the full MethodDef or FieldDef token within each entry |
| `DynamicILBlobTable` | `Table` | `pointer` | Address of the SHash table |
| `DynamicILBlobTable` | `TableSize` | `uint32` | Number of entries in the table |
| `EEConfig` | `ModifiableAssemblies` | `uint32` | Edit and Continue configuration represented by `ClrModifiableAssemblies` |
Expand Down Expand Up @@ -199,7 +199,7 @@ enum ClrModifiableAssemblies : uint
| `Module` | `Assembly` | `pointer` | Pointer to the containing assembly |
| `Module` | `AvailableTypeParams` | `pointer` | Pointer to the available type-parameter hash table |
| `Module` | `Base` | `pointer` | Base address of the module's loaded image |
| `Module` | `DynamicILBlobTable` | `pointer` | Pointer to the table of dynamically supplied IL bodies |
| `Module` | `DynamicILBlobTable` | `pointer` | Pointer to the token-keyed table of dynamically supplied IL bodies and RVA field data |
| `Module` | `FieldDefToDescMap` | `pointer` | Pointer to the field-definition-to-field-descriptor lookup map |
| `Module` | `FileName` | `pointer` | Pointer to the null-terminated UTF-16 module file name |
| `Module` | `Flags` | `uint32` | Module state and capability flags |
Expand Down
2 changes: 1 addition & 1 deletion docs/design/datacontracts/RuntimeTypeSystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ static class RuntimeTypeSystem_1_Helpers
| `CoreLib` | `pointer` | Pointer to the CoreLibBinder data containing well-known core library type handles |
| `ExceptionMethodTable` | `pointer` | A pointer to the address of the System.Exception MethodTable (g_pExceptionClass) |
| `FieldOffsetBigRVA` | `uint32` | Sentinel value of FieldDesc::DWord2 indicating the field is an RVA static whose offset is too large to encode in the bitfield; the real offset must be read from the field's metadata (FieldDefinition.GetRelativeVirtualAddress). |
| `FieldOffsetDynamicRVA` | `uint32` | Sentinel FieldDesc offset for an EnC-added RVA field whose enclosing type is not yet loaded |
| `FieldOffsetDynamicRVA` | `uint32` | Sentinel FieldDesc offset for token-backed RVA field data, including Reflection.Emit fields and EnC-added fields whose enclosing type was not yet loaded when the field was added |
| `FreeObjectMethodTable` | `pointer` | A pointer to the address of a MethodTable used by the GC to indicate reclaimed memory |
| `MethodDescAlignment` | `uint64` | MethodDescChunk trailing data is allocated in multiples of this constant. The size (in bytes) of each MethodDesc (or subclass) instance is a multiple of this constant. |
| `MethodDescTokenRemainderBitCount` | `uint8` | Number of bits in the token remainder in MethodDesc |
Expand Down
8 changes: 4 additions & 4 deletions docs/design/datacontracts/data-descriptor-meanings.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@
"DynamicHelperFrame.DynamicHelperFrameFlags": "Flags indicating which argument registers contain GC references",
"DynamicFunctionTable.Context": "Tagged pointer to the owning `EEJitManager`; low bits are flags",
"DynamicFunctionTable.MinimumAddress": "Module base address covered by the dynamic function table",
"DynamicILBlobTable.EntryIL": "Offset of the IL pointer within each dynamic IL table entry",
"DynamicILBlobTable.EntryMethodToken": "Offset of the method token within each dynamic IL table entry",
"DynamicILBlobTable.EntryIL": "Offset of the IL-body or RVA-field-data pointer within each entry",
"DynamicILBlobTable.EntryMethodToken": "Offset of the full MethodDef or FieldDef token within each entry",
"DynamicILBlobTable.Size": "Size in bytes of each table entry",
"DynamicILBlobTable.Table": "Address of the SHash table",
"DynamicILBlobTable.TableSize": "Number of entries in the table",
Expand Down Expand Up @@ -401,7 +401,7 @@
"Module.Assembly": "Pointer to the containing assembly",
"Module.AvailableTypeParams": "Pointer to the available type-parameter hash table",
"Module.Base": "Base address of the module's loaded image",
"Module.DynamicILBlobTable": "Pointer to the table of dynamically supplied IL bodies",
"Module.DynamicILBlobTable": "Pointer to the token-keyed table of dynamically supplied IL bodies and RVA field data",
"Module.DynamicMetadata": "Pointer to metadata updated dynamically through Edit and Continue",
"Module.EnCClassList": "Pointer to the list of classes added through Edit and Continue",
"Module.FieldDefToDescMap": "Pointer to the field-definition-to-field-descriptor lookup map",
Expand Down Expand Up @@ -769,7 +769,7 @@
"FeaturePortableEntrypoints": "Present (nonzero) when portable entrypoints are enabled",
"FeatureWebcil": "Present (nonzero) when Webcil is enabled",
"FieldOffsetBigRVA": "Sentinel value of FieldDesc::DWord2 indicating the field is an RVA static whose offset is too large to encode in the bitfield; the real offset must be read from the field's metadata (FieldDefinition.GetRelativeVirtualAddress).",
"FieldOffsetDynamicRVA": "Sentinel FieldDesc offset for an EnC-added RVA field whose enclosing type is not yet loaded",
"FieldOffsetDynamicRVA": "Sentinel FieldDesc offset for token-backed RVA field data, including Reflection.Emit fields and EnC-added fields whose enclosing type was not yet loaded when the field was added",
"FieldOffsetNewEnc": "Sentinel offset value stored in FieldDesc::DWord2 for added fields whose storage has not yet been allocated.",
"FinalizerThread": "Pointer to the finalizer thread",
"FunctionTableIndexRangeList": "Pointer to the head pointer of the registered WASM R2R function-table range list",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,6 @@ private void AddParameters(SignatureHelper sigHelp, Type[]? parameterTypes, Type
}
}

internal override void RecordTokenFixup()
{
// DynamicMethod doesn't need fixup.
}

#region GetTokenFor helpers
private int GetTokenFor(RuntimeType rtType)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ internal static T[] EnlargeArray<T>(T[] incoming, int requiredSize)

private int m_fixupCount;

private int[]? m_RelocFixupList;
private int m_RelocFixupCount;

private int m_exceptionCount;
private int m_currExcStackCount;
private __ExceptionInfo[]? m_exceptions; // This is the list of all of the exceptions in this ILStream.
Expand Down Expand Up @@ -101,20 +98,6 @@ internal RuntimeILGenerator(MethodInfo methodBuilder, int size)
#endregion

#region Internal Members
internal virtual void RecordTokenFixup()
{
if (m_RelocFixupList == null)
{
m_RelocFixupList = new int[DefaultFixupArraySize];
}
else if (m_RelocFixupList.Length <= m_RelocFixupCount)
{
m_RelocFixupList = EnlargeArray(m_RelocFixupList);
}

m_RelocFixupList[m_RelocFixupCount++] = m_length;
}

internal void InternalEmit(OpCode opcode)
{
short opcodeValue = opcode.Value;
Expand Down Expand Up @@ -355,18 +338,6 @@ private static void SortExceptions(__ExceptionInfo[] exceptions)
}
}

internal int[]? GetTokenFixups()
{
if (m_RelocFixupCount == 0)
{
Debug.Assert(m_RelocFixupList == null);
return null;
}

int[] narrowTokens = new int[m_RelocFixupCount];
Array.Copy(m_RelocFixupList!, narrowTokens, m_RelocFixupCount);
return narrowTokens;
}
#endregion

#region Public Members
Expand Down Expand Up @@ -506,7 +477,6 @@ public override void Emit(OpCode opcode, MethodInfo meth)
InternalEmit(opcode);

UpdateStackSize(opcode, 0);
RecordTokenFixup();
PutInteger4(tk);
}
}
Expand Down Expand Up @@ -555,7 +525,6 @@ public override void EmitCalli(OpCode opcode, CallingConventions callingConventi

UpdateStackSize(OpCodes.Calli, stackchange);

RecordTokenFixup();
PutInteger4(modBuilder.GetSignatureMetadataToken(sig));
}

Expand Down Expand Up @@ -598,7 +567,6 @@ public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallCon

EnsureCapacity(7);
Emit(OpCodes.Calli);
RecordTokenFixup();
PutInteger4(modBuilder.GetSignatureMetadataToken(sig));
}

Expand Down Expand Up @@ -632,7 +600,6 @@ public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? opti
stackchange -= optionalParameterTypes.Length;
UpdateStackSize(opcode, stackchange);

RecordTokenFixup();
PutInteger4(tk);
}

Expand Down Expand Up @@ -669,7 +636,6 @@ public override void Emit(OpCode opcode, SignatureHelper signature)
UpdateStackSize(opcode, stackchange);
}

RecordTokenFixup();
PutInteger4(tempVal);
}

Expand Down Expand Up @@ -709,23 +675,17 @@ public override void Emit(OpCode opcode, ConstructorInfo con)
}
UpdateStackSize(opcode, stackchange);

RecordTokenFixup();
PutInteger4(tk);
}

public override void Emit(OpCode opcode, Type cls)
{
// Puts opcode onto the stream and then the metadata token represented
// by cls. The location of cls is recorded so that the token can be
// patched if necessary when persisting the module to a PE.

RuntimeModuleBuilder modBuilder = (RuntimeModuleBuilder)m_methodBuilder.Module;
bool getGenericDefinition = (opcode == OpCodes.Ldtoken && cls != null && cls.IsGenericTypeDefinition);
int tempVal = modBuilder.GetTypeTokenInternal(cls!, getGenericDefinition);

EnsureCapacity(7);
InternalEmit(opcode);
RecordTokenFixup();
PutInteger4(tempVal);
}

Expand Down Expand Up @@ -807,16 +767,11 @@ public override void Emit(OpCode opcode, FieldInfo field)
int tempVal = modBuilder.GetFieldMetadataToken(field);
EnsureCapacity(7);
InternalEmit(opcode);
RecordTokenFixup();
PutInteger4(tempVal);
}

public override void Emit(OpCode opcode, string str)
{
// Puts the opcode onto the IL stream followed by the metadata token
// represented by str. The location of str is recorded for future
// fixups if the module is persisted to a PE.

ModuleBuilder modBuilder = (ModuleBuilder)m_methodBuilder.Module;
int tempVal = modBuilder.GetStringMetadataToken(str);
EnsureCapacity(7);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ internal sealed class RuntimeMethodBuilder : MethodBuilder
internal RuntimeTypeBuilder m_containingType;

// IL
private int[]? m_mdMethodFixups; // The location of all of the token fixups. Null means no fixups.
private byte[]? m_localSignature; // Local signature if set explicitly via DefineBody. Null otherwise.
internal LocalSymInfo? m_localSymInfo; // keep track debugging local information
internal RuntimeILGenerator? m_ilGenerator; // Null if not used.
Expand Down Expand Up @@ -174,8 +173,6 @@ internal void CreateMethodBodyHelper(RuntimeILGenerator il)

m_ubBody = il.BakeByteArray();

m_mdMethodFixups = il.GetTokenFixups();

// Okay, now the fun part. Calculate all of the exceptions.
excp = il.GetExceptions()!;
int numExceptions = CalculateNumberOfExceptions(excp);
Expand Down Expand Up @@ -232,7 +229,6 @@ internal void ReleaseBakedStructures()

m_ubBody = null;
m_localSymInfo = null;
m_mdMethodFixups = null;
m_localSignature = null;
m_exceptions = null;
}
Expand Down Expand Up @@ -268,11 +264,6 @@ internal void SetToken(int token)
return m_ubBody;
}

internal int[]? GetTokenFixups()
{
return m_mdMethodFixups;
}

internal SignatureHelper GetMethodSignature()
{
m_parameterTypes ??= Type.EmptyTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ protected override FieldBuilder DefineInitializedDataCore(string name, byte[] da
{
lock (SyncRoot)
{
// This method will define an initialized Data in .sdata.
// We will create a fake TypeDef to represent the data with size. This TypeDef
// will be the signature for the Field.
if (_hasGlobalBeenCreated)
Expand All @@ -866,7 +865,6 @@ protected override FieldBuilder DefineUninitializedDataCore(string name, int siz
{
lock (SyncRoot)
{
// This method will define an uninitialized Data in .sdata.
// We will create a fake TypeDef to represent the data with size. This TypeDef
// will be the signature for the Field.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ private static partial void SetMethodIL(QCallModule module, int tk, [MarshalAs(U
byte[]? body, int bodyLength,
byte[] LocalSig, int sigLength,
int maxStackSize,
ExceptionHandler[]? exceptions, int numExceptions,
int[]? tokenFixups, int numTokenFixups);
ExceptionHandler[]? exceptions, int numExceptions);

[ErrorHandler(typeof(QCallExceptionStatusMarshaller), ErrorLocation.HiddenLastParameter)]
[LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_DefineCustomAttribute")]
Expand Down Expand Up @@ -1379,7 +1378,6 @@ protected override FieldBuilder DefineInitializedDataCore(string name, byte[] da
{
lock (SyncRoot)
{
// This method will define an initialized Data in .sdata.
// We will create a fake TypeDef to represent the data with size. This TypeDef
// will be the signature for the Field.

Expand All @@ -1391,7 +1389,6 @@ protected override FieldBuilder DefineUninitializedDataCore(string name, int siz
{
lock (SyncRoot)
{
// This method will define an uninitialized Data in .sdata.
// We will create a fake TypeDef to represent the data with size. This TypeDef
// will be the signature for the Field.
return DefineDataHelper(name, null, size, attributes);
Expand Down Expand Up @@ -1636,13 +1633,11 @@ protected override TypeInfo CreateTypeInfoCore()
int maxStack = meth.GetMaxStack();

ExceptionHandler[]? exceptions = meth.GetExceptionHandlers();
int[]? tokenFixups = meth.GetTokenFixups();

SetMethodIL(new QCallModule(ref module), meth.MetadataToken, meth.InitLocals,
body, (body != null) ? body.Length : 0,
localSig, sigLength, maxStack,
exceptions, (exceptions != null) ? exceptions.Length : 0,
tokenFixups, (tokenFixups != null) ? tokenFixups.Length : 0);
exceptions, (exceptions != null) ? exceptions.Length : 0);

if (m_module.ContainingAssemblyBuilder._access == AssemblyBuilderAccess.Run)
{
Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,7 @@ mdSignature DacDbiInterfaceImpl::GetILCodeAndSigHelper(Module * pModule,
TADDR pTargetIL = pModule->GetDynamicIL(mdMethodToken);

// Method not overridden - get the original copy of the IL by going to the PE file/RVA
// If this is in a dynamic module then don't even attempt this since ReflectionModule::GetIL isn't
// implemented for DAC.
// Dynamic modules have no PE-backed fallback.
if (pTargetIL == 0 && !pModule->IsReflectionEmit())
{
pTargetIL = (TADDR)pModule->GetIL(methodRVA);
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ set(CORECLR_LIBRARIES
mdcompiler_wks
mdruntime_wks
mdruntimerw_wks
ceefgen
corguids
utilcode
v3binder
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/inc/ceegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ class CCeeGen : public ICeeGenInternal {

HRESULT addSection(CeeSection *section, short *sectionIdx);

// Init process: Call static CreateNewInstance() , not operator new
protected:
HRESULT Init();
CCeeGen();
Expand All @@ -202,8 +201,6 @@ class CCeeGen : public ICeeGenInternal {

virtual ~CCeeGen() {}

static HRESULT CreateNewInstance(CCeeGen* & pCeeFileGen); // call this to instantiate

virtual HRESULT Cleanup();

// ICeeGenInternal interfaces
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/md/ceefilegen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ if (CLR_CMAKE_TARGET_WIN32)
list(APPEND CEEFILEGEN_SOURCES ${CEEFILEGEN_HEADERS})
endif (CLR_CMAKE_TARGET_WIN32)

add_library_clr(ceefgen OBJECT ${CEEFILEGEN_SOURCES})
target_precompile_headers(ceefgen PRIVATE stdafx.h)

# SELF_NO_HOST disables the hosted contract machinery
# so these tools do not require the contract implementation at link time.
add_library_clr(ceefgen_nohost OBJECT ${CEEFILEGEN_SOURCES})
Expand Down
50 changes: 0 additions & 50 deletions src/coreclr/md/ceefilegen/cceegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,6 @@
#include "memorystreams.h"


//*****************************************************************************
// Creation for new CCeeGen instances
//
// Both allocate and call virtual Init() (Can't call v-func in a ctor,
// but we want to create in 1 call);
//*****************************************************************************

HRESULT STDMETHODCALLTYPE CreateICeeGen(REFIID riid, void **pCeeGen)
{
if (riid != IID_ICeeGenInternal)
return E_NOTIMPL;
if (!pCeeGen)
return E_POINTER;
CCeeGen *pCeeFileGen;
HRESULT hr = CCeeGen::CreateNewInstance(pCeeFileGen);
if (FAILED(hr))
return hr;
pCeeFileGen->AddRef();
*(CCeeGen**)pCeeGen = pCeeFileGen;
return S_OK;
}

HRESULT CCeeGen::CreateNewInstance(CCeeGen* & pGen) // static, public
{
NewHolder<CCeeGen> pGenHolder(new CCeeGen());
_ASSERTE(pGenHolder != NULL);
TESTANDRETURNMEMORY(pGenHolder);

pGenHolder->m_peSectionMan = new PESectionMan;
_ASSERTE(pGenHolder->m_peSectionMan != NULL);
TESTANDRETURNMEMORY(pGenHolder->m_peSectionMan);

HRESULT hr = pGenHolder->m_peSectionMan->Init();
if (FAILED(hr))
{
pGenHolder->Cleanup();
return hr;
}

hr = pGenHolder->Init();
if (FAILED(hr))
{
// Init() calls Cleanup() on failure
return hr;
}

pGen = pGenHolder.Extract();
return hr;
}

STDMETHODIMP CCeeGen::QueryInterface(REFIID riid, void** ppv)
{
if (!ppv)
Expand Down
Loading
Loading