Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 2 additions & 25 deletions src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3435,33 +3435,10 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
{
// Generate a direct call to a non-virtual user defined or helper method
assert(call->IsHelperCall() || (call->gtCallType == CT_USER_FUNC));
assert(call->gtDirectCallAddress != nullptr);

#ifdef FEATURE_READYTORUN
if (call->gtEntryPoint.addr != NULL)
{
assert(call->gtEntryPoint.accessType == IAT_VALUE);
params.addr = call->gtEntryPoint.addr;
}
else
#endif // FEATURE_READYTORUN
if (call->IsHelperCall())
{
CorInfoHelpFunc helperNum = m_compiler->eeGetHelperNum(params.methHnd);
noway_assert(helperNum != CORINFO_HELP_UNDEF);

CORINFO_CONST_LOOKUP helperLookup = m_compiler->compGetHelperFtn(helperNum);
params.addr = helperLookup.addr;
assert(helperLookup.accessType == IAT_VALUE);
}
else
{
// Direct call to a non-virtual user function.
params.addr = call->gtDirectCallAddress;
}

assert(params.addr != nullptr);
params.addr = call->gtDirectCallAddress;

// Non-virtual direct call to known addresses
#ifdef TARGET_ARM
if (!validImmForBL((ssize_t)params.addr))
{
Expand Down
27 changes: 2 additions & 25 deletions src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5830,33 +5830,10 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
{
// Generate a direct call to a non-virtual user defined or helper method
assert(call->IsHelperCall() || (call->gtCallType == CT_USER_FUNC));

#ifdef FEATURE_READYTORUN
if (call->gtEntryPoint.addr != NULL)
{
assert(call->gtEntryPoint.accessType == IAT_VALUE);
params.addr = call->gtEntryPoint.addr;
}
else
#endif // FEATURE_READYTORUN
if (call->IsHelperCall())
{
CorInfoHelpFunc helperNum = m_compiler->eeGetHelperNum(params.methHnd);
noway_assert(helperNum != CORINFO_HELP_UNDEF);

CORINFO_CONST_LOOKUP helperLookup = m_compiler->compGetHelperFtn(helperNum);
params.addr = helperLookup.addr;
assert(helperLookup.accessType == IAT_VALUE);
}
else
{
// Direct call to a non-virtual user function.
params.addr = call->gtDirectCallAddress;
}

assert(params.addr != nullptr);
assert(call->gtDirectCallAddress != nullptr);

params.callType = EC_FUNC_TOKEN;
params.addr = call->gtDirectCallAddress;
genEmitCallWithCurrentGC(params);
}
}
Expand Down
28 changes: 2 additions & 26 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5662,35 +5662,11 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
{
// Generate a direct call to a non-virtual user defined or helper method
assert(call->IsHelperCall() || (call->gtCallType == CT_USER_FUNC));

#ifdef FEATURE_READYTORUN
if (call->gtEntryPoint.addr != NULL)
{
assert(call->gtEntryPoint.accessType == IAT_VALUE);
params.addr = call->gtEntryPoint.addr;
}
else
#endif // FEATURE_READYTORUN
{
if (call->IsHelperCall())
{
CorInfoHelpFunc helperNum = m_compiler->eeGetHelperNum(params.methHnd);
noway_assert(helperNum != CORINFO_HELP_UNDEF);

CORINFO_CONST_LOOKUP helperLookup = m_compiler->compGetHelperFtn(helperNum);
params.addr = helperLookup.addr;
assert(helperLookup.accessType == IAT_VALUE);
}
else
{
// Direct call to a non-virtual user function.
params.addr = call->gtDirectCallAddress;
}
}
assert(call->gtDirectCallAddress != nullptr);

params.callType = EC_FUNC_TOKEN;
params.addr = call->gtDirectCallAddress;
params.ireg = params.isJump ? rsGetRsvdReg() : REG_RA;

genEmitCallWithCurrentGC(params);
}
}
Expand Down
34 changes: 3 additions & 31 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6325,42 +6325,14 @@ void CodeGen::genCallInstruction(GenTreeCall* call X86_ARG(target_ssize_t stackA
params.ireg = indirCellReg;
genEmitCallWithCurrentGC(params);
}
#ifdef FEATURE_READYTORUN
else if (call->gtEntryPoint.addr != nullptr)
{
params.callType = (call->gtEntryPoint.accessType == IAT_VALUE) ? EC_FUNC_TOKEN : EC_FUNC_TOKEN_INDIR;
params.addr = (void*)call->gtEntryPoint.addr;
genEmitCallWithCurrentGC(params);
}
#endif
else
{
// Generate a direct call to a non-virtual user defined or helper method
// Generate a direct call to a non-virtual user defined or helper method.
assert(call->IsHelperCall() || (call->gtCallType == CT_USER_FUNC));

void* addr = nullptr;
if (call->IsHelperCall())
{
// Direct call to a helper method.
CorInfoHelpFunc helperNum = m_compiler->eeGetHelperNum(params.methHnd);
noway_assert(helperNum != CORINFO_HELP_UNDEF);

CORINFO_CONST_LOOKUP helperLookup = m_compiler->compGetHelperFtn(helperNum);
addr = helperLookup.addr;
assert(helperLookup.accessType == IAT_VALUE);
}
else
{
// Direct call to a non-virtual user function.
addr = call->gtDirectCallAddress;
}

assert(addr != nullptr);

// Non-virtual direct calls to known addresses
assert(call->gtDirectCallAddress != nullptr);

params.callType = EC_FUNC_TOKEN;
params.addr = addr;
params.addr = call->gtDirectCallAddress;
genEmitCallWithCurrentGC(params);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2867,6 +2867,7 @@ GenTree* Lowering::LowerCall(GenTree* node)
}
#endif

call->gtDirectCallAddress = nullptr; // Clear out any stale data from the union.
call->ClearOtherRegs();

#if HAS_FIXED_REGISTER_SET
Expand Down
Loading