mirror of
https://gitee.com/openharmony/arkcompiler_runtime_core
synced 2024-11-23 06:40:32 +00:00
Fix call native code from Irtoc Fastpath
Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/IANVQS Signed-off-by: Aleksei Sidorov <aleksei.sidorov@huawei.com>
This commit is contained in:
parent
d5c16eb258
commit
a6704b6a57
@ -183,10 +183,16 @@ template <typename... Args>
|
||||
void Codegen::CallBarrier(RegMask liveRegs, VRegMask liveVregs, std::variant<EntrypointId, Reg> entrypoint,
|
||||
Args &&...params)
|
||||
{
|
||||
SaveCallerRegisters(liveRegs, liveVregs, true);
|
||||
bool isFastpath = GetGraph()->GetMode().IsFastPath();
|
||||
if (isFastpath) {
|
||||
// irtoc fastpath needs to save all caller registers in case of call native function
|
||||
liveRegs = GetCallerRegsMask(GetArch(), false);
|
||||
liveVregs = GetCallerRegsMask(GetArch(), true);
|
||||
}
|
||||
SaveCallerRegisters(liveRegs, liveVregs, !isFastpath);
|
||||
FillCallParams(std::forward<Args>(params)...);
|
||||
EmitCallRuntimeCode(nullptr, entrypoint);
|
||||
LoadCallerRegisters(liveRegs, liveVregs, true);
|
||||
LoadCallerRegisters(liveRegs, liveVregs, !isFastpath);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -2182,7 +2182,22 @@ void Codegen::VisitCallIndirect(CallIndirectInst *inst)
|
||||
void Codegen::VisitCall(CallInst *inst)
|
||||
{
|
||||
ASSERT(GetGraph()->GetRelocationHandler() != nullptr);
|
||||
ASSERT(!HasLiveCallerSavedRegs(inst));
|
||||
|
||||
auto mode = GetGraph()->GetMode();
|
||||
ASSERT(mode.IsFastPath() || mode.IsInterpreter() || mode.IsNative());
|
||||
ASSERT(mode.IsFastPath() || !HasLiveCallerSavedRegs(inst));
|
||||
|
||||
RegMask callerRegs;
|
||||
RegMask callerFpRegs;
|
||||
auto dstReg = ConvertRegister(inst->GetDstReg(), inst->GetType());
|
||||
|
||||
if (mode.IsFastPath()) {
|
||||
// irtoc fastpath needs to save all caller registers in case of call native function
|
||||
callerRegs = GetCallerRegsMask(GetArch(), false);
|
||||
callerFpRegs = GetCallerRegsMask(GetArch(), true);
|
||||
GetEncoder()->SetRegister(&callerRegs, &callerFpRegs, dstReg, false);
|
||||
SaveCallerRegisters(callerRegs, callerFpRegs, false);
|
||||
}
|
||||
|
||||
RelocationInfo relocation;
|
||||
relocation.data = inst->GetCallMethodId();
|
||||
@ -2190,10 +2205,13 @@ void Codegen::VisitCall(CallInst *inst)
|
||||
GetGraph()->GetRelocationHandler()->AddRelocation(relocation);
|
||||
|
||||
if (inst->HasUsers()) {
|
||||
auto dstReg = ConvertRegister(inst->GetDstReg(), inst->GetType());
|
||||
ASSERT(dstReg.IsValid());
|
||||
GetEncoder()->EncodeMov(dstReg, GetTarget().GetReturnReg(dstReg.GetType()));
|
||||
}
|
||||
|
||||
if (mode.IsFastPath()) {
|
||||
LoadCallerRegisters(callerRegs, callerFpRegs, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void GetEntryPointId(uint64_t elementSize, RuntimeInterface::EntrypointId &eid)
|
||||
|
@ -33,6 +33,7 @@ if (NOT CROSS_VALUES_CONFIG)
|
||||
set(PANDA_AUX_BINARY_DIR auxiliary_panda_binary_dirs/${arch})
|
||||
set(CMAKE_VARIABLES
|
||||
"'-G${CMAKE_GENERATOR}'
|
||||
-DES2PANDA_PATH=${ES2PANDA_PATH}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${toolchain}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DANDROID_ABI=${ANDROID_ABI}
|
||||
|
Loading…
Reference in New Issue
Block a user