diff --git a/common_components/common_runtime/base_runtime_param.cpp b/common_components/common_runtime/base_runtime_param.cpp index 19f3ffa21502529ba95f9ed0e854e43b95e35ca3..51db0d92b07057e4134671362e81da84e8b5b458 100755 --- a/common_components/common_runtime/base_runtime_param.cpp +++ b/common_components/common_runtime/base_runtime_param.cpp @@ -32,10 +32,6 @@ void BaseRuntimeParam::SetConfigHeapSize(RuntimeParam ¶m, size_t configHeapS param.heapParam.heapSize = std::min(configHeapSize, MAX_HEAP_POOL_SIZE) / KB; } -void BaseRuntimeParam::SetMaxGarbageCacheSize(RuntimeParam ¶m, uint64_t maxGarbageCacheSize) -{ - param.gcParam.maxGarbageCacheSize = maxGarbageCacheSize; -} /** * Determine the default stack size and heap size according to system memory. * If system memory size is less then 1GB, heap size is 64MB and stack size is 64KB. diff --git a/common_components/common_runtime/base_runtime_param.h b/common_components/common_runtime/base_runtime_param.h index a55a608aa1888f0a408da05edfb23e77ac8a170c..d8b68cd2e63ab99eb45154731c09587d87691528 100755 --- a/common_components/common_runtime/base_runtime_param.h +++ b/common_components/common_runtime/base_runtime_param.h @@ -26,7 +26,6 @@ public: static RuntimeParam DefaultRuntimeParam(); static size_t InitHeapSize(); static void SetConfigHeapSize(RuntimeParam ¶m, size_t configHeapSize); - static void SetMaxGarbageCacheSize(RuntimeParam ¶m, uint64_t maxGarbageCacheSize); #ifdef PANDA_TARGET_32 static constexpr size_t MAX_HEAP_POOL_SIZE = 1 * GB; #else @@ -66,8 +65,7 @@ private: V(gcParam, kMinConcurrentRemainingBytes, \ size_t, 0, INT64_MAX, 128 * KB ) /* byte */; \ V(gcParam, kMaxConcurrentRemainingBytes, \ - size_t, 0, INT64_MAX, 512 * KB ) /* byte */; \ - V(gcParam, maxGarbageCacheSize, uint64_t, 0, INT64_MAX, 16 * MB ) /* byte */; + size_t, 0, INT64_MAX, 512 * KB ) /* byte */; #else // PANDA_TARGET_OHOS #define RUNTIME_PARAM_LIST(V) \ /* KEY SUB_KEY TYPE MIN MAX DEFAULT */ /* UNIT */ \ diff --git a/common_components/heap/allocator/region_space.cpp b/common_components/heap/allocator/region_space.cpp index 4b797382c40dce8991d91262672003a830814978..9dc16d17f107a2ff82f3e1a734de0e3aa73d6819 100755 --- a/common_components/heap/allocator/region_space.cpp +++ b/common_components/heap/allocator/region_space.cpp @@ -288,7 +288,6 @@ void RegionSpace::Init(const RuntimeParam& param) MemoryMap::Option opt = MemoryMap::DEFAULT_OPTIONS; opt.tag = "region_heap"; size_t heapSize = param.heapParam.heapSize * KB; - maxGarbageCacheSize_ = param.gcParam.maxGarbageCacheSize; #ifndef PANDA_TARGET_32 static constexpr uint64_t MAX_SUPPORT_CAPACITY = 4ULL * GB; diff --git a/common_components/heap/allocator/region_space.h b/common_components/heap/allocator/region_space.h index be67860f26b8c70a2edf2efaac016ac94179a9f1..ac4df4b83b25ff54a3199cc92e77324d9631af26 100755 --- a/common_components/heap/allocator/region_space.h +++ b/common_components/heap/allocator/region_space.h @@ -186,9 +186,6 @@ public: size_t size = GetAllocatedBytes(); double cachedRatio = 1 - BaseRuntime::GetInstance()->GetHeapParam().heapUtilization; size_t targetCachedSize = static_cast(size * cachedRatio); - if (targetCachedSize > maxGarbageCacheSize_) { - targetCachedSize = maxGarbageCacheSize_; - } return regionManager_.ReleaseGarbageRegions(targetCachedSize); } } @@ -407,7 +404,6 @@ private: FromSpace fromSpace_; ToSpace toSpace_; - uint64_t maxGarbageCacheSize_ { 16 * MB }; }; using RegionalHeap = RegionSpace; diff --git a/common_components/heap/collector/marking_collector.cpp b/common_components/heap/collector/marking_collector.cpp index db58ee4bbcc3e10084b8182433f42668e87ae30d..b72627089fc14f4407bd0ff8b7066c3ef8e87e0d 100755 --- a/common_components/heap/collector/marking_collector.cpp +++ b/common_components/heap/collector/marking_collector.cpp @@ -727,7 +727,7 @@ void MarkingCollector::CopyObject(const BaseObject& fromObj, BaseObject& toObj, void MarkingCollector::ReclaimGarbageMemory(GCReason reason) { - if (reason != GC_REASON_YOUNG) { + if (reason == GC_REASON_OOM) { Heap::GetHeap().GetAllocator().ReclaimGarbageMemory(true); } else { Heap::GetHeap().GetAllocator().ReclaimGarbageMemory(false); diff --git a/ecmascript/js_runtime_options.cpp b/ecmascript/js_runtime_options.cpp index 5a91a574e44e9a1efef86943ac81f4f8e232ca7e..33582f0066b3775dde87d1bb4ca492dbcfc395d0 100644 --- a/ecmascript/js_runtime_options.cpp +++ b/ecmascript/js_runtime_options.cpp @@ -87,7 +87,6 @@ const std::string PUBLIC_API HELP_OPTION_MSG = #else "--enable-cmc-gc: Enable cmc gc. Default: 'false'\n" #endif - "--cmc-max-garbage-cache-size: Max size of cmc gc garbage cache.. Default: 16M\n" "--enable-cmc-gc-concurrent-root-marking: Enable concurrent root marking in cmc gc. Default: 'true'\n" "--force-shared-gc-frequency: How frequency force shared gc . Default: '1'\n" "--enable-ic: Switch of inline cache. Default: 'true'\n" @@ -259,7 +258,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv) {"enable-loading-stubs-log", required_argument, nullptr, OPTION_ENABLE_LOADING_STUBS_LOG}, {"enable-force-gc", required_argument, nullptr, OPTION_ENABLE_FORCE_GC}, {"enable-cmc-gc", required_argument, nullptr, OPTION_ENABLE_CMC_GC}, - {"cmc-max-garbage-cache-size", required_argument, nullptr, OPTION_MAX_GARBAGE_CACHE_SIZE}, {"enable-cmc-gc-concurrent-root-marking", required_argument, nullptr, OPTION_ENABLE_CMC_GC_CONCURRENT_ROOT_MARKING}, {"enable-ic", required_argument, nullptr, OPTION_ENABLE_IC}, @@ -627,14 +625,6 @@ bool JSRuntimeOptions::ParseCommand(const int argc, const char **argv) return false; } break; - case OPTION_MAX_GARBAGE_CACHE_SIZE: - ret = ParseUint64Param("cmc-max-garbage-cache-size", &argUInt64); - if (ret) { - SetCMCMaxGarbageCacheSize(argUInt64); - } else { - return false; - } - break; case OPTION_ENABLE_CMC_GC_CONCURRENT_ROOT_MARKING: ret = ParseBoolParam(&argBool); if (ret) { @@ -1752,11 +1742,6 @@ void JSRuntimeOptions::SetConfigHeapSize(size_t configHeapSize) common::BaseRuntimeParam::SetConfigHeapSize(param_, configHeapSize); } -void JSRuntimeOptions::SetConfigMaxGarbageCacheSize(uint64_t maxGarbageCacheSize) -{ - common::BaseRuntimeParam::SetMaxGarbageCacheSize(param_, maxGarbageCacheSize); -} - void JSRuntimeOptions::SetMemConfigProperty(const std::string &configProperty) { if (configProperty == "openArkTools") { diff --git a/ecmascript/js_runtime_options.h b/ecmascript/js_runtime_options.h index f0775e920e2f69fdf5d43a501fec0346c6d575e1..da92db275b4d4f7af717236d01544b7fb95141b7 100644 --- a/ecmascript/js_runtime_options.h +++ b/ecmascript/js_runtime_options.h @@ -96,7 +96,6 @@ enum CommandValues { OPTION_STUB_FILE, OPTION_ENABLE_FORCE_GC, OPTION_ENABLE_CMC_GC, - OPTION_MAX_GARBAGE_CACHE_SIZE, OPTION_ENABLE_CMC_GC_CONCURRENT_ROOT_MARKING, OPTION_FORCE_FULL_GC, OPTION_ENABLE_FORCE_SHARED_GC_FREQUENCY, @@ -295,7 +294,6 @@ public: bool ParseCommand(const int argc, const char** argv); bool SetDefaultValue(char* argv); - void SetConfigMaxGarbageCacheSize(uint64_t maxGarbageCacheSize); bool EnableArkTools() const { @@ -2187,16 +2185,6 @@ public: return CompilerAnFileMaxByteSize_; } - void SetCMCMaxGarbageCacheSize(uint64_t value) - { - cmcMaxGarbageCacheSize_ = value; - } - - uint64_t GetCMCMaxGarbageCacheSize() const - { - return cmcMaxGarbageCacheSize_; - } - bool IsCompilerAnFileMaxByteSizeDefault() const { return CompilerAnFileMaxByteSize_ == 0; @@ -2583,7 +2571,6 @@ private: bool enableCMCGCConcurrentRootMarking_ {true}; bool storeBarrierOpt_ {true}; uint64_t CompilerAnFileMaxByteSize_ {0_MB}; - uint64_t cmcMaxGarbageCacheSize_ {16_MB}; bool enableJitVerifyPass_ {true}; bool enableMergePoly_ {true}; bool multiContext_ {false}; diff --git a/ecmascript/mem/mem.h b/ecmascript/mem/mem.h index ba98cf98214a5183dbf389b25e32f2abe4e3011a..664be1d48234439523fc8f3f5f154849c7e6a895 100644 --- a/ecmascript/mem/mem.h +++ b/ecmascript/mem/mem.h @@ -85,7 +85,6 @@ static constexpr size_t MAX_32BIT_OBJECT_SPACE_SIZE = 1_GB; static constexpr size_t MAX_REGULAR_HEAP_OBJECT_SIZE_FOR_CMC = 32_KB; // initialize from CMC-GC static constexpr size_t MAX_REGULAR_HEAP_OBJECT_SIZE = DEFAULT_REGION_SIZE * 2 / 3; inline size_t g_maxRegularHeapObjectSize = MAX_REGULAR_HEAP_OBJECT_SIZE; -inline uint64_t g_maxGarbageCacheSize = 16_MB; // internal allocator static constexpr size_t CHUNK_ALIGN_SIZE = 4_KB; static constexpr size_t MIN_CHUNK_AREA_SIZE = 4_KB; diff --git a/ecmascript/platform/common/parameters.cpp b/ecmascript/platform/common/parameters.cpp index 2f98f08b7fde72319bc5754c54c73a52a26330a4..a6556e2e739c8e5f646cb603e1d2128123a7a1e0 100644 --- a/ecmascript/platform/common/parameters.cpp +++ b/ecmascript/platform/common/parameters.cpp @@ -30,9 +30,4 @@ namespace panda::ecmascript { { return defaultValue; } - - uint64_t GetCMCMaxGarbageCacheSize(uint64_t defaultSize) - { - return defaultSize; - } } // namespace panda::ecmascript diff --git a/ecmascript/platform/parameters.h b/ecmascript/platform/parameters.h index 8d8793facc94ba416a3504c98df021c88b97a649..b5b560687efd47d50c7d8814ef603766f7a165ba 100644 --- a/ecmascript/platform/parameters.h +++ b/ecmascript/platform/parameters.h @@ -26,7 +26,5 @@ namespace panda::ecmascript { size_t GetPoolSize(size_t defaultSize); bool IsEnableCMCGC(bool defaultValue); - - uint64_t GetCMCMaxGarbageCacheSize(uint64_t defaultSize); } // namespace panda::ecmascript #endif // ECMASCRIPT_PLATFORM_PARAMETERS_H diff --git a/ecmascript/platform/unix/ohos/parameters.cpp b/ecmascript/platform/unix/ohos/parameters.cpp index a3274e42755925fcf8097bb980ce3448b94d24d4..48975ca4784f945fcb8d04abff3c4e90db4483f6 100644 --- a/ecmascript/platform/unix/ohos/parameters.cpp +++ b/ecmascript/platform/unix/ohos/parameters.cpp @@ -45,15 +45,6 @@ namespace panda::ecmascript { return OHOS::system::GetBoolParameter("persist.ark.enable.cmc.gc", defaultValue); #else return defaultValue; -#endif - } - - uint64_t GetCMCMaxGarbageCacheSize(uint64_t defaultSize) - { -#if !defined(STANDALONE_MODE) - return OHOS::system::GetUintParameter("persist.ark.cmc.max.garbage.cache.size", defaultSize); -#else - return defaultSize; #endif } } // namespace panda::ecmascript diff --git a/ecmascript/runtime.cpp b/ecmascript/runtime.cpp index 779564acd4d8814fbe84e4dc5b4f43085975f315..cb3a747b133878c6b0b07614070fafe89dc95185 100644 --- a/ecmascript/runtime.cpp +++ b/ecmascript/runtime.cpp @@ -88,7 +88,6 @@ void Runtime::CreateIfFirstVm(const JSRuntimeOptions &options) LOG_ECMA(INFO) << "start run with cmc gc"; // SetConfigHeapSize for cmc gc, pc and persist config may change heap size. const_cast(options).SetConfigHeapSize(MemMapAllocator::GetInstance()->GetCapacity()); - const_cast(options).SetConfigMaxGarbageCacheSize(g_maxGarbageCacheSize); common::BaseRuntime::GetInstance()->Init(options.GetRuntimeParam()); common::g_enableGCTimeoutCheck = options.IsEnableGCTimeoutCheck(); #if defined(ECMASCRIPT_SUPPORT_HEAPPROFILER) @@ -181,8 +180,6 @@ void Runtime::InitGCConfig(const JSRuntimeOptions &options) g_isEnableCMCGC = IsEnableCMCGC(defaultValue); if (g_isEnableCMCGC) { g_maxRegularHeapObjectSize = 32_KB; - uint64_t defaultSize = options.GetCMCMaxGarbageCacheSize(); - g_maxGarbageCacheSize = GetCMCMaxGarbageCacheSize(defaultSize); } g_isEnableCMCGCConcurrentRootMarking = options.IsEnableCMCGCConcurrentRootMarking(); }