Sitelet https://github.com/dotnet/runtime/pull/134966/commits/a78c901becd38700da13d7f5b6526bb41eeaec9e
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge main into Reflection.Emit RVA storage
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
jkoritzinsky and Copilot committed Oct 1, 2026
commit a78c901becd38700da13d7f5b6526bb41eeaec9e
5 changes: 4 additions & 1 deletion src/coreclr/vm/ceeload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3861,7 +3861,10 @@ void ReflectionModule::Initialize(AllocMemTracker *pamTracker, LPCWSTR szName)

m_pInMemoryWriter = new RefClassWriter();

IfFailThrow(m_pInMemoryWriter->Init(GetEmitter(), szName));
IfFailThrow(m_pInMemoryWriter->Init(
GetPEAssembly()->GetMDInternalEmit(),
GetMDImport(),
szName));

m_CrstLeafLock.Init(CrstLeafLock);
}
Expand Down
28 changes: 10 additions & 18 deletions src/coreclr/vm/reflectclasswriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
//* constructor for RefClassWriter
//*
//******************************************************
HRESULT RefClassWriter::Init(IUnknown *pUnk, LPCWSTR szName)
HRESULT RefClassWriter::Init(
IMDInternalEmit *pEmitter,
IMDInternalImport *pInternalImport,
LPCWSTR szName)
{
CONTRACTL {
STANDARD_VM_CHECK;

PRECONDITION(CheckPointer(pUnk));
PRECONDITION(CheckPointer(pEmitter));
PRECONDITION(CheckPointer(pInternalImport));
}
CONTRACTL_END;

Expand All @@ -26,22 +30,10 @@ HRESULT RefClassWriter::Init(IUnknown *pUnk, LPCWSTR szName)
m_internalimport = NULL;
m_ulResourceSize = 0;

// Get the interfaces
HRESULT hr = pUnk->QueryInterface(IID_IMetaDataEmit2, (void**)&m_emitter);
if (FAILED(hr))
return hr;

hr = pUnk->QueryInterface(IID_IMetaDataImport, (void**)&m_importer);
if (FAILED(hr))
return hr;

hr = pUnk->QueryInterface(IID_IMetaDataEmitHelper, (void**)&m_pEmitHelper);
if (FAILED(hr))
return hr;

hr = GetMDInternalInterfaceFromPublic(pUnk, IID_IMDInternalImport, (void**)&m_internalimport);
if (FAILED(hr))
return hr;
m_emitter = pEmitter;
m_emitter->AddRef();
m_internalimport = pInternalImport;
m_internalimport->AddRef();

// <TODO> We will need to set this at some point.</TODO>
HRESULT hr = m_emitter->SetModuleProps(szName);
Expand Down
6 changes: 4 additions & 2 deletions src/coreclr/vm/reflectclasswriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ class RefClassWriter {
friend class COMDynamicWrite;
IMDInternalEmit* m_emitter; // Emit interface.
IMDInternalImport* m_internalimport; // Scopeless internal import interface
IMetaDataEmitHelper* m_pEmitHelper;
ULONG m_ulResourceSize;

public:
RefClassWriter() {
LIMITED_METHOD_CONTRACT;
}

HRESULT Init(IUnknown *pUnk, LPCWSTR szName);
HRESULT Init(
IMDInternalEmit *pEmitter,
IMDInternalImport *pInternalImport,
LPCWSTR szName);

IMDInternalEmit* GetEmitter() {
LIMITED_METHOD_CONTRACT;
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.