diff options
author | Andy Ayers <andya@microsoft.com> | 2017-10-05 11:31:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-05 11:31:58 -0700 |
commit | b085bfacb5eed105e3e55681f75c5413d91c1f86 (patch) | |
tree | 632213098eebafc8a28d56d8bf1e4aace2206289 /src/jit/compiler.hpp | |
parent | 6c18b66b6f4cc904065f8abaa442fd112493a36c (diff) | |
download | coreclr-b085bfacb5eed105e3e55681f75c5413d91c1f86.tar.gz coreclr-b085bfacb5eed105e3e55681f75c5413d91c1f86.tar.bz2 coreclr-b085bfacb5eed105e3e55681f75c5413d91c1f86.zip |
JIT: More type equality opts (#14317)
* JIT: Wrap some runtime lookups in new node type
Work based on the plan outlined in #14305.
Introduce a new unary node type GT_RUNTIMELOOKUP that wraps existing
runtime lookup trees created in `impLookupToTree` and holds onto the
handle that inspired the lookup.
Note there are other importer paths that create lookups directly that
we might also want to wrap, though wrapping is not a requirement for
correctness.
Keep this node type around through morph, then unwrap and just use
the wrapped node after that.
* JIT: More enhancements to type equality testing
The jit is now able to optimize some type equality checks in shared
method instances where one or both of the types require runtime lookup,
for instance comparing `T` to a value type, or comparing two different
value types `V1<T>` and `V2<T>`.
Add two new jit interface methods, one for testing for type equality and
the other for type casting.
These return Must/MustNot/Maybe results depending on whether or not
the equality or cast can be resolved at jit time.
Implement the equality check. Use this to enhance the type equality opts
in the jit for both direct comparison and the checking done by unbox.any.
Diffstat (limited to 'src/jit/compiler.hpp')
-rw-r--r-- | src/jit/compiler.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp index 4a90760ce2..f357e6f5c8 100644 --- a/src/jit/compiler.hpp +++ b/src/jit/compiler.hpp @@ -1169,6 +1169,23 @@ inline GenTreePtr Compiler::gtNewAllocObjNode(unsigned int helper, return node; } +//------------------------------------------------------------------------ +// gtNewRuntimeLookup: Helper to create a runtime lookup node +// +// Arguments: +// hnd - generic handle being looked up +// hndTyp - type of the generic handle +// tree - tree for the lookup +// +// Return Value: +// New GenTreeRuntimeLookup node. +inline GenTree* Compiler::gtNewRuntimeLookup(CORINFO_GENERIC_HANDLE hnd, CorInfoGenericHandleType hndTyp, GenTree* tree) +{ + assert(tree != nullptr); + GenTree* node = new (this, GT_RUNTIMELOOKUP) GenTreeRuntimeLookup(hnd, hndTyp, tree); + return node; +} + /*****************************************************************************/ inline GenTreePtr Compiler::gtNewCodeRef(BasicBlock* block) |