JIT: more general value class devirtualization (#52210)
authorAndy Ayers <andya@microsoft.com>
Thu, 6 May 2021 14:29:57 +0000 (07:29 -0700)
committerGitHub <noreply@github.com>
Thu, 6 May 2021 14:29:57 +0000 (07:29 -0700)
commit33a3ba97e219b580a9659a42e49a3464d14e85b9
tree6215ad9ad2f9992ae5dde19de2469195b725a5e8
parentcff26f49cfc8f0c3a0a5cfeabae69e569deb36d9
JIT: more general value class devirtualization (#52210)

When devirtualization knows that the `this` object is a boxed value class,
it now attempts to update the call to invoke the unboxed entry (when there
is one).

This extends an existing optimization that worked on calls where the box was
local and only fed the call. We now handle calls that dispatch on boxed value
classes more generally,  even if their creation is not local or is local but
in a form the existng opt could not handle.

These new cases either come from failed local box removal opts (say multi-use
boxes) or from guarded devirtualization.

The "boxed" entry for value class methods is an un-inlineable VM stub. This
transformation effectively inlines the stub and unblocks inlining of the
underlying method.
src/coreclr/jit/importer.cpp
src/coreclr/jit/indirectcalltransformer.cpp
src/coreclr/jit/inline.h