dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.34k stars 4.74k forks source link

Use `GT_IND(GT_INDEX_ADDR))` in debuggable code. #8806

Open pgavlin opened 7 years ago

pgavlin commented 7 years ago

This expansion of GT_INDEX was recently introduced and enabled for minopts, but is suitable for other throughput-favored scenarios as well.

Using this expansion for debuggable code involves a bit of work in the optimizer to handle the new IR.

category:throughput theme:ir skill-level:expert cost:small

pgavlin commented 7 years ago

cc @AndyAyersMS @dotnet/jit-contrib

AndyAyersMS commented 7 years ago

I wonder if we should take this even further and just use helper calls for array loads and stores in debuggable and perhaps in Tier0 codegen. This would factor out the null check, bounds check, exception throw and address calculations and should further reduce the JIT's IR volume.

Likely we'd need to fix the diagnostic aspect so the exceptions look like they were thrown by the caller, but I assume we must have suitable magic for this already... eg the store covariance check does these exception checks.

pgavlin commented 7 years ago

That's an interesting idea... I can't recall offhand whether or not there were any gotchas beyond the optimizer changes that would make implementing such a change especially difficult. My intuition says it should be relatively straightforward, though.

AndyAyersMS commented 7 years ago

Consider for 2.1

AndyAyersMS commented 6 years ago

Looking like this is not going to make the cut for 2.1. So will move it out to Future.