diff --git a/src/coreclr/jit/codegenarmarch.cpp b/src/coreclr/jit/codegenarmarch.cpp index 58275619194d22..87a87e052e4090 100644 --- a/src/coreclr/jit/codegenarmarch.cpp +++ b/src/coreclr/jit/codegenarmarch.cpp @@ -3459,7 +3459,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call) else { // Direct call to a non-virtual user function. - params.addr = call->gtDirectCallAddress; + params.addr = call->GetDirectCallAddress(); } assert(params.addr != nullptr); diff --git a/src/coreclr/jit/codegenloongarch64.cpp b/src/coreclr/jit/codegenloongarch64.cpp index cc488deb7023fc..63133bbe4d28ff 100644 --- a/src/coreclr/jit/codegenloongarch64.cpp +++ b/src/coreclr/jit/codegenloongarch64.cpp @@ -5800,7 +5800,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call) else { // Direct call to a non-virtual user function. - params.addr = call->gtDirectCallAddress; + params.addr = call->GetDirectCallAddress(); } assert(params.addr != nullptr); diff --git a/src/coreclr/jit/codegenriscv64.cpp b/src/coreclr/jit/codegenriscv64.cpp index 680b18213f9aeb..ee2ed19dedb4ca 100644 --- a/src/coreclr/jit/codegenriscv64.cpp +++ b/src/coreclr/jit/codegenriscv64.cpp @@ -5879,7 +5879,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call) else { // Direct call to a non-virtual user function. - params.addr = call->gtDirectCallAddress; + params.addr = call->GetDirectCallAddress(); } assert(params.addr != nullptr); diff --git a/src/coreclr/jit/codegenxarch.cpp b/src/coreclr/jit/codegenxarch.cpp index 4b3d13059e977c..282674d616351e 100644 --- a/src/coreclr/jit/codegenxarch.cpp +++ b/src/coreclr/jit/codegenxarch.cpp @@ -6511,7 +6511,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call X86_ARG(target_ssize_t stackA else { // Direct call to a non-virtual user function. - addr = call->gtDirectCallAddress; + addr = call->GetDirectCallAddress(); } assert(addr != nullptr); diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index a3c627a1891e09..a3b1065d8bb003 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -11887,17 +11887,17 @@ class GenTreeVisitor } } - if (call->gtCallType == CT_INDIRECT) + if (call->HasCallCookie()) { - if (call->gtCallCookie != nullptr) + result = WalkTree(call->GetCallCookiePtr(), call); + if (result == fgWalkResult::WALK_ABORT) { - result = WalkTree(&call->gtCallCookie, call); - if (result == fgWalkResult::WALK_ABORT) - { - return result; - } + return result; } + } + if (call->gtCallType == CT_INDIRECT) + { result = WalkTree(&call->gtCallAddr, call); if (result == fgWalkResult::WALK_ABORT) { diff --git a/src/coreclr/jit/compiler.hpp b/src/coreclr/jit/compiler.hpp index e919af1450995e..f3ae209ab54c8d 100644 --- a/src/coreclr/jit/compiler.hpp +++ b/src/coreclr/jit/compiler.hpp @@ -4683,7 +4683,7 @@ void GenTree::VisitOperands(TVisitor visitor) if (call->gtCallType == CT_INDIRECT) { - if ((call->gtCallCookie != nullptr) && (visitor(call->gtCallCookie) == VisitResult::Abort)) + if (call->HasCallCookie() && (visitor(call->GetCallCookie()) == VisitResult::Abort)) { return; } diff --git a/src/coreclr/jit/fgprofile.cpp b/src/coreclr/jit/fgprofile.cpp index 9dd8ad2c0272d2..8823fae293cec0 100644 --- a/src/coreclr/jit/fgprofile.cpp +++ b/src/coreclr/jit/fgprofile.cpp @@ -1902,7 +1902,7 @@ class HandleHistogramProbeVisitor final : public GenTreeVisitorIsCall() && (m_compiler->compClassifyGDVProbeType(node->AsCall()) != Compiler::GDVProbeType::None)) { - assert(node->AsCall()->gtHandleHistogramProfileCandidateInfo != nullptr); + assert(node->AsCall()->GetHandleHistogramProfileCandidateInfo() != nullptr); m_functor(m_compiler, node->AsCall()); } @@ -1997,7 +1997,7 @@ class BuildHandleHistogramProbeSchemaGen schemaElem.InstrumentationKind = compiler->opts.compCollect64BitCounts ? ICorJitInfo::PgoInstrumentationKind::HandleHistogramLongCount : ICorJitInfo::PgoInstrumentationKind::HandleHistogramIntCount; - schemaElem.ILOffset = (int32_t)call->gtHandleHistogramProfileCandidateInfo->ilOffset; + schemaElem.ILOffset = (int32_t)call->GetHandleHistogramProfileCandidateInfo()->ilOffset; schemaElem.Offset = 0; m_schema.push_back(schemaElem); @@ -2033,7 +2033,7 @@ class BuildValueHistogramProbeSchemaGen schemaElem.InstrumentationKind = compiler->opts.compCollect64BitCounts ? ICorJitInfo::PgoInstrumentationKind::ValueHistogramLongCount : ICorJitInfo::PgoInstrumentationKind::ValueHistogramIntCount; - schemaElem.ILOffset = (int32_t)call->AsCall()->gtHandleHistogramProfileCandidateInfo->ilOffset; + schemaElem.ILOffset = (int32_t)call->AsCall()->GetHandleHistogramProfileCandidateInfo()->ilOffset; m_schema.push_back(schemaElem); m_schemaCount++; @@ -2066,8 +2066,8 @@ class HandleHistogramProbeInserter void operator()(Compiler* compiler, GenTreeCall* call) { JITDUMP("Found call [%06u] with probe index %d and ilOffset 0x%X\n", compiler->dspTreeID(call), - call->gtHandleHistogramProfileCandidateInfo->probeIndex, - call->gtHandleHistogramProfileCandidateInfo->ilOffset); + call->GetHandleHistogramProfileCandidateInfo()->probeIndex, + call->GetHandleHistogramProfileCandidateInfo()->ilOffset); // We transform the call from (CALLVIRT obj, ... args ...) to // @@ -2085,11 +2085,11 @@ class HandleHistogramProbeInserter void* methodHistogram = nullptr; bool is32; - ReadHistogramAndAdvance(call->gtHandleHistogramProfileCandidateInfo->ilOffset, &typeHistogram, &methodHistogram, - &is32); + ReadHistogramAndAdvance(call->GetHandleHistogramProfileCandidateInfo()->ilOffset, &typeHistogram, + &methodHistogram, &is32); bool secondIs32; - ReadHistogramAndAdvance(call->gtHandleHistogramProfileCandidateInfo->ilOffset, &typeHistogram, &methodHistogram, - &secondIs32); + ReadHistogramAndAdvance(call->GetHandleHistogramProfileCandidateInfo()->ilOffset, &typeHistogram, + &methodHistogram, &secondIs32); assert(((typeHistogram != nullptr) || (methodHistogram != nullptr)) && "Expected at least one handle histogram when inserting probes"); @@ -2272,7 +2272,7 @@ class ValueHistogramProbeInserter const ICorJitInfo::PgoInstrumentationSchema& countEntry = m_schema[*m_currentSchemaIndex]; if (countEntry.ILOffset != - static_cast(node->AsCall()->gtHandleHistogramProfileCandidateInfo->ilOffset)) + static_cast(node->AsCall()->GetHandleHistogramProfileCandidateInfo()->ilOffset)) { return; } diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index ede13bb5ee7f3b..816934a5080879 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -2036,15 +2036,19 @@ GenTree* Compiler::getArrayLengthFromAllocation(GenTree* tree DEBUGARG(BasicBloc // void GenTreeCall::SetSingleInlineCandidateInfo(InlineCandidateInfo* candidateInfo) { + // assert((ud == UD::UD_INLINE_INFO) || (ud == UD::UD_INLINE_INFOS) || (ud == UD::UD_INVALID)); + if (candidateInfo != nullptr) { gtFlags |= GTF_CALL_INLINE_CANDIDATE; gtInlineInfoCount = 1; + ud = UD::UD_INLINE_INFO; } else { gtInlineInfoCount = 0; gtFlags &= ~GTF_CALL_INLINE_CANDIDATE; + ud = UD::UD_INVALID; } gtInlineCandidateInfo = candidateInfo; ClearGuardedDevirtualizationCandidate(); @@ -2061,9 +2065,11 @@ InlineCandidateInfo* GenTreeCall::GetGDVCandidateInfo(uint8_t index) assert(index < gtInlineInfoCount); if (gtInlineInfoCount > 1) { + assert(ud == UD::UD_INLINE_INFOS); // In this case we should access it through gtInlineCandidateInfoList return gtInlineCandidateInfoList->at(index); } + assert(ud == UD::UD_INLINE_INFO); return gtInlineCandidateInfo; } @@ -2085,18 +2091,22 @@ void GenTreeCall::AddGDVCandidateInfo(Compiler* comp, InlineCandidateInfo* candi { // Most calls are monomorphic, so we don't need to allocate a vector gtInlineCandidateInfo = candidateInfo; + ud = UD::UD_INLINE_INFO; } else if (gtInlineInfoCount == 1) { + assert(ud == UD::UD_INLINE_INFO); // Upgrade gtInlineCandidateInfo to gtInlineCandidateInfoList (vector) CompAllocator allocator = comp->getAllocator(CMK_Inlining); InlineCandidateInfo* firstCandidate = gtInlineCandidateInfo; gtInlineCandidateInfoList = new (allocator) jitstd::vector(allocator); gtInlineCandidateInfoList->push_back(firstCandidate); gtInlineCandidateInfoList->push_back(candidateInfo); + ud = UD::UD_INLINE_INFOS; } else { + assert(ud == UD::UD_INLINE_INFOS); gtInlineCandidateInfoList->push_back(candidateInfo); } gtCallMoreFlags |= GTF_CALL_M_GUARDED_DEVIRT; @@ -2133,6 +2143,7 @@ void GenTreeCall::RemoveGDVCandidateInfo(Compiler* comp, uint8_t index) if (gtInlineInfoCount == 1) { gtInlineCandidateInfo = gtInlineCandidateInfoList->at(0); + ud = UD::UD_INLINE_INFO; } } @@ -2284,7 +2295,7 @@ int GenTreeCall::GetNonStandardAddedArgCount(Compiler* compiler) const // R11 = Virtual stub param return 1; } - else if ((gtCallType == CT_INDIRECT) && (gtCallCookie != nullptr)) + else if ((gtCallType == CT_INDIRECT) && HasCallCookie() && (GetCallCookie() != nullptr)) { // R10 = PInvoke target param // R11 = PInvoke cookie param @@ -2469,6 +2480,20 @@ bool GenTreeCall::Equals(GenTreeCall* c1, GenTreeCall* c2) return true; } +void GenTreeCall::CopyUD(GenTreeCall* call, Compiler* comp) +{ + call->ud = ud; + + if (ud == UD::UD_COOKIE) + { + call->gtCallCookie = comp->gtClone(gtCallCookie); + } + else + { + call->gtCallCookie = gtCallCookie; + } +} + //-------------------------------------------------------------------------- // ResetFinalArgsAndABIInfo: Reset ABI information classified for arguments, // removing late-added arguments. @@ -5977,7 +6002,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree) if (call->gtCallType == CT_INDIRECT) { // pinvoke-calli cookie is a constant, or constant indirection - assert(call->gtCallCookie == nullptr || call->gtCallCookie->OperIs(GT_CNS_INT, GT_IND)); + assert(!call->HasCallCookie() || call->GetCallCookie()->OperIs(GT_CNS_INT, GT_IND)); GenTree* indirect = call->gtCallAddr; @@ -6725,9 +6750,9 @@ bool GenTree::TryGetUse(GenTree* operand, GenTree*** pUse) } if (call->gtCallType == CT_INDIRECT) { - if (operand == call->gtCallCookie) + if (call->HasCallCookie() && (operand == call->GetCallCookie())) { - *pUse = &call->gtCallCookie; + *pUse = call->GetCallCookiePtr(); return true; } if (operand == call->gtCallAddr) @@ -8298,15 +8323,7 @@ GenTreeCall* Compiler::gtNewCallNode(gtCallTypes callType, node->gtCallMoreFlags = GTF_CALL_M_EMPTY; INDEBUG(node->gtCallDebugFlags = GTF_CALL_MD_EMPTY); node->gtInlineInfoCount = 0; - - if (callType == CT_INDIRECT) - { - node->gtCallCookie = nullptr; - } - else - { - node->ClearInlineInfo(); - } + node->ClearUD(); node->gtReturnType = type; #ifdef FEATURE_READYTORUN @@ -9896,17 +9913,17 @@ GenTreeCall* Compiler::gtCloneExprCallHelper(GenTreeCall* tree) copy->gtControlExpr = gtCloneExpr(tree->gtControlExpr); copy->gtStubCallStubAddr = tree->gtStubCallStubAddr; - /* Copy the union */ + // Copy the union + tree->CopyUD(copy, this); + if (tree->gtCallType == CT_INDIRECT) { - copy->gtCallCookie = tree->gtCallCookie ? gtCloneExpr(tree->gtCallCookie) : nullptr; - copy->gtCallAddr = tree->gtCallAddr ? gtCloneExpr(tree->gtCallAddr) : nullptr; + copy->gtCallAddr = tree->gtCallAddr ? gtCloneExpr(tree->gtCallAddr) : nullptr; } else { - copy->gtCallMethHnd = tree->gtCallMethHnd; - copy->gtInlineCandidateInfo = tree->gtInlineCandidateInfo; - copy->gtInlineInfoCount = tree->gtInlineInfoCount; + copy->gtCallMethHnd = tree->gtCallMethHnd; + copy->gtInlineInfoCount = tree->gtInlineInfoCount; } copy->gtLateDevirtualizationInfo = tree->gtLateDevirtualizationInfo; @@ -10641,9 +10658,9 @@ void GenTreeUseEdgeIterator::AdvanceCall() assert(call->gtCallType == CT_INDIRECT); m_advance = &GenTreeUseEdgeIterator::AdvanceCall; - if (call->gtCallCookie != nullptr) + if (call->HasCallCookie() && (call->GetCallCookie() != nullptr)) { - m_edge = &call->gtCallCookie; + m_edge = call->GetCallCookiePtr(); return; } FALLTHROUGH; @@ -13506,7 +13523,7 @@ void Compiler::gtDispLIRNode(GenTree* node, const char* prefixMsg /* = nullptr * { displayOperand(operand, "control expr", operandArc, indentStack, prefixIndent); } - else if (operand == call->gtCallCookie) + else if (call->HasCallCookie() && (operand == call->GetCallCookie())) { displayOperand(operand, "cookie", operandArc, indentStack, prefixIndent); } @@ -19426,7 +19443,8 @@ CORINFO_CLASS_HANDLE Compiler::gtGetHelperCallClassHandle(GenTreeCall* call, boo case CORINFO_HELP_NEWARR_1_ALIGN8: case CORINFO_HELP_READYTORUN_NEWARR_1: { - CORINFO_CLASS_HANDLE arrayHnd = (CORINFO_CLASS_HANDLE)call->compileTimeHelperArgumentHandle; + assert(call->HasCompileTimeHelperArgumentHandle()); + CORINFO_CLASS_HANDLE arrayHnd = (CORINFO_CLASS_HANDLE)call->GetCompileTimeHelperArgumentHandle(); if (arrayHnd != NO_CLASS_HANDLE) { diff --git a/src/coreclr/jit/gentree.h b/src/coreclr/jit/gentree.h index 5e425db7271d93..f6a3a8f7a619a4 100644 --- a/src/coreclr/jit/gentree.h +++ b/src/coreclr/jit/gentree.h @@ -5606,6 +5606,114 @@ struct GenTreeCall final : public GenTree IL_OFFSET gtCastHelperILOffset; // Used by cast helpers to save corresponding IL offset }; + void ClearUD() + { + ud = UD::UD_INVALID; + gtCallCookie = nullptr; + } + void CopyUD(GenTreeCall* call, Compiler* comp); + + void SetCallCookie(GenTree* cookie) + { + assert(cookie != nullptr); + gtCallCookie = cookie; + ud = UD::UD_COOKIE; + } + bool HasCallCookie() const + { + return ud == UD::UD_COOKIE; + } + GenTree* GetCallCookie() const + { + assert(ud == UD::UD_COOKIE); + assert(gtCallCookie != nullptr); + return gtCallCookie; + } + GenTree** GetCallCookiePtr() + { + assert(ud == UD::UD_COOKIE); + return >CallCookie; + } + + void SetInlineCandidateInfo(InlineCandidateInfo* info) + { + gtInlineCandidateInfo = info; + ud = UD::UD_INLINE_INFO; + } + InlineCandidateInfo* GetInlineCandidateInfo() const + { + assert(ud == UD::UD_INLINE_INFO); + return gtInlineCandidateInfo; + } + + void SetInlineCandidateInfos(jitstd::vector* info) + { + gtInlineCandidateInfoList = info; + ud = UD::UD_INLINE_INFOS; + } + jitstd::vector* GetInlineCandidateInfos() const + { + assert(ud == UD::UD_INLINE_INFOS); + return gtInlineCandidateInfoList; + } + + void SetHandleHistogramProfileCandidateInfo(HandleHistogramProfileCandidateInfo* info) + { + assert(info != nullptr); + gtHandleHistogramProfileCandidateInfo = info; + ud = UD::UD_HISTOGRAM_INFO; + } + bool HasHandleHistogramProfileCandidateInfo() const + { + return ud == UD::UD_HISTOGRAM_INFO; + } + HandleHistogramProfileCandidateInfo* GetHandleHistogramProfileCandidateInfo() const + { + assert(ud == UD::UD_HISTOGRAM_INFO); + return gtHandleHistogramProfileCandidateInfo; + } + + void SetCompileTimeHelperArgumentHandle(CORINFO_GENERIC_HANDLE handle) + { + compileTimeHelperArgumentHandle = handle; + ud = UD::UD_HANDLE; + } + bool HasCompileTimeHelperArgumentHandle() const + { + return ud == UD::UD_HANDLE; + } + CORINFO_GENERIC_HANDLE GetCompileTimeHelperArgumentHandle() const + { + assert(ud == UD::UD_HANDLE); + return compileTimeHelperArgumentHandle; + } + + void SetDirectCallAddress(void* address) + { + gtDirectCallAddress = address; + ud = UD::UD_CALL_ADDR; + } + void* GetDirectCallAddress() const + { + assert(ud == UD::UD_CALL_ADDR); + return gtDirectCallAddress; + } + +private: + + enum class UD + { + UD_INVALID, + UD_COOKIE, + UD_INLINE_INFO, + UD_INLINE_INFOS, + UD_HISTOGRAM_INFO, + UD_HANDLE, + UD_CALL_ADDR + }; + + UD ud; + union { // only used for CALLI unmanaged calls (CT_INDIRECT) @@ -5622,6 +5730,8 @@ struct GenTreeCall final : public GenTree void* gtDirectCallAddress; // Used to pass direct call address between lower and codegen }; +public: + LateDevirtualizationInfo* gtLateDevirtualizationInfo; // Always available for user virtual calls // expression evaluated after args are placed which determines the control target diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index 191939105b0d6b..132466e32d6d39 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -3777,7 +3777,7 @@ void Compiler::impImportNewObjArray(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORI node = gtNewHelperCallNode(helper, TYP_REF, classHandle, gtNewIconNode(pCallInfo->sig.numArgs), node); - node->AsCall()->compileTimeHelperArgumentHandle = (CORINFO_GENERIC_HANDLE)pResolvedToken->hClass; + node->AsCall()->SetCompileTimeHelperArgumentHandle((CORINFO_GENERIC_HANDLE)pResolvedToken->hClass); // Remember that this function contains 'new' of a MD array. optMethodFlags |= OMF_HAS_MDNEWARRAY; @@ -5901,9 +5901,9 @@ GenTree* Compiler::impCastClassOrIsInstToTree(GenTree* op1, { HandleHistogramProfileCandidateInfo* pInfo = new (this, CMK_Inlining) HandleHistogramProfileCandidateInfo; - pInfo->ilOffset = ilOffset; - pInfo->probeIndex = info.compHandleHistogramProbeCount++; - call->gtHandleHistogramProfileCandidateInfo = pInfo; + pInfo->ilOffset = ilOffset; + pInfo->probeIndex = info.compHandleHistogramProbeCount++; + call->SetHandleHistogramProfileCandidateInfo(pInfo); compCurBB->SetFlags(BBF_HAS_HISTOGRAM_PROFILE); } } @@ -9958,7 +9958,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) op1 = gtNewHelperCallNode(helper, TYP_REF, op1, op2); } - op1->AsCall()->compileTimeHelperArgumentHandle = (CORINFO_GENERIC_HANDLE)resolvedToken.hClass; + op1->AsCall()->SetCompileTimeHelperArgumentHandle((CORINFO_GENERIC_HANDLE)resolvedToken.hClass); // Remember that this function contains 'new' of an SD array. optMethodFlags |= OMF_HAS_NEWARRAY; diff --git a/src/coreclr/jit/importercalls.cpp b/src/coreclr/jit/importercalls.cpp index 5622b2ca5835aa..2ef66b88fa8ea8 100644 --- a/src/coreclr/jit/importercalls.cpp +++ b/src/coreclr/jit/importercalls.cpp @@ -697,7 +697,7 @@ var_types Compiler::impImportCall(OPCODE opcode, cookie->gtFlags |= GTF_DONT_CSE; cookieConst->gtFlags |= GTF_DONT_CSE; - call->AsCall()->gtCallCookie = cookie; + call->AsCall()->SetCallCookie(cookie); if (canTailCall) { @@ -1362,9 +1362,9 @@ var_types Compiler::impImportCall(OPCODE opcode, // We might want to instrument it for optimized versions too, but we don't currently. HandleHistogramProfileCandidateInfo* pInfo = new (this, CMK_Inlining) HandleHistogramProfileCandidateInfo; - pInfo->ilOffset = rawILOffset; - pInfo->probeIndex = 0; - call->AsCall()->gtHandleHistogramProfileCandidateInfo = pInfo; + pInfo->ilOffset = rawILOffset; + pInfo->probeIndex = 0; + call->AsCall()->SetHandleHistogramProfileCandidateInfo(pInfo); compCurBB->SetFlags(BBF_HAS_VALUE_PROFILE); } impAppendTree(call, CHECK_SPILL_ALL, impCurStmtDI); @@ -1530,9 +1530,9 @@ var_types Compiler::impImportCall(OPCODE opcode, // We might want to instrument it for optimized versions too, but we don't currently. HandleHistogramProfileCandidateInfo* pInfo = new (this, CMK_Inlining) HandleHistogramProfileCandidateInfo; - pInfo->ilOffset = rawILOffset; - pInfo->probeIndex = 0; - call->AsCall()->gtHandleHistogramProfileCandidateInfo = pInfo; + pInfo->ilOffset = rawILOffset; + pInfo->probeIndex = 0; + call->AsCall()->SetHandleHistogramProfileCandidateInfo(pInfo); compCurBB->SetFlags(BBF_HAS_VALUE_PROFILE); } } @@ -2680,13 +2680,14 @@ GenTree* Compiler::impInitializeArrayIntrinsic(CORINFO_SIG_INFO* sig) return nullptr; } - CORINFO_CLASS_HANDLE arrayClsHnd = (CORINFO_CLASS_HANDLE)newArrayCall->AsCall()->compileTimeHelperArgumentHandle; + CORINFO_CLASS_HANDLE arrayClsHnd = + (CORINFO_CLASS_HANDLE)newArrayCall->AsCall()->GetCompileTimeHelperArgumentHandle(); // // Make sure we found a compile time handle to the array // - if (!arrayClsHnd) + if (arrayClsHnd == NO_CLASS_HANDLE) { return nullptr; } @@ -6549,7 +6550,7 @@ void Compiler::impCheckForPInvokeCall( unmanagedCallConv = info.compCompHnd->getUnmanagedCallConv(nullptr, sig, &suppressGCTransition); - assert(!call->gtCallCookie); + assert(!call->HasCallCookie()); } if (suppressGCTransition) @@ -7426,7 +7427,7 @@ void Compiler::addGuardedDevirtualizationCandidate(GenTreeCall* call, // // If transforming these provides a benefit, we could save this off in the same way // we save the stub address below. - if ((call->gtCallType == CT_INDIRECT) && (call->AsCall()->gtCallCookie != nullptr)) + if ((call->gtCallType == CT_INDIRECT) && (call->AsCall()->HasCallCookie())) { JITDUMP("NOT Marking call [%06u] as guarded devirtualization candidate -- CT_INDIRECT with cookie\n", dspTreeID(call)); @@ -8902,9 +8903,9 @@ bool Compiler::impConsiderCallProbe(GenTreeCall* call, IL_OFFSET ilOffset) // Record some info needed for the class profiling probe. // - pInfo->ilOffset = ilOffset; - pInfo->probeIndex = info.compHandleHistogramProbeCount++; - call->gtHandleHistogramProfileCandidateInfo = pInfo; + pInfo->ilOffset = ilOffset; + pInfo->probeIndex = info.compHandleHistogramProbeCount++; + call->SetHandleHistogramProfileCandidateInfo(pInfo); // Flag block as needing scrutiny // @@ -8944,7 +8945,7 @@ Compiler::GDVProbeType Compiler::compClassifyGDVProbeType(GenTreeCall* call) // function to classify the probe type until after we have decided on // whether we probe them or not. createTypeHistogram = createTypeHistogram || (impIsCastHelperEligibleForClassProbe(call) && - (call->gtHandleHistogramProfileCandidateInfo != nullptr)); + call->HasHandleHistogramProfileCandidateInfo()); } bool createMethodHistogram = ((JitConfig.JitDelegateProfiling() > 0) && call->IsDelegateInvoke()) || diff --git a/src/coreclr/jit/lower.cpp b/src/coreclr/jit/lower.cpp index d27dec517ada88..7f769fdf4867f3 100644 --- a/src/coreclr/jit/lower.cpp +++ b/src/coreclr/jit/lower.cpp @@ -6169,7 +6169,7 @@ GenTree* Lowering::LowerDirectCall(GenTreeCall* call) { // a direct call within range of hardware relative call instruction // stash the address for codegen - call->gtDirectCallAddress = addr; + call->SetDirectCallAddress(addr); } break; @@ -6307,7 +6307,7 @@ GenTree* Lowering::LowerDelegateInvoke(GenTreeCall* call) GenTree* Lowering::LowerIndirectNonvirtCall(GenTreeCall* call) { #ifdef TARGET_X86 - if (call->gtCallCookie != nullptr) + if (call->HasCallCookie()) { NYI_X86("Morphing indirect non-virtual call with non-standard args"); } @@ -6316,7 +6316,7 @@ GenTree* Lowering::LowerIndirectNonvirtCall(GenTreeCall* call) // Indirect cookie calls gets transformed by fgMorphArgs as indirect call with non-standard args. // Hence we should never see this type of call in lower. - noway_assert(call->gtCallCookie == nullptr); + noway_assert(!call->HasCallCookie()); return nullptr; } @@ -6973,7 +6973,7 @@ GenTree* Lowering::LowerNonvirtPinvokeCall(GenTreeCall* call) { // a direct call within range of hardware relative call instruction // stash the address for codegen - call->gtDirectCallAddress = addr; + call->SetDirectCallAddress(addr); #ifdef FEATURE_READYTORUN call->gtEntryPoint.addr = nullptr; call->gtEntryPoint.accessType = IAT_VALUE; diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 65f339748c0c22..1081b2ac7a2f0c 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -1773,13 +1773,13 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call // add as a non-standard arg. } } - else if (call->gtCallType == CT_INDIRECT && (call->gtCallCookie != nullptr)) + else if ((call->gtCallType == CT_INDIRECT) && call->HasCallCookie()) { assert(!call->IsUnmanaged()); - GenTree* arg = call->gtCallCookie; + GenTree* arg = call->GetCallCookie(); noway_assert(arg != nullptr); - call->gtCallCookie = nullptr; + call->ClearUD(); // All architectures pass the cookie in a register. InsertAfterThisOrFirst(comp, NewCallArg::Primitive(arg).WellKnown(WellKnownArg::PInvokeCookie)); @@ -5753,7 +5753,7 @@ void Compiler::fgMorphTailCallViaJitHelper(GenTreeCall* call) // Check for PInvoke call types that we don't handle in codegen yet. assert(!call->IsUnmanaged()); - assert(call->IsVirtual() || (call->gtCallType != CT_INDIRECT) || (call->gtCallCookie == nullptr)); + assert(call->IsVirtual() || (call->gtCallType != CT_INDIRECT) || !call->HasCallCookie()); // Don't support tail calling helper methods assert(!call->IsHelperCall());