-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add the exception set for ObjGetType
#64106
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
#pragma warning disable CS0253 // Possible unintended reference comparison | ||
|
||
class ExceptionSets | ||
{ | ||
public static int Main() | ||
{ | ||
try | ||
{ | ||
TestObjGetType(null, 0); | ||
return 101; | ||
} | ||
catch (NullReferenceException) { } | ||
|
||
return 100; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static bool TestObjGetType(object a, int i) | ||
{ | ||
var fls = false; | ||
var c1 = i == 0; | ||
var c2 = c1; | ||
|
||
if (((a.GetType() == a) & fls) | (i == 0)) | ||
{ | ||
return true; | ||
} | ||
|
||
return c2; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<CLRTestPriority>1</CLRTestPriority> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not necessary per se, I just don't think the tests (there will be more) here are valuable enough to be Pri0. The reason being that they're protecting against bugs we have had for a very long time now, and haven't seen anyone hit them. |
||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType>None</DebugType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand from the comment is at least
object.GetType()
are marked withGTF_EXCEPT
(if not rest of the existing intrinsics)? Then why not keepGTF_EXCEPT
check?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The predicate that
OperMayThrow
implements is "does this node induce a new exception by itself". TheGTF_EXCEPT
check that was here before was a workaround for the lack of precise handling of intrinsics - it would returntrue
for intrinsics (such as all the math ones) that themselves don't throw, but happened to have children that are throwing.Additionally, bringing the check back would trigger the new assert in
fgValueNumberAddExceptionSet
that only treats theGetType
intrinsic as possibly throwing.(Note that the part about
...the array and string element access ones...
is stale - these are handled directly by importation and do not use the intrinsic nodes)