mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
deopt debug info
In order to deopt debug, thus need add debug info, add bc print issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I634KP?from=project-issue Signed-off-by: songzhengchao <songzhengchao@huawei.com> Change-Id: Icd1487800045f39e4b46eb6d852da0e3d5e05d13
This commit is contained in:
parent
f9debb3801
commit
6994c71849
2
BUILD.gn
2
BUILD.gn
@ -437,7 +437,6 @@ ecma_source = [
|
||||
"ecmascript/builtins/builtins_weak_ref.cpp",
|
||||
"ecmascript/builtins/builtins_weak_set.cpp",
|
||||
"ecmascript/byte_array.cpp",
|
||||
"ecmascript/calleeReg.cpp",
|
||||
"ecmascript/containers/containers_arraylist.cpp",
|
||||
"ecmascript/containers/containers_deque.cpp",
|
||||
"ecmascript/containers/containers_errors.cpp",
|
||||
@ -454,6 +453,7 @@ ecma_source = [
|
||||
"ecmascript/containers/containers_treemap.cpp",
|
||||
"ecmascript/containers/containers_treeset.cpp",
|
||||
"ecmascript/containers/containers_vector.cpp",
|
||||
"ecmascript/deoptimizer/calleeReg.cpp",
|
||||
"ecmascript/dfx/pgo_profiler/pgo_profiler_loader.cpp",
|
||||
"ecmascript/dfx/pgo_profiler/pgo_profiler_manager.cpp",
|
||||
"ecmascript/dfx/stackinfo/js_stackinfo.cpp",
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define ECMASCRIPT_AOT_FILE_MANAGER_H
|
||||
|
||||
#include "ecmascript/ark_stackmap.h"
|
||||
#include "ecmascript/calleeReg.h"
|
||||
#include "ecmascript/deoptimizer/calleeReg.h"
|
||||
#include "ecmascript/js_function.h"
|
||||
#include "ecmascript/js_runtime_options.h"
|
||||
#include "ecmascript/compiler/binary_section.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "ecmascript/compiler/assembler/x64/extended_assembler_x64.h"
|
||||
#include "ecmascript/calleeReg.h"
|
||||
#include "ecmascript/deoptimizer/calleeReg.h"
|
||||
#include "ecmascript/frames.h"
|
||||
|
||||
namespace panda::ecmascript::x64 {
|
||||
|
@ -227,13 +227,22 @@ bool Deoptimizier::CollectVirtualRegisters(Method* method, FrameWriter *frameWri
|
||||
return true;
|
||||
}
|
||||
|
||||
void Deoptimizier::Dump(Method* method)
|
||||
{
|
||||
if (enableDeoptTrace_) {
|
||||
std::string data = JsStackInfo::BuildMethodTrace(method, pc_);
|
||||
LOG_COMPILER(INFO) << "Deoptimize" << data;
|
||||
const uint8_t *pc = method->GetBytecodeArray() + pc_;
|
||||
BytecodeInstruction inst(pc);
|
||||
LOG_COMPILER(INFO) << inst;
|
||||
}
|
||||
}
|
||||
|
||||
JSTaggedType Deoptimizier::ConstructAsmInterpretFrame()
|
||||
{
|
||||
JSTaggedValue callTarget = GetFrameArgv(kungfu::CommonArgIdx::FUNC);
|
||||
auto method = GetMethod(callTarget);
|
||||
std::string data = JsStackInfo::BuildMethodTrace(method, pc_);
|
||||
|
||||
LOG_COMPILER(DEBUG) << "Deoptimize" << data;
|
||||
Dump(method);
|
||||
ASSERT(thread_ != nullptr);
|
||||
|
||||
FrameWriter frameWriter(this);
|
||||
|
@ -16,8 +16,8 @@
|
||||
#ifndef ECMASCRIPT_DEOPTIMIZER_H
|
||||
#define ECMASCRIPT_DEOPTIMIZER_H
|
||||
#include "ecmascript/base/aligned_struct.h"
|
||||
#include "ecmascript/calleeReg.h"
|
||||
#include "ecmascript/compiler/argument_accessor.h"
|
||||
#include "ecmascript/deoptimizer/calleeReg.h"
|
||||
#include "ecmascript/js_handle.h"
|
||||
#include "ecmascript/js_tagged_value.h"
|
||||
#include "ecmascript/llvm_stackmap_type.h"
|
||||
@ -92,6 +92,8 @@ public:
|
||||
{
|
||||
kungfu::CalleeReg callreg;
|
||||
numCalleeRegs_ = static_cast<size_t>(callreg.GetCallRegNum());
|
||||
JSRuntimeOptions options = thread_->GetEcmaVM()->GetJSOptions();
|
||||
enableDeoptTrace_ = options.IsEnableDeoptTrace();
|
||||
}
|
||||
void CollectVregs(const std::vector<kungfu::ARKDeopt>& deoptBundle);
|
||||
void CollectDeoptBundleVec(std::vector<kungfu::ARKDeopt>& deoptBundle);
|
||||
@ -136,6 +138,7 @@ private:
|
||||
}
|
||||
Method* GetMethod(JSTaggedValue &target);
|
||||
void RelocateCalleeSave();
|
||||
void Dump(Method* method);
|
||||
JSThread *thread_ {nullptr};
|
||||
uintptr_t *calleeRegAddr_ {nullptr};
|
||||
size_t numCalleeRegs_ {0};
|
||||
@ -147,6 +150,7 @@ private:
|
||||
JSTaggedValue env_ {JSTaggedValue::Undefined()};
|
||||
size_t frameArgc_ {0};
|
||||
JSTaggedType *frameArgvs_ {nullptr};
|
||||
bool enableDeoptTrace_ {false};
|
||||
};
|
||||
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -12,7 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "ecmascript/calleeReg.h"
|
||||
#include "ecmascript/deoptimizer/calleeReg.h"
|
||||
#include "libpandabase/macros.h"
|
||||
#include <iostream>
|
||||
|
||||
@ -58,6 +58,7 @@ int CalleeReg::FindCallRegOrder(const DwarfRegType reg) const
|
||||
if (it != reg2Location_.end()) {
|
||||
return it->second;
|
||||
} else {
|
||||
LOG_FULL(FATAL) << "reg:" << std::dec << reg;
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
@ -57,6 +57,7 @@ const std::string PUBLIC_API HELP_OPTION_MSG =
|
||||
"--compiler-log-time: Enable to print pass compiler time. Default: false\n"
|
||||
"--enable-ark-tools: Enable ark tools to debug. Default: false\n"
|
||||
"--enable-bytecode-trace: enable tracing bytecode for aot runtime. Default: false\n"
|
||||
"--enable-deopt-trace: enable tracing deopt for aot runtime. Default: false\n"
|
||||
"--enable-cpuprofiler: Enable cpuprofiler to sample call stack and output to json file. Default: false\n"
|
||||
"--enable-force-gc: enable force gc when allocating object. Default: true\n"
|
||||
"--enable-ic: switch of inline cache. Default: true\n"
|
||||
@ -124,6 +125,7 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
|
||||
{"compiler-log-time", required_argument, nullptr, OPTION_COMPILER_LOG_TIME},
|
||||
{"enable-ark-tools", required_argument, nullptr, OPTION_ENABLE_ARK_TOOLS},
|
||||
{"enable-bytecode-trace", required_argument, nullptr, OPTION_ENABLE_BC_TRACE},
|
||||
{"enable-deopt-trace", required_argument, nullptr, OPTION_ENABLE_DEOPT_TRACE},
|
||||
{"enable-cpuprofiler", required_argument, nullptr, OPTION_ENABLE_CPUPROFILER},
|
||||
{"enable-force-gc", required_argument, nullptr, OPTION_ENABLE_FORCE_GC},
|
||||
{"enable-ic", required_argument, nullptr, OPTION_ENABLE_IC},
|
||||
@ -270,6 +272,14 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPTION_ENABLE_DEOPT_TRACE:
|
||||
ret = ParseBoolParam(&argBool);
|
||||
if (ret) {
|
||||
SetEnableDeoptTrace(argBool);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case OPTION_ENABLE_CPUPROFILER:
|
||||
ret = ParseBoolParam(&argBool);
|
||||
if (ret) {
|
||||
|
@ -87,6 +87,7 @@ enum CommandValues {
|
||||
OPTION_IS_WORKER,
|
||||
OPTION_BUILTINS_DTS,
|
||||
OPTION_ENABLE_BC_TRACE,
|
||||
OPTION_ENABLE_DEOPT_TRACE,
|
||||
OPTION_LOG_LEVEL,
|
||||
OPTION_LOG_DEBUG,
|
||||
OPTION_LOG_INFO,
|
||||
@ -810,6 +811,16 @@ public:
|
||||
{
|
||||
wasSet_ |= 1ULL << static_cast<uint64_t>(opt);
|
||||
}
|
||||
|
||||
void SetEnableDeoptTrace(bool value)
|
||||
{
|
||||
enableDeoptTrace_ = value;
|
||||
}
|
||||
|
||||
bool IsEnableDeoptTrace() const
|
||||
{
|
||||
return enableDeoptTrace_;
|
||||
}
|
||||
private:
|
||||
static bool StartsWith(const std::string &haystack, const std::string &needle)
|
||||
{
|
||||
@ -877,6 +888,7 @@ private:
|
||||
bool enablePGOProfiler_ {false};
|
||||
uint32_t pgoHotnessThreshold_ {2};
|
||||
std::string pgoProfilerPath_ {""};
|
||||
bool enableDeoptTrace_ {false};
|
||||
};
|
||||
} // namespace panda::ecmascript
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user