• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2021-2022 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 #ifndef PANDA_RUNTIME_MEM_GC_EPSILON_EPSILON_H
16 #define PANDA_RUNTIME_MEM_GC_EPSILON_EPSILON_H
17 
18 #include "runtime/mem/gc/lang/gc_lang.h"
19 
20 namespace panda::mem {
21 
22 template <class LanguageConfig>
23 class EpsilonGC final : public GCLang<LanguageConfig> {
24 public:
25     explicit EpsilonGC(ObjectAllocatorBase *object_allocator, const GCSettings &settings);
26 
27     NO_COPY_SEMANTIC(EpsilonGC);
28     NO_MOVE_SEMANTIC(EpsilonGC);
29     ~EpsilonGC() override = default;
30 
31     void RunPhases(GCTask &task);
32 
33     void WaitForGC(GCTask task) override;
34 
35     void InitGCBits(panda::ObjectHeader *obj_header) override;
36 
37     void InitGCBitsForAllocationInTLAB(panda::ObjectHeader *obj_header) override;
38 
39     void Trigger() override;
40 
41 private:
42     void MarkObject(ObjectHeader *object) override;
43     bool IsMarked(const ObjectHeader *object) const override;
44     void InitializeImpl() override;
45     void RunPhasesImpl(GCTask &task) override;
46     void MarkReferences(GCMarkingStackType *references, GCPhase gc_phase) override;
47 };
48 
49 }  // namespace panda::mem
50 
51 #endif  // PANDA_RUNTIME_MEM_GC_EPSILON_EPSILON_H
52