Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Reflection.Emit APIs #56153

Merged
merged 10 commits into from
Jul 29, 2021
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,11 @@ public override CallingConventions CallingConvention
}
}

public Module GetModule()
{
return m_methodBuilder.GetModule();
}

internal override Type GetReturnType()
{
return m_methodBuilder.ReturnType;
}

public string Signature => m_methodBuilder.Signature;

public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
{
m_methodBuilder.SetCustomAttribute(con, binaryAttribute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,13 +758,11 @@ public bool InitLocals
set { ThrowIfGeneric(); m_fInitLocals = value; }
}

public Module GetModule()
internal Module GetModule()
{
return GetModuleBuilder();
}

public string Signature => GetMethodSignature().ToString();

public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
{
if (con is null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1623,8 +1623,6 @@ public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
return _iSymWriter.DefineDocument(url, language, languageVendor, documentType);
}

public bool IsTransient() => InternalModule.IsTransientInternal();

#endregion

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ internal class RuntimeModule : Module
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void GetType(QCallModule module, string className, bool throwOnError, bool ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive);

[DllImport(RuntimeHelpers.QCall)]
private static extern bool nIsTransientInternal(QCallModule module);

[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void GetScopeName(QCallModule module, StringHandleOnStack retString);

Expand Down Expand Up @@ -382,12 +379,6 @@ public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFile
#region Internal Members
internal RuntimeType RuntimeType => m_runtimeType ??= ModuleHandle.GetModuleType(this);

internal bool IsTransientInternal()
{
RuntimeModule thisAsLocal = this;
return RuntimeModule.nIsTransientInternal(new QCallModule(ref thisAsLocal));
}

internal MetadataImport MetadataImport => ModuleHandle.GetMetadataImport(this);
#endregion

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat
#ifndef CROSSGEN_COMPILE
if (GetManifestFile()->IsDynamic())
// manifest modules of dynamic assemblies are always transient
m_pManifest = ReflectionModule::Create(this, GetManifestFile(), pamTracker, REFEMIT_MANIFEST_MODULE_NAME, TRUE);
m_pManifest = ReflectionModule::Create(this, GetManifestFile(), pamTracker, REFEMIT_MANIFEST_MODULE_NAME);
else
#endif
m_pManifest = Module::Create(this, mdFileNil, GetManifestFile(), pamTracker);
Expand Down
19 changes: 1 addition & 18 deletions src/coreclr/vm/ceeload.h
Original file line number Diff line number Diff line change
Expand Up @@ -3210,9 +3210,6 @@ class ReflectionModule : public Module
// This is used to allow bulk emitting types without re-emitting the metadata between each type.
bool m_fSuppressMetadataCapture;

// If true, then only other transient modules can depend on this module.
bool m_fIsTransient;

#if !defined DACCESS_COMPILE && !defined CROSSGEN_COMPILE
// Returns true iff metadata capturing is suppressed
bool IsMetadataCaptureSuppressed();
Expand Down Expand Up @@ -3244,7 +3241,7 @@ class ReflectionModule : public Module
#endif

#if !defined DACCESS_COMPILE && !defined CROSSGEN_COMPILE
static ReflectionModule *Create(Assembly *pAssembly, PEFile *pFile, AllocMemTracker *pamTracker, LPCWSTR szName, BOOL fIsTransient);
static ReflectionModule *Create(Assembly *pAssembly, PEFile *pFile, AllocMemTracker *pamTracker, LPCWSTR szName);
void Initialize(AllocMemTracker *pamTracker, LPCWSTR szName);
void Destruct();
#endif // !DACCESS_COMPILE && !CROSSGEN_COMPILE
Expand Down Expand Up @@ -3296,20 +3293,6 @@ class ReflectionModule : public Module
return &m_pISymUnmanagedWriter;
}

bool IsTransient()
{
LIMITED_METHOD_CONTRACT;

return m_fIsTransient;
}

void SetIsTransient(bool fIsTransient)
{
LIMITED_METHOD_CONTRACT;

m_fIsTransient = fIsTransient;
}

#ifndef DACCESS_COMPILE
#ifndef CROSSGEN_COMPILE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ public override string FullyQualifiedName
}
}

public bool IsTransient()
{
return true;
}

public void CreateGlobalFunctions()
{
if (global_type_created != null)
Expand Down