-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Avoid considering types boxed in the scanner #118529
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
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 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1143,10 +1143,8 @@ private void ImportBox(int token) | |||||||||||
| { | ||||||||||||
| var type = (TypeDesc)_methodIL.GetObject(token); | ||||||||||||
|
|
||||||||||||
| // There are some sequences of box with ByRefLike types that are allowed | ||||||||||||
| // per the extension to the ECMA-335 specification. | ||||||||||||
| // Everything else is invalid. | ||||||||||||
| if (!type.IsRuntimeDeterminedType && type.IsByRefLike) | ||||||||||||
| // Some box operations will trivially be eliminated during import | ||||||||||||
| if (!type.IsRuntimeDeterminedType) | ||||||||||||
| { | ||||||||||||
| ILReader reader = new ILReader(_ilBytes, _currentOffset); | ||||||||||||
| ILOpcode nextOpcode = reader.ReadILOpcode(); | ||||||||||||
|
|
@@ -1180,7 +1178,9 @@ private void ImportBox(int token) | |||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| ThrowHelper.ThrowInvalidProgramException(); | ||||||||||||
| // If this is a byref-like type, only the above operations are permitted. | ||||||||||||
| if (type.IsByRefLike) | ||||||||||||
| ThrowHelper.ThrowInvalidProgramException(); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| } | |
| if (type.IsByRefLike) | |
| ThrowHelper.ThrowInvalidProgramException(); |
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.
This works only if we recognize all patterns that are recognized by the JIT. I see RyuJIT recognizing more patterns than what we do here - e.g. something with LDNULL:
runtime/src/coreclr/jit/importer.cpp
Line 3216 in f23d779