!7746 Code formatting rectification

Merge pull request !7746 from wangyue/codeCheck
This commit is contained in:
openharmony_ci 2024-06-12 06:59:55 +00:00 committed by Gitee
commit bcd1cccf16
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 61 additions and 48 deletions

View File

@ -355,6 +355,30 @@ BasicBlockImpl *LLVMIRBuilder::EnsureBBImpl(BasicBlock *bb) const
return bb->GetImpl<BasicBlockImpl>();
}
void LLVMIRBuilder::AssistGenPrologue(const size_t reservedSlotsSize, FrameType frameType)
{
LLVMAddTargetDependentFunctionAttr(function_, "frame-reserved-slots",
std::to_string(reservedSlotsSize).c_str());
auto ArgList = circuit_->GetArgRoot();
auto uses = acc_.Uses(ArgList);
for (auto useIt = uses.begin(); useIt != uses.end(); ++useIt) {
int argth = static_cast<int>(acc_.TryGetValue(*useIt));
LLVMValueRef value = LLVMGetParam(function_, argth);
int funcIndex = 0;
if (isFastCallAot_) {
frameType = FrameType::FASTJIT_FAST_CALL_FUNCTION_FRAME;
funcIndex = static_cast<int>(FastCallArgIdx::FUNC);
} else {
funcIndex = static_cast<int>(CommonArgIdx::FUNC);
}
if (argth == funcIndex) {
SaveByteCodePcOnOptJSFuncFrame(value);
SaveJSFuncOnOptJSFuncFrame(value);
SaveFrameTypeOnFrame(frameType, builder_);
}
}
}
void LLVMIRBuilder::GenPrologue()
{
auto frameType = circuit_->GetFrameType();
@ -397,26 +421,7 @@ void LLVMIRBuilder::GenPrologue()
}
} else if (frameType == FrameType::FASTJIT_FUNCTION_FRAME) {
reservedSlotsSize = FASTJITFunctionFrame::ComputeReservedPcOffset(slotSize_);
LLVMAddTargetDependentFunctionAttr(function_, "frame-reserved-slots",
std::to_string(reservedSlotsSize).c_str());
auto ArgList = circuit_->GetArgRoot();
auto uses = acc_.Uses(ArgList);
for (auto useIt = uses.begin(); useIt != uses.end(); ++useIt) {
int argth = static_cast<int>(acc_.TryGetValue(*useIt));
LLVMValueRef value = LLVMGetParam(function_, argth);
int funcIndex = 0;
if (isFastCallAot_) {
frameType = FrameType::FASTJIT_FAST_CALL_FUNCTION_FRAME;
funcIndex = static_cast<int>(FastCallArgIdx::FUNC);
} else {
funcIndex = static_cast<int>(CommonArgIdx::FUNC);
}
if (argth == funcIndex) {
SaveByteCodePcOnOptJSFuncFrame(value);
SaveJSFuncOnOptJSFuncFrame(value);
SaveFrameTypeOnFrame(frameType, builder_);
}
}
AssistGenPrologue(reservedSlotsSize, frameType);
} else {
LOG_COMPILER(FATAL) << "frameType interpret type error !";
ASSERT_PRINT(static_cast<uintptr_t>(frameType), "is not support !");

View File

@ -292,6 +292,7 @@ private:
LLVMValueRef GetCurrentSP();
LLVMValueRef ReadRegister(LLVMModuleRef &module, LLVMBuilderRef &builder, LLVMMetadataRef meta);
void GenPrologue();
void AssistGenPrologue(const size_t reservedSlotsSize, FrameType frameType);
LLVMBasicBlockRef EnsureLBB(BasicBlock *bb) const;
BasicBlockImpl *EnsureBBImpl(BasicBlock *bb) const;
void SetToCfg(BasicBlock *bb) const;

View File

@ -294,6 +294,35 @@ void LiteCGIRBuilder::Build()
lmirBuilder_->AppendBB(lmirBuilder_->GetLastPosBB());
}
void LiteCGIRBuilder::AssistGenPrologue(const size_t reservedSlotsSize, FrameType frameType,
maple::litecg::Function &function)
{
lmirBuilder_->SetFuncFrameResverdSlot(reservedSlotsSize);
if (circuit_->IsOsr()) {
SaveFrameTypeOnFrame(methodLiteral_->IsFastCall() ? FrameType::FASTJIT_FAST_CALL_FUNCTION_FRAME :
frameType);
return;
}
auto ArgList = circuit_->GetArgRoot();
auto uses = acc_.Uses(ArgList);
for (auto useIt = uses.begin(); useIt != uses.end(); ++useIt) {
int argth = static_cast<int>(acc_.TryGetValue(*useIt));
Var &value = lmirBuilder_->GetParam(function, argth);
int funcIndex = 0;
if (methodLiteral_->IsFastCall()) {
frameType = FrameType::FASTJIT_FAST_CALL_FUNCTION_FRAME;
funcIndex = static_cast<int>(FastCallArgIdx::FUNC);
} else {
funcIndex = static_cast<int>(CommonArgIdx::FUNC);
}
if (argth == funcIndex) {
SaveByteCodePcOnOptJSFuncFrame(value);
SaveJSFuncOnOptJSFuncFrame(value);
SaveFrameTypeOnFrame(frameType);
}
}
}
void LiteCGIRBuilder::GenPrologue(maple::litecg::Function &function)
{
auto frameType = circuit_->GetFrameType();
@ -333,30 +362,7 @@ void LiteCGIRBuilder::GenPrologue(maple::litecg::Function &function)
}
} else if (frameType == FrameType::FASTJIT_FUNCTION_FRAME) {
reservedSlotsSize = FASTJITFunctionFrame::ComputeReservedPcOffset(slotSize_);
lmirBuilder_->SetFuncFrameResverdSlot(reservedSlotsSize);
if (circuit_->IsOsr()) {
SaveFrameTypeOnFrame(methodLiteral_->IsFastCall() ? FrameType::FASTJIT_FAST_CALL_FUNCTION_FRAME :
frameType);
return;
}
auto ArgList = circuit_->GetArgRoot();
auto uses = acc_.Uses(ArgList);
for (auto useIt = uses.begin(); useIt != uses.end(); ++useIt) {
int argth = static_cast<int>(acc_.TryGetValue(*useIt));
Var &value = lmirBuilder_->GetParam(function, argth);
int funcIndex = 0;
if (methodLiteral_->IsFastCall()) {
frameType = FrameType::FASTJIT_FAST_CALL_FUNCTION_FRAME;
funcIndex = static_cast<int>(FastCallArgIdx::FUNC);
} else {
funcIndex = static_cast<int>(CommonArgIdx::FUNC);
}
if (argth == funcIndex) {
SaveByteCodePcOnOptJSFuncFrame(value);
SaveJSFuncOnOptJSFuncFrame(value);
SaveFrameTypeOnFrame(frameType);
}
}
AssistGenPrologue(reservedSlotsSize, frameType, function);
} else {
LOG_COMPILER(FATAL) << "frameType interpret type error !";
ASSERT_PRINT(static_cast<uintptr_t>(frameType), "is not support !");

View File

@ -206,6 +206,7 @@ private:
void CollectExraCallSiteInfo(std::unordered_map<int, maple::litecg::LiteCGValue> &deoptBundleInfo,
maple::litecg::Expr pcOffset, GateRef frameArgs);
void GenPrologue(maple::litecg::Function &function);
void AssistGenPrologue(const size_t reservedSlotsSize, FrameType frameType, maple::litecg::Function &function);
void SaveByteCodePcOnOptJSFuncFrame(maple::litecg::Var &value);
void SaveJSFuncOnOptJSFuncFrame(maple::litecg::Var &value);
void SaveFrameTypeOnFrame(FrameType frameType);

View File

@ -951,6 +951,7 @@ bool ArkWriteJitCode([[maybe_unused]] void *ctx, [[maybe_unused]] ReadMemFunc re
}
jitDumpElf.WriteJitElfFile(fd);
JsStackInfo::nameMap.clear();
JsStackInfo::machineCodeMap.clear();
return true;
}

