diff --git a/runtime/napi/include/jsnapi.h b/runtime/napi/include/jsnapi.h index 8c20ba29d3b88c2b02fc239406a7b6815e1e7cbb..165025eeec814bcaed13b3fb0791f972bd751e4e 100644 --- a/runtime/napi/include/jsnapi.h +++ b/runtime/napi/include/jsnapi.h @@ -723,6 +723,11 @@ public: FATAL = 7, }; + void SetExplicitConcurrentGcEnabled(bool value) + { + is_explicit_concurrent_gc_enabled_ = value; + } + void SetGcType(GC_TYPE type) { gcType_ = type; @@ -804,6 +809,11 @@ private: return logLevel; } + bool GetExplicitConcurrentGcEnabled() const + { + return is_explicit_concurrent_gc_enabled_; + } + uint32_t GetGcPoolSize() const { return gcPoolSize_; @@ -831,6 +841,7 @@ private: GC_TYPE gcType_ = GC_TYPE::EPSILON; LOG_LEVEL logLevel_ = LOG_LEVEL::DEBUG; + bool is_explicit_concurrent_gc_enabled_ {false}; uint32_t gcPoolSize_ = DEFAULT_GC_POOL_SIZE; LOG_PRINT logBufPrint_ {nullptr}; std::string debuggerLibraryPath_ {}; diff --git a/runtime/napi/jsnapi.cpp b/runtime/napi/jsnapi.cpp index 2a1a49af115de52c8179b8e18f476872b18ab01b..203a8bf04956d6dabe300179f22c0b7c088b9431 100644 --- a/runtime/napi/jsnapi.cpp +++ b/runtime/napi/jsnapi.cpp @@ -120,6 +120,7 @@ bool JSNApi::CreateRuntime(const RuntimeOption &option) runtimeOptions.SetGcType(option.GetGcType()); runtimeOptions.SetRunGcInPlace(true); runtimeOptions.SetArkProperties(option.GetArkProperties()); + runtimeOptions.SetExplicitConcurrentGcEnabled(option.GetExplicitConcurrentGcEnabled()); // Mem runtimeOptions.SetHeapSizeLimit(option.GetGcPoolSize()); runtimeOptions.SetInternalMemorySizeLimit(INTERNAL_POOL_SIZE); diff --git a/tests/runtime/common/test_helper.h b/tests/runtime/common/test_helper.h index eb039f0c7b5885418019171c70e74f810ac7f511..8d865e14031c2dced58154855d71cef50f6d44bb 100644 --- a/tests/runtime/common/test_helper.h +++ b/tests/runtime/common/test_helper.h @@ -49,6 +49,7 @@ public: options.SetShouldInitializeIntrinsics(false); options.SetLoadRuntimes({"ecmascript"}); options.SetRunGcInPlace(true); + options.SetExplicitConcurrentGcEnabled(false); static EcmaLanguageContext lcEcma; [[maybe_unused]] bool success = Runtime::Create(options, {&lcEcma}); ASSERT_TRUE(success) << "Cannot create Runtime"; diff --git a/tests/runtime/mem/g1gc_barrier_test.cpp b/tests/runtime/mem/g1gc_barrier_test.cpp index 27cb4481ead20a6ce23a272b07143f6980925498..744149846d4e5c64f9189fba2415541ce98b8437 100644 --- a/tests/runtime/mem/g1gc_barrier_test.cpp +++ b/tests/runtime/mem/g1gc_barrier_test.cpp @@ -31,6 +31,7 @@ public: options.SetGcTriggerType("debug-never"); options.SetShouldLoadBootPandaFiles(false); options.SetShouldInitializeIntrinsics(false); + options.SetExplicitConcurrentGcEnabled(false); Runtime::Create(options); diff --git a/tests/runtime/mem/weak_containers_test.cpp b/tests/runtime/mem/weak_containers_test.cpp index cbc3e26e0ed074b603d2b1daf74c247dd26eb45c..9ac61efcdee66864e9e2fb137ddad38ea2347610 100644 --- a/tests/runtime/mem/weak_containers_test.cpp +++ b/tests/runtime/mem/weak_containers_test.cpp @@ -38,6 +38,7 @@ public: RuntimeOption option; option.SetGcType(RuntimeOption::GC_TYPE::G1_GC); option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + option.SetExplicitConcurrentGcEnabled(false); vm_ = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; thread_ = vm_->GetAssociatedJSThread();