Skip to content

Commit a6d587b

Browse files
Revert "Try fixing some size regressions"
This reverts commit e383966.
1 parent 9f53668 commit a6d587b

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

src/coreclr/nativeaot/System.Private.CoreLib/src/System/ValueType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ private unsafe void RegularGetValueTypeHashCode(ref HashCode hashCode, ref byte
127127

128128
if (fieldType->ElementType == EETypeElementType.Single)
129129
{
130-
hashCode.Add(Unsafe.As<byte, float>(ref fieldData).GetHashCode());
130+
hashCode.Add(Unsafe.As<byte, float>(ref fieldData));
131131
}
132132
else if (fieldType->ElementType == EETypeElementType.Double)
133133
{
134-
hashCode.Add(Unsafe.As<byte, double>(ref fieldData).GetHashCode());
134+
hashCode.Add(Unsafe.As<byte, double>(ref fieldData));
135135
}
136136
else if (fieldType->IsPrimitive)
137137
{

src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -959,23 +959,6 @@ private void ImportLdToken(int token)
959959
}
960960
}
961961

962-
// We might also be able to optimize this if this is typeof(Foo).IsValueType
963-
if (helperId != ReadyToRunHelperId.NecessaryTypeHandle)
964-
{
965-
reader = new ILReader(_ilBytes, _currentOffset);
966-
if (reader.HasNext
967-
&& reader.ReadILOpcode() == ILOpcode.call
968-
&& IsTypeGetTypeFromHandle((MethodDesc)_methodIL.GetObject(reader.ReadILToken())))
969-
{
970-
if (reader.HasNext
971-
&& reader.ReadILOpcode() is ILOpcode.callvirt or ILOpcode.call
972-
&& _methodIL.GetObject(reader.ReadILToken()) is MethodDesc { Name: "get_IsValueType" or "get_IsEnum"})
973-
{
974-
helperId = ReadyToRunHelperId.NecessaryTypeHandle;
975-
}
976-
}
977-
}
978-
979962
_factory.MetadataManager.GetDependenciesDueToAccess(ref _dependencies, _factory, _methodIL, (TypeDesc)_canonMethodIL.GetObject(token));
980963

981964
_dependencies.Add(GetHelperEntrypoint(ReadyToRunHelper.GetRuntimeTypeHandle), "ldtoken");
@@ -1160,8 +1143,10 @@ private void ImportBox(int token)
11601143
{
11611144
var type = (TypeDesc)_methodIL.GetObject(token);
11621145

1163-
// Some box operations will trivially be eliminated during import
1164-
if (!type.IsRuntimeDeterminedType)
1146+
// There are some sequences of box with ByRefLike types that are allowed
1147+
// per the extension to the ECMA-335 specification.
1148+
// Everything else is invalid.
1149+
if (!type.IsRuntimeDeterminedType && type.IsByRefLike)
11651150
{
11661151
ILReader reader = new ILReader(_ilBytes, _currentOffset);
11671152
ILOpcode nextOpcode = reader.ReadILOpcode();
@@ -1195,9 +1180,7 @@ private void ImportBox(int token)
11951180
}
11961181
}
11971182

1198-
// If this is a byref-like type, only the above operations are permitted.
1199-
if (type.IsByRefLike)
1200-
ThrowHelper.ThrowInvalidProgramException();
1183+
ThrowHelper.ThrowInvalidProgramException();
12011184
}
12021185

12031186
AddBoxingDependencies(type, "Box");
@@ -1370,7 +1353,6 @@ private void ImportConvert(WellKnownType wellKnownType, bool checkOverflow, bool
13701353
{
13711354
if (checkOverflow)
13721355
{
1373-
//
13741356
_dependencies.Add(GetHelperEntrypoint(ReadyToRunHelper.Dbl2IntOvf), "_dbl2intovf");
13751357
_dependencies.Add(GetHelperEntrypoint(ReadyToRunHelper.Dbl2UIntOvf), "_dbl2uintovf");
13761358
_dependencies.Add(GetHelperEntrypoint(ReadyToRunHelper.Dbl2LngOvf), "_dbl2lngovf");

0 commit comments

Comments
 (0)