You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[mono] Optimize box+callvirt to direct call #32166
publicclassC{staticvoidFoo1(MyIteratori)=>i.Dispose();staticvoidFoo2(MyIteratori)=>((IDisposable)i).Dispose();}publicstructMyIterator:IDisposable{publicvoidDispose(){// in 99% cases iterators have empty Dispose()}}
Both Foo1 and Foo2 should be empty in the final codegen, but unfortunately in mono the Foo2 emits a lot of boilerplate codegen due to unoptimized boxing.
This is one of the reasons why mono emits a lot of redundant codegen for foreach statements (the finally block).
Mono should optimize box + callvirt just like coreclr does:
Activity
EgorBo commentedon Feb 12, 2020
cc @vargaz
naricc commentedon Jul 21, 2022
@ivanpovazan @jandupej I think we can move this to milestone .net8 unless there is a lot closer to done than I realize?
ivanpovazan commentedon Jul 21, 2022
Yes, I think it can be moved to .net8
jandupej commentedon Jul 22, 2022
@naricc I will need more time for this. I think we should move the issue, if possible.
- [mono] box+callvirt optimization in JIT, dotnet#32166
- [mono] JIT fixed certain edge cases in box+callvirt optimization do…
- [mono] cleaned up JIT changes for box+callvirt optimization dotnet#…
[mono] JIT no longer attempts to optimize box+callvirt if the callee …
[mono] Addressed final code style issues dotnet#32166.
[mono] box+callvirt optimization is now disabled when the resolved ca…
[mono][jit] Refined conditions under which box+callvirt optimization …
[mono][jit] box+callvirt optimization is now disabled for LLVM AOT. d…
[mono][jit] box+callvirt optimization (#73456)