From 6ac076d7407a738ffd602f141bd22bf6237e07b7 Mon Sep 17 00:00:00 2001 From: ZitongLi Date: Thu, 7 Aug 2025 16:31:02 +0800 Subject: [PATCH] Reset max async task id Reset max async task id Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICRV9L Signed-off-by: zitongli --- ecmascript/dfx/stackinfo/async_stack_trace.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ecmascript/dfx/stackinfo/async_stack_trace.h b/ecmascript/dfx/stackinfo/async_stack_trace.h index b13a3cd93e..d0928d4e45 100644 --- a/ecmascript/dfx/stackinfo/async_stack_trace.h +++ b/ecmascript/dfx/stackinfo/async_stack_trace.h @@ -19,6 +19,7 @@ #include #include +#include "ecmascript/js_promise.h" #include "ecmascript/mem/c_containers.h" namespace panda::ecmascript { @@ -158,7 +159,7 @@ public: uint32_t GetAsyncTaskId() { - if (asyncTaskId_ == UINT32_MAX) { + if (asyncTaskId_ == MAX_ASYNC_TASK_ID) { asyncTaskId_ = 0; } return ++asyncTaskId_; @@ -169,6 +170,8 @@ public: NO_COPY_SEMANTIC(AsyncStackTrace); NO_MOVE_SEMANTIC(AsyncStackTrace); private: + static constexpr uint32_t MAX_ASYNC_TASK_ID = (1u << JSPromise::ASYNC_TASK_ID_BITS) - 1; + EcmaVM *vm_ {nullptr}; JSThread *jsThread_ {nullptr}; uint32_t asyncTaskId_ {0}; -- Gitee