mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-26 19:50:55 +00:00
!8661 arkcompiler_ets_runtime增加虚拟机参数获取
Merge pull request !8661 from jao_liu/local_branch
This commit is contained in:
commit
27457ce7e9
@ -41,10 +41,18 @@ public:
|
||||
{
|
||||
switch (heapType) {
|
||||
case HeapType::WORKER_HEAP:
|
||||
maxHeapSize_ = DEFAULT_WORKER_HEAP_SIZE;
|
||||
if (heapSize > LOW_MEMORY && heapSize < DEFAULT_WORKER_HEAP_SIZE) {
|
||||
maxHeapSize_ = heapSize;
|
||||
} else {
|
||||
maxHeapSize_ = DEFAULT_WORKER_HEAP_SIZE;
|
||||
}
|
||||
break;
|
||||
case HeapType::SHARED_HEAP:
|
||||
maxHeapSize_ = DEFAULT_SHARED_HEAP_SIZE;
|
||||
if (heapSize > LOW_MEMORY && heapSize < DEFAULT_SHARED_HEAP_SIZE) {
|
||||
maxHeapSize_ = heapSize;
|
||||
} else {
|
||||
maxHeapSize_ = DEFAULT_SHARED_HEAP_SIZE;
|
||||
};
|
||||
break;
|
||||
default:
|
||||
if (poolSize >= DEFAULT_HEAP_SIZE) {
|
||||
@ -52,6 +60,9 @@ public:
|
||||
} else {
|
||||
maxHeapSize_ = poolSize; // pool is too small, no memory left for worker
|
||||
}
|
||||
if (heapSize > LOW_MEMORY && heapSize < DEFAULT_HEAP_SIZE) {
|
||||
maxHeapSize_ = heapSize;
|
||||
}
|
||||
if (heapSize >= DEFAULT_HEAP_SIZE && heapSize <= MAX_HEAP_SIZE) {
|
||||
maxHeapSize_ = heapSize;
|
||||
}
|
||||
|
@ -63,6 +63,16 @@ EcmaVM *EcmaVM::Create(const JSRuntimeOptions &options)
|
||||
auto heapType = options.IsWorker() ? EcmaParamConfiguration::HeapType::WORKER_HEAP :
|
||||
EcmaParamConfiguration::HeapType::DEFAULT_HEAP;
|
||||
size_t heapSize = options.GetHeapSize();
|
||||
#if defined(PANDA_TARGET_OHOS) && !defined(STANDALONE_MODE)
|
||||
switch (heapType) {
|
||||
case EcmaParamConfiguration::HeapType::WORKER_HEAP:
|
||||
heapSize = OHOS::system::GetUintParameter<size_t>("persist.ark.heap.workersize", 0) * 1_MB;
|
||||
break;
|
||||
default:
|
||||
heapSize = OHOS::system::GetUintParameter<size_t>("persist.ark.heap.defaultsize", 0) * 1_MB;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
auto config = EcmaParamConfiguration(heapType,
|
||||
MemMapAllocator::GetInstance()->GetCapacity(),
|
||||
heapSize);
|
||||
|
@ -87,8 +87,12 @@ SharedHeap *SharedHeap::instance_ = nullptr;
|
||||
void SharedHeap::CreateNewInstance()
|
||||
{
|
||||
ASSERT(instance_ == nullptr);
|
||||
size_t heapShared = 0;
|
||||
#if defined(ECMASCRIPT_SUPPORT_SNAPSHOT) && defined(PANDA_TARGET_OHOS) && defined(ENABLE_HISYSEVENT)
|
||||
heapShared = OHOS::system::GetUintParameter<size_t>("persist.ark.heap.sharedsize", 0) * 1_MB;
|
||||
#endif
|
||||
EcmaParamConfiguration config(EcmaParamConfiguration::HeapType::SHARED_HEAP,
|
||||
MemMapAllocator::GetInstance()->GetCapacity());
|
||||
MemMapAllocator::GetInstance()->GetCapacity(), heapShared);
|
||||
instance_ = new SharedHeap(config);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user