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

Delete RuntimeTypeHandle.GetValueInternal #577

Merged
merged 1 commit into from
Jan 22, 2021
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 @@ -19,11 +19,5 @@ public class Type
public struct RuntimeTypeHandle
{
private EETypePtr _pEEType;

[Intrinsic]
internal static unsafe IntPtr GetValueInternal(RuntimeTypeHandle handle)
{
return (IntPtr)handle._pEEType.ToPointer();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,7 @@ internal ref T GetWritableData<T>() where T : unmanaged
internal static EETypePtr EETypePtrOf<T>()
{
// Compilers are required to provide a low level implementation of this method.
// This can be achieved by optimizing away the reflection part of this implementation
// by optimizing typeof(!!0).TypeHandle into "ldtoken !!0", or by
// completely replacing the body of this method.
return typeof(T).TypeHandle.ToEETypePtr();
throw new NotImplementedException();
}

public struct InterfaceCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ internal string LastResortToString
}
}

[Intrinsic]
internal static IntPtr GetValueInternal(RuntimeTypeHandle handle)
{
return handle.RawValue;
}

internal IntPtr RawValue
{
get
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/tools/Common/TypeSystem/IL/CoreRTILProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ private MethodIL TryGetIntrinsicMethodIL(MethodDesc method)
return new ILStubMethodIL(method, new byte[] { (byte)ILOpcode.break_, (byte)ILOpcode.ret }, Array.Empty<LocalVariableDefinition>(), null);
}
break;
case "EETypePtr":
{
if (owningType.Namespace == "System" && method.Name == "EETypePtrOf")
return EETypePtrOfIntrinsic.EmitIL(method);
}
break;
case "RuntimeAugments":
{
if (owningType.Namespace == "Internal.Runtime.Augments" && method.Name == "GetCanonType")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,6 @@ private void ImportCall(ILOpcode opcode, int token)
return;
}

if (IsRuntimeTypeHandleGetValueInternal(method))
{
if (_previousInstructionOffset >= 0 && _ilBytes[_previousInstructionOffset] == (byte)ILOpcode.ldtoken)
return;
}

if (IsActivatorDefaultConstructorOf(method))
{
if (runtimeDeterminedMethod.IsRuntimeDeterminedExactMethod)
Expand Down Expand Up @@ -804,7 +798,6 @@ private void ImportLdToken(int token)
}
_dependencies.Add(reference, "ldtoken");

// If this is a ldtoken Type / GetValueInternal sequence, we're done.
// If this is a ldtoken Type / Type.GetTypeFromHandle sequence, we need one more helper.
BasicBlock nextBasicBlock = _basicBlocks[_currentOffset];
if (nextBasicBlock == null)
Expand All @@ -813,12 +806,7 @@ private void ImportLdToken(int token)
{
int methodToken = ReadILTokenAt(_currentOffset + 1);
var method = (MethodDesc)_methodIL.GetObject(methodToken);
if (IsRuntimeTypeHandleGetValueInternal(method))
{
// Codegen expands this and doesn't do the normal ldtoken.
return;
}
else if (IsTypeGetTypeFromHandle(method))
if (IsTypeGetTypeFromHandle(method))
{
// Codegen will swap this one for GetRuntimeTypeHandle when optimizing
_dependencies.Add(GetHelperEntrypoint(ReadyToRunHelper.GetRuntimeType), "ldtoken");
Expand Down Expand Up @@ -1115,20 +1103,6 @@ private bool IsRuntimeHelpersInitializeArray(MethodDesc method)
return false;
}

private bool IsRuntimeTypeHandleGetValueInternal(MethodDesc method)
{
if (method.IsIntrinsic && method.Name == "GetValueInternal")
{
MetadataType owningType = method.OwningType as MetadataType;
if (owningType != null)
{
return owningType.Name == "RuntimeTypeHandle" && owningType.Namespace == "System";
}
}

return false;
}

private bool IsTypeGetTypeFromHandle(MethodDesc method)
{
if (method.IsIntrinsic && method.Name == "GetTypeFromHandle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@
<Compile Include="..\..\Common\TypeSystem\IL\Stubs\DelegateMethodILEmitter.cs">
<Link>IL\Stubs\DelegateMethodILEmitter.cs</Link>
</Compile>
<Compile Include="..\..\Common\TypeSystem\IL\Stubs\EETypePtrOfIntrinsic.cs">
<Link>IL\Stubs\EETypePtrOfIntrinsic.cs</Link>
</Compile>
<Compile Include="..\..\Common\TypeSystem\IL\Stubs\MethodBaseGetCurrentMethodThunk.Sorting.cs">
<Link>IL\Stubs\MethodBaseGetCurrentMethodThunk.Sorting.cs</Link>
</Compile>
Expand Down