JIT: optimize case where box feeds GetType#13710
Conversation
|
@JosephTremoulet PTAL Jit-diffs results |
JosephTremoulet
left a comment
There was a problem hiding this comment.
Looks good. I'm curious why not do the same for non-box trees that we can find an exact type for and know are non-null... what are the relative costs of GetType() and TypeHandleToRuntimeType()? Also, would doing the rewrite potentially open further optimizations (like if we go on to compare the type...)?
|
The one test failure looks like a legitimate issue with this change. In shared contexts the class handle may be a representative type and not the exact type. In other words we end up creating instead of So this needs some revision; likely we need to repurpose the handle that is passed to the newobj helper instead of trying to create one from scratch. |
|
Will rework this once #13748 is in. |
If the only use of a box is in a call to Type:GetType, remove the box and obtain the type directly. Get the handle needed for obtaining the type from the newobj call in the original box, via a new box removal option. Also add some logging to the type optimizations done in morph. Closes #13187.
e61f846 to
2e78bfc
Compare
|
Reworked this a fair amount.... jit-diffs very similar to the above, but should avoid the bug in the earlier version. |
|
Windows x64 debug timed out in tailcall_v4/hijack. It passes locally, so will retry. @dotnet-bot retest Windows_NT x64 Debug Build and Test |
|
Ah, I don't need the changes in value numbering any more. No point introducing dead code. Let me snip that bit out. |
If the only use of a box is in a call to Type:GetType, we can remove the
box and just construct the type directly.
Also add some logging to the type optimizations done in morph.
Closes #13187.