* Copyright (c) 2025 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "common_components/heap/collector/collector.h"
#include "common_components/heap/heap.h"
#include "common_components/mutator/mutator.h"
namespace common {
namespace {
const char* const COLLECTOR_NAME[] = { "No Collector", "Proxy Collector", "Regional-Copying Collector",
"Smooth Collector" };
}
const char* Collector::GetGCPhaseName(GCPhase phase)
{
static const char* phaseNames[] = {
"undefined phase",
"idle phase",
"stub phase",
"stub phase",
"stub phase",
"stub phase",
"stub phase",
"stub phase",
"start phase",
"enum phase",
"marking phase",
"remark-satb phase",
"final-mark phase",
"post-marking phase",
"pre-copy phase",
"copy phase",
"fix phase",
};
return phaseNames[phase];
}
Collector::Collector() {}
const char* Collector::GetCollectorName() const { return COLLECTOR_NAME[collectorType_]; }
void Collector::RequestGC(GCReason reason, bool async, GCType gcType)
{
RequestGCInternal(reason, async, gcType);
return;
}
}