arkcompiler_ets_runtime/ecmascript/compiler/bc_call_signature.cpp
yingguofeng@huawei.com a6ddc25b6e feat>(compiler): PGO type profiler
1、PGO Support type profiler for asm interpreter
    2、Optimization function call profiler
    3、ap version promote to 0.0.0.2
    4、Adaptor number speculative phase supporting pgo type

link #I6JPH4

Change-Id: I18043c4f99af93e5ba6eb2e895039fe0edfe5b4e
Signed-off-by: yingguofeng@huawei.com <yingguofeng@huawei.com>
2023-03-30 20:39:06 +08:00

73 lines
3.4 KiB
C++

/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecmascript/compiler/bc_call_signature.h"
#include "ecmascript/compiler/call_signature.h"
#include "ecmascript/compiler/interpreter_stub.h"
#include "ecmascript/stubs/runtime_stubs.h"
namespace panda::ecmascript::kungfu {
CallSignature BytecodeStubCSigns::callSigns_[BytecodeStubCSigns::NUM_OF_VALID_STUBS];
CallSignature BytecodeStubCSigns::bcHandlerCSign_;
CallSignature BytecodeStubCSigns::bcDebuggerHandlerCSign_;
void BytecodeStubCSigns::Initialize()
{
#define INIT_SIGNATURES(name) \
BytecodeHandlerCallSignature::Initialize(&callSigns_[name]); \
callSigns_[name].SetID(ID_##name); \
callSigns_[name].SetName(std::string("BCStub_") + #name); \
callSigns_[name].SetConstructor( \
[](void* env) { \
return static_cast<void*>( \
new name##StubBuilder(&callSigns_[name], \
static_cast<Environment*>(env))); \
});
INTERPRETER_BC_STUB_LIST(INIT_SIGNATURES)
#define INIT_SIGNATURES_DYN(name, ...) \
INIT_SIGNATURES(name) \
callSigns_[name].SetTargetKind(CallSignature::TargetKind::BYTECODE_PROFILE_HANDLER);
ASM_INTERPRETER_BC_PROFILER_STUB_LIST(INIT_SIGNATURES_DYN)
#undef INIT_SIGNATURES_DYN
#undef INIT_SIGNATURES
#define INIT_HELPER_SIGNATURES(name) \
BytecodeHandlerCallSignature::Initialize(&callSigns_[name]); \
callSigns_[name].SetID(ID_##name); \
callSigns_[name].SetName(std::string("BCStub_") + #name); \
callSigns_[name].SetTargetKind(CallSignature::TargetKind::BYTECODE_HELPER_HANDLER); \
callSigns_[name].SetConstructor( \
[](void* env) { \
return static_cast<void*>( \
new name##StubBuilder(&callSigns_[name], static_cast<Environment*>(env))); \
});
ASM_INTERPRETER_BC_HELPER_STUB_LIST(INIT_HELPER_SIGNATURES)
#undef INIT_HELPER_SIGNATURES
BytecodeHandlerCallSignature::Initialize(&bcHandlerCSign_);
BytecodeDebuggerHandlerCallSignature::Initialize(&bcDebuggerHandlerCSign_);
}
void BytecodeStubCSigns::GetCSigns(std::vector<const CallSignature*>& outCSigns)
{
for (size_t i = 0; i < NUM_OF_VALID_STUBS; i++) {
outCSigns.push_back(&callSigns_[i]);
}
}
} // namespace panda::ecmascript::kungfu