View File

@ -233,8 +233,7 @@ void EcmaVM::PostFork()
}
ResetPGOProfiler();
bool enableJitFrame = ohos::JitTools::GetJitFrameEnable();
options_.SetEnableJitFrame(enableJitFrame);
options_.SetEnableJitFrame(ohos::JitTools::GetJitFrameEnable());
bool jitEscapeDisable = ohos::JitTools::GetJitEscapeDisable();
if (jitEscapeDisable || !JSNApi::IsJitEscape()) {

View File

@ -1711,7 +1711,7 @@ struct BuiltinWithArgvFrame : public base::AlignedStruct<base::AlignedPointer::S
// | call-target |
// |--------------------------|
// | argc |
// sp ----> |--------------------------| ---------------
// callerSp ---> |--------------------------| ---------------
// | returnAddr | ^
// |--------------------------| |
// | callsiteFp | |
@ -1721,7 +1721,7 @@ struct BuiltinWithArgvFrame : public base::AlignedStruct<base::AlignedPointer::S
// | call-target | |
// |--------------------------| |
// | pc(bytecode pc) | v
// +--------------------------+ ---------------
// calleeSP ---> +--------------------------+ ---------------
//
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
struct FASTJITFunctionFrame : public base::AlignedStruct<JSTaggedValue::TaggedTypeSize(),