• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "runtime/mem/gc/epsilon/epsilon.h"
17 
18 #include "libpandabase/utils/logger.h"
19 #include "runtime/include/runtime.h"
20 #include "runtime/include/panda_vm.h"
21 
22 namespace panda::mem {
23 template <class LanguageConfig>
EpsilonGC(ObjectAllocatorBase * object_allocator,const GCSettings & settings)24 EpsilonGC<LanguageConfig>::EpsilonGC(ObjectAllocatorBase *object_allocator, const GCSettings &settings)
25     : GCLang<LanguageConfig>(object_allocator, settings)
26 {
27     this->SetType(GCType::EPSILON_GC);
28 }
29 
30 template <class LanguageConfig>
InitializeImpl()31 void EpsilonGC<LanguageConfig>::InitializeImpl()
32 {
33     InternalAllocatorPtr allocator = this->GetInternalAllocator();
34     auto barrier_set = allocator->New<GCDummyBarrierSet>(allocator);
35     ASSERT(barrier_set != nullptr);
36     this->SetGCBarrierSet(barrier_set);
37     LOG(DEBUG, GC) << "Epsilon GC initialized...";
38 }
39 
40 template <class LanguageConfig>
RunPhasesImpl(const GCTask & task)41 void EpsilonGC<LanguageConfig>::RunPhasesImpl([[maybe_unused]] const GCTask &task)
42 {
43     LOG(DEBUG, GC) << "Epsilon GC RunPhases...";
44     GCScopedPauseStats scoped_pause_stats(this->GetPandaVm()->GetGCStats());
45 }
46 
47 // NOLINTNEXTLINE(misc-unused-parameters)
48 template <class LanguageConfig>
WaitForGC(const GCTask & task)49 void EpsilonGC<LanguageConfig>::WaitForGC([[maybe_unused]] const GCTask &task)
50 {
51 }
52 
53 template <class LanguageConfig>
InitGCBits(panda::ObjectHeader * obj_header)54 void EpsilonGC<LanguageConfig>::InitGCBits([[maybe_unused]] panda::ObjectHeader *obj_header)
55 {
56 }
57 
58 template <class LanguageConfig>
InitGCBitsForAllocationInTLAB(panda::ObjectHeader * obj_header)59 void EpsilonGC<LanguageConfig>::InitGCBitsForAllocationInTLAB([[maybe_unused]] panda::ObjectHeader *obj_header)
60 {
61     LOG(FATAL, GC) << "TLABs are not supported by this GC";
62 }
63 
64 template <class LanguageConfig>
Trigger()65 void EpsilonGC<LanguageConfig>::Trigger()
66 {
67 }
68 
69 template <class LanguageConfig>
MarkReferences(PandaStackTL<ObjectHeader * > * references,GCPhase gc_phase)70 void EpsilonGC<LanguageConfig>::MarkReferences([[maybe_unused]] PandaStackTL<ObjectHeader *> *references,
71                                                [[maybe_unused]] GCPhase gc_phase)
72 {
73 }
74 
75 template class EpsilonGC<PandaAssemblyLanguageConfig>;
76 
77 }  // namespace panda::mem
78