enable runtime stat and log interpreter in the debug version

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
This commit is contained in:
sunzhe23 2022-09-20 16:33:24 +08:00
parent 90b778cfcc
commit 82ca0bf1a4
10 changed files with 40 additions and 30 deletions

View File

@ -23,18 +23,27 @@ namespace panda::ecmascript {
#define ECMASCRIPT_ENABLE_DEBUG_MODE 0
#define ECMASCRIPT_ENABLE_ARK_CONTAINER 1
#define ECMASCRIPT_ENABLE_VERBOSE_LEVEL_LOG 0
#define ECMASCRIPT_ENABLE_INTERPRETER_LOG 0
#define ECMASCRIPT_ENABLE_BUILTIN_LOG 0
#define ECMASCRIPT_ENABLE_ASM_FILE_LOAD_LOG 0
#define ECMASCRIPT_ENABLE_RUNTIME_STAT 0 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define ECMASCRIPT_ENABLE_MERGE_ABC 1
#define ECMASCRIPT_ENABLE_SNAPSHOT 0
#define ECMASCRIPT_ENABLE_HEAP_DETAIL_STATISTICS 0
#ifndef NDEBUG
#define ECMASCRIPT_ENABLE_INTERPRETER_LOG 1
#define ECMASCRIPT_ENABLE_RUNTIME_STAT 1
#define ECMASCRIPT_ENABLE_INTERPRETER_RUNTIME_STAT 1
#define ECMASCRIPT_ENABLE_BUILTINS_RUNTIME_STAT 1
#define ECMASCRIPT_ENABLE_ALLOCATE_AND_GC_RUNTIME_STAT 1
#else
#define ECMASCRIPT_ENABLE_INTERPRETER_LOG 0
#define ECMASCRIPT_ENABLE_RUNTIME_STAT 0
#define ECMASCRIPT_ENABLE_INTERPRETER_RUNTIME_STAT 0
#define ECMASCRIPT_ENABLE_BUILTINS_RUNTIME_STAT 0
#define ECMASCRIPT_ENABLE_ALLOCATE_AND_GC_RUNTIME_STAT 0
#define ECMASCRIPT_ENABLE_SNAPSHOT 0
#define ECMASCRIPT_ENABLE_MERGE_ABC 1
#define ECMASCRIPT_ENABLE_HEAP_DETAIL_STATISTICS 0
#endif
/*
* 1. close ic
* 2. close parallel gc

View File

@ -900,12 +900,13 @@ DEF_CALL_SIGNATURE(DebugPrint)
DEF_CALL_SIGNATURE(DebugPrintInstruction)
{
// 1 : 1 input parameters
CallSignature debugPrintInstruction("DebugPrintInstruction", 0, 1,
// 2 : 2 input parameters
CallSignature debugPrintInstruction("DebugPrintInstruction", 0, 2,
ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
*callSign = debugPrintInstruction;
// 1 : 1 input parameters
std::array<VariableType, 1> params = {
// 2 : 2 input parameters
std::array<VariableType, 2> params = {
VariableType::NATIVE_POINTER(),
VariableType::NATIVE_POINTER(),
};
callSign->SetVariadicArgs(true);

View File

@ -140,7 +140,7 @@ void InterpreterStubBuilder::DebugPrintInstruction()
}
GateRef glue = PtrArgument(static_cast<size_t>(InterpreterHandlerInputs::GLUE));
GateRef pc = PtrArgument(static_cast<size_t>(InterpreterHandlerInputs::PC));
UpdateLeaveFrameAndCallNGCRuntime(glue, RTSTUB_ID(DebugPrintInstruction), { pc });
UpdateLeaveFrameAndCallNGCRuntime(glue, RTSTUB_ID(DebugPrintInstruction), { glue, pc });
#endif
}

View File

@ -33,6 +33,7 @@
#include "ecmascript/mem/concurrent_marker.h"
#include "ecmascript/module/js_module_manager.h"
#include "ecmascript/runtime_call_id.h"
#include "ecmascript/stubs/runtime_stubs.h"
#include "ecmascript/template_string.h"
#include "ecmascript/tooling/interface/js_debugger_manager.h"
@ -59,8 +60,7 @@ using CommonStubCSigns = kungfu::CommonStubCSigns;
#define HANDLE_OPCODE(opcode) \
HANDLE_##opcode: \
{ \
BytecodeInstruction inst(pc); \
LOG_INTERPRETER(DEBUG) << inst; \
RuntimeStubs::DebugPrintInstruction(thread->GetGlueAddr(), pc); \
}
#else
#define HANDLE_OPCODE(opcode) \

View File

@ -465,7 +465,7 @@ JSTaggedValue SlowRuntimeStub::AsyncFunctionResolveOrReject(JSThread *thread, JS
JSTaggedValue SlowRuntimeStub::NewObjApply(JSThread *thread, JSTaggedValue func, JSTaggedValue array)
{
INTERPRETER_TRACE(thread, Newobjspread);
INTERPRETER_TRACE(thread, NewObjApply);
[[maybe_unused]] EcmaHandleScope handleScope(thread);
JSHandle<JSTaggedValue> funcHandle(thread, func);
@ -653,7 +653,7 @@ void SlowRuntimeStub::StModuleVar(JSThread *thread, JSTaggedValue key, JSTaggedV
JSTaggedValue SlowRuntimeStub::LdLocalModuleVar(JSThread *thread, int32_t index)
{
INTERPRETER_TRACE(thread, LdLocalModuleVar);
RUNTIME_TRACE(thread, LdLocalModuleVarByIndex);
[[maybe_unused]] EcmaHandleScope scope(thread);
return RuntimeStubs::RuntimeLdLocalModuleVar(thread, index);
@ -661,7 +661,7 @@ JSTaggedValue SlowRuntimeStub::LdLocalModuleVar(JSThread *thread, int32_t index)
JSTaggedValue SlowRuntimeStub::LdExternalModuleVar(JSThread *thread, int32_t index)
{
INTERPRETER_TRACE(thread, LdExternalModuleVar);
RUNTIME_TRACE(thread, LdExternalModuleVarByIndex);
[[maybe_unused]] EcmaHandleScope scope(thread);
return RuntimeStubs::RuntimeLdExternalModuleVar(thread, index);
@ -723,7 +723,7 @@ JSTaggedValue SlowRuntimeStub::CopyDataProperties(JSThread *thread, JSTaggedValu
JSTaggedValue SlowRuntimeStub::GetIteratorNext(JSThread *thread, JSTaggedValue obj, JSTaggedValue method)
{
INTERPRETER_TRACE(thread, GetIteratorNext);
RUNTIME_TRACE(thread, GetIteratorNext);
[[maybe_unused]] EcmaHandleScope handleScope(thread);
JSHandle<JSTaggedValue> iter(thread, obj);

View File

@ -811,7 +811,7 @@ private:
PandArg<std::string> entryPoint_ {"entry-point", R"(_GLOBAL::func_main_0)",
R"(full name of entrypoint function or method. )"};
PandArg<bool> enableTypeLowering_ {"enable-type-lowering", true,
R"(tnable TSTypeLowering and TypeLowering for aot runtime. Default:true)"};
R"(enable TSTypeLowering and TypeLowering for aot runtime. Default:true)"};
};
} // namespace panda::ecmascript

View File

@ -84,7 +84,7 @@ namespace panda::ecmascript {
V(Ldnewobjrange) \
V(IsIn) \
V(Instanceof) \
V(NewobjApply) \
V(NewObjApply) \
V(CallArg0) \
V(CallArg1) \
V(CallArg2) \
@ -443,6 +443,7 @@ namespace panda::ecmascript {
V(PromiseHandler, AnyRejectElementFunction) \
V(PromiseJob, Reaction) \
V(PromiseJob, ResolveThenableJob) \
V(PromiseJob, DynamicImportJob) \
V(Promise, Constructor) \
V(Promise, All) \
V(Promise, Race) \

View File

@ -342,9 +342,9 @@ void RuntimeStubs::DebugPrint(int fmtMessageId, ...)
va_end(args);
}
void RuntimeStubs::DebugPrintInstruction(uintptr_t pc)
void RuntimeStubs::DebugPrintInstruction([[maybe_unused]]uintptr_t argGlue, const uint8_t *pc)
{
BytecodeInstruction inst(reinterpret_cast<const uint8_t*>(pc));
BytecodeInstruction inst(pc);
LOG_INTERPRETER(DEBUG) << inst;
}
@ -1922,7 +1922,7 @@ DEF_RUNTIME_STUBS(JSObjectGetMethod)
DEF_RUNTIME_STUBS(BigIntEqual)
{
RUNTIME_STUBS_HEADER(OptBigIntEqual);
RUNTIME_STUBS_HEADER(BigIntEqual);
JSTaggedValue left = GetArg(argv, argc, 0); // 0: means the zeroth parameter
JSTaggedValue right = GetArg(argv, argc, 1); // 1: means the first parameter
if (BigInt::Equal(left, right)) {
@ -1933,7 +1933,7 @@ DEF_RUNTIME_STUBS(BigIntEqual)
DEF_RUNTIME_STUBS(StringEqual)
{
RUNTIME_STUBS_HEADER(OptBigIntEqual);
RUNTIME_STUBS_HEADER(StringEqual);
JSTaggedValue left = GetArg(argv, argc, 0); // 0: means the zeroth parameter
JSTaggedValue right = GetArg(argv, argc, 1); // 1: means the first parameter
auto leftStr = EcmaString::Cast(left.GetTaggedObject());

View File

@ -320,7 +320,7 @@ public:
}
static void DebugPrint(int fmtMessageId, ...);
static void DebugPrintInstruction(uintptr_t pc);
static void DebugPrintInstruction([[maybe_unused]]uintptr_t argGlue, const uint8_t *pc);
static void FatalPrint(int fmtMessageId, ...);
static void MarkingBarrier([[maybe_unused]]uintptr_t argGlue,
uintptr_t object, size_t offset, TaggedObject *value);

View File

@ -36,7 +36,6 @@ JSTaggedType RuntimeStubs::name(uintptr_t argGlue, uint32_t argc, uintptr_t argv
#define RUNTIME_STUBS_HEADER(name) \
auto thread = JSThread::GlueToJSThread(argGlue); \
RUNTIME_TRACE(thread, name); \
[[maybe_unused]] EcmaHandleScope handleScope(thread) \
#define CONVERT_ARG_TAGGED_TYPE_CHECKED(name, index) \