diff options
Diffstat (limited to 'src/jit/morph.cpp')
-rw-r--r-- | src/jit/morph.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp index 2c3c280a11..33bbc74001 100644 --- a/src/jit/morph.cpp +++ b/src/jit/morph.cpp @@ -7927,9 +7927,23 @@ void Compiler::fgMorphTailCall(GenTreeCall* call) /* Now the appropriate vtable slot */ - add = gtNewOperNode(GT_ADD, TYP_I_IMPL, vtbl, gtNewIconNode(vtabOffsAfterIndirection, TYP_I_IMPL)); + add = gtNewOperNode(GT_ADD, TYP_I_IMPL, vtbl, gtNewIconNode(vtabOffsAfterIndirection, TYP_I_IMPL)); + + GenTree* indOffTree = nullptr; + + if (isRelative) + { + indOffTree = impCloneExpr(add, &add, NO_CLASS_HANDLE, (unsigned)CHECK_SPILL_ALL, + nullptr DEBUGARG("virtual table call 2")); + } + vtbl = gtNewOperNode(GT_IND, TYP_I_IMPL, add); + if (isRelative) + { + vtbl = gtNewOperNode(GT_ADD, TYP_I_IMPL, vtbl, indOffTree); + } + // Switch this to a plain indirect call call->gtFlags &= ~GTF_CALL_VIRT_KIND_MASK; assert(!call->IsVirtual()); |