Guarded devirtualization foundations (#21270)
authorAndy Ayers <andya@microsoft.com>
Thu, 6 Dec 2018 17:03:31 +0000 (09:03 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Dec 2018 17:03:31 +0000 (09:03 -0800)
commit045f470f71cfcedf3eb7ff248f25bf29619d9a88
tree3acf9d6d7cb154803725c16f4de68b90a0a62233
parent7454475cd4f5575d2a2db3879bb164609e8bd6ad
Guarded devirtualization foundations (#21270)

Lay the groundwork for guarded devirtualization of virtual and interface
calls in the jit.

Introduce the notion of a guarded devirtualization candidate and identify
these if regular devirtualization fails. Use simple heuristics to produce
a class to guess for. Require that the method that would be invoked if the class
guess is correct be a plausible inline candidate.

Generalize the calli transformer to become an indirect call transformer.
This runs after importation because it needs to introduce control flow and
runs before inlining so that the new direct calls it introduces can be inlined.

Implement the transformation to duplicate the call site, devirtualize on the side
where the class is now known exactly, and turn the resulting direct call into an
inline candidate.

Add a motivation and design document.
19 files changed:
Documentation/design-docs/GuardedDevirtualization.md [new file with mode: 0644]
Documentation/design-docs/ThreeClassesDevirt.JPG [new file with mode: 0644]
Documentation/design-docs/ThreeClassesDevirtDetail.JPG [new file with mode: 0644]
Documentation/design-docs/ThreeClassesDevirtFull.JPG [new file with mode: 0644]
Documentation/design-docs/ThreeClassesInterface.JPG [new file with mode: 0644]
Documentation/design-docs/TwoClassesBaseline.JPG [new file with mode: 0644]
Documentation/design-docs/TwoClassesDevirt.JPG [new file with mode: 0644]
Documentation/design-docs/TwoClassesInterface.JPG [new file with mode: 0644]
src/jit/compiler.cpp
src/jit/compiler.h
src/jit/flowgraph.cpp
src/jit/gentree.cpp
src/jit/gentree.h
src/jit/importer.cpp
src/jit/inline.cpp
src/jit/inline.h
src/jit/jitconfigvalues.h
src/jit/lclvars.cpp
src/jit/morph.cpp