Skip to content
Merged
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 @@ -1860,9 +1860,7 @@ private bool TryHandleIntrinsicCall(MethodDesc method, Value[] parameters, out V
return spanRef.TryAccessElement(spanIndex.AsInt32(), out retVal);
}
return false;
case "GetTypeFromHandle" when method.OwningType is MetadataType typeType
&& typeType.Name == "Type" && typeType.Namespace == "System"
&& typeType.Module == typeType.Context.SystemModule
case "GetTypeFromHandle" when IsSystemType(method.OwningType)
&& parameters[0] is RuntimeTypeHandleValue typeHandle:
{
if (!_internedTypes.TryGetValue(typeHandle.Type, out RuntimeTypeValue runtimeType))
Expand All @@ -1872,24 +1870,25 @@ private bool TryHandleIntrinsicCall(MethodDesc method, Value[] parameters, out V
retVal = runtimeType;
return true;
}
case "get_IsValueType" when method.OwningType is MetadataType typeType
&& typeType.Name == "Type" && typeType.Namespace == "System"
&& typeType.Module == typeType.Context.SystemModule
case "get_IsValueType" when IsSystemType(method.OwningType)
&& parameters[0] is RuntimeTypeValue typeToCheckForValueType:
{
retVal = ValueTypeValue.FromSByte(typeToCheckForValueType.TypeRepresented.IsValueType ? (sbyte)1 : (sbyte)0);
return true;
}
case "op_Equality" when method.OwningType is MetadataType typeType
&& typeType.Name == "Type" && typeType.Namespace == "System"
&& typeType.Module == typeType.Context.SystemModule
case "op_Equality" when IsSystemType(method.OwningType)
&& (parameters[0] is RuntimeTypeValue || parameters[1] is RuntimeTypeValue):
{
retVal = ValueTypeValue.FromSByte(parameters[0] == parameters[1] ? (sbyte)1 : (sbyte)0);
return true;
}
}

static bool IsSystemType(TypeDesc type)
=> type is MetadataType typeType
&& typeType.Name == "Type" && typeType.Namespace == "System"
&& typeType.Module == typeType.Context.SystemModule;

return false;
}

Expand Down