diff --git a/common_components/heap/allocator/tests/region_manager_test.cpp b/common_components/heap/allocator/tests/region_manager_test.cpp index be0b4b2eaef972d9a95e79526b8c24daab30c7b2..7e7b02b7754f3907956dae4ba4bdf1d780caaad2 100755 --- a/common_components/heap/allocator/tests/region_manager_test.cpp +++ b/common_components/heap/allocator/tests/region_manager_test.cpp @@ -62,7 +62,7 @@ protected: mutator_ = Mutator::NewMutator(); ASSERT_NE(mutator_, nullptr); mutator_->InitTid(); - ThreadLocal::GetThreadLocalData()->mutator = mutator_; + ThreadLocal::SetMutator(mutator_); } void TearDown() override @@ -70,6 +70,7 @@ protected: if (mutator_) { delete mutator_; mutator_ = nullptr; + ThreadLocal::SetMutator(mutator_); } if (regionMemory_) { free(regionMemory_); diff --git a/common_components/heap/collector/collector_resources.cpp b/common_components/heap/collector/collector_resources.cpp index e73d163b718c2d0f7dd845231f0c815172cf0a91..28c4a6da3da24b1edd5bf178d85ae5430ce79e61 100755 --- a/common_components/heap/collector/collector_resources.cpp +++ b/common_components/heap/collector/collector_resources.cpp @@ -38,7 +38,7 @@ void* CollectorResources::GCMainThreadEntry(void* arg) LOGE_IF(UNLIKELY_CC(ret != 0)) << "pthread setname in CollectorResources::StartGCThreads() return " << ret << " rather than 0"; #endif - + ASSERT_LOGF(arg != nullptr, "GCMainThreadEntry arg=nullptr"); // set current thread as a gc thread. ThreadLocal::SetThreadType(ThreadType::GC_THREAD); @@ -119,8 +119,12 @@ void CollectorResources::StopGCThreads() LOG_COMMON(FATAL) << "[GC] CollectorResources Thread not begin."; UNREACHABLE(); } - int ret = ::pthread_join(gcMainThread_, nullptr); - LOGE_IF(UNLIKELY_CC(ret != 0)) << "::pthread_join() in StopGCThreads() return " << ret; + { + // Enter saferegion to avoid blocking gc stw + ScopedEnterSaferegion enterSaferegion(true); + int ret = ::pthread_join(gcMainThread_, nullptr); + LOGE_IF(UNLIKELY_CC(ret != 0)) << "::pthread_join() in StopGCThreads() return " << ret; + } // wait the thread pool stopped. if (gcThreadPool_ != nullptr) { gcThreadPool_->Destroy(0); @@ -221,13 +225,13 @@ void CollectorResources::NotifyGCFinished(uint64_t gcIndex) void CollectorResources::MarkGCStart() { std::unique_lock lock(gcFinishedCondMutex_); - + // Wait for any existing GC to finish - inline the wait logic std::function pred = [this] { return !IsGcStarted(); }; gcFinishedCondVar_.wait(lock, pred); - + // Now claim GC ownership SetGcStarted(true); } diff --git a/ecmascript/ecma_vm.cpp b/ecmascript/ecma_vm.cpp index b8fa05a65b9c3af9c17e2b3a24ab59564cc74e1a..3b14e6b4d0318d0c4c2f5615b591d8a723320084 100644 --- a/ecmascript/ecma_vm.cpp +++ b/ecmascript/ecma_vm.cpp @@ -343,7 +343,7 @@ bool EcmaVM::Initialize() if (Runtime::GetInstance()->IsHybridVm()) { crossVMOperator_ = new CrossVMOperator(this); } - + #endif // PANDA_JS_ETS_HYBRID_MODE gcStats_ = chunk_.New(heap_, options_.GetLongPauseTime()); gcKeyStats_ = chunk_.New(heap_, gcStats_); @@ -416,7 +416,10 @@ EcmaVM::~EcmaVM() factory_ = nullptr; } stringTable_ = nullptr; - thread_ = nullptr; + if (thread_ != nullptr) { + delete thread_; + thread_ = nullptr; + } if (g_isEnableCMCGC) { common::BaseRuntime::ExitGCCriticalSection(); } diff --git a/test/ut/ignore-ut-debug-x64-ets_runtime.txt b/test/ut/ignore-ut-debug-x64-ets_runtime.txt index 6838b8630f43b9af8e14489c28f37b06b69109f1..38486af15a0e64e6376972837ec75dc18ffb5b6a 100644 --- a/test/ut/ignore-ut-debug-x64-ets_runtime.txt +++ b/test/ut/ignore-ut-debug-x64-ets_runtime.txt @@ -22,9 +22,6 @@ obj/arkcompiler/ets_runtime/test/jittest/icnotfound/icnotfound #23099 obj/arkcompiler/ets_runtime/ecmascript/pgo_profiler/tests/PGOProfilerTestOne -#27690 -obj/arkcompiler/ets_runtime/test/jittest/throw_error/throw_error - #27862 obj/arkcompiler/ets_runtime/test/moduletest/stringreplace/stringreplaceAsmAssert diff --git a/test/ut/ignore-ut-release-qemu-ets_runtime.txt b/test/ut/ignore-ut-release-qemu-ets_runtime.txt index 21ddc18cae890ce223fa0dab20d19bdb82a7ffdd..b27ba1314af85d4b3c0b4f6b0700d01296dac056 100644 --- a/test/ut/ignore-ut-release-qemu-ets_runtime.txt +++ b/test/ut/ignore-ut-release-qemu-ets_runtime.txt @@ -261,8 +261,6 @@ obj/arkcompiler/ets_runtime/ecmascript/builtins/tests/Builtins_Array_TestWithQem obj/arkcompiler/ets_runtime/test/moduletest/throwerrorrelease/throwerrorreleaseAsm obj/arkcompiler/ets_runtime/test/moduletest/throwerrorrelease/throwerrorreleaseAsmContext -#28747 -obj/arkcompiler/ets_runtime/test/jittest/throw_error/throw_error #29435 obj/arkcompiler/ets_runtime/ecmascript/napi/test/Jsnapi_003_TestWithQemu