• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2021-2024 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_MEM_GC_REFERENCE_PROCESSOR_EMPTY_REFERENCE_PROCESSOR_H
16 #define PANDA_MEM_GC_REFERENCE_PROCESSOR_EMPTY_REFERENCE_PROCESSOR_H
17 
18 #include "reference_processor.h"
19 
20 namespace ark::mem {
21 
22 class EmptyReferenceProcessor : public ark::mem::ReferenceProcessor {
23 public:
24     EmptyReferenceProcessor() = default;
25     ~EmptyReferenceProcessor() override = default;
26 
IsReference(const BaseClass * baseCls,const ObjectHeader * ref,const ReferenceCheckPredicateT & pred)27     bool IsReference([[maybe_unused]] const BaseClass *baseCls, [[maybe_unused]] const ObjectHeader *ref,
28                      [[maybe_unused]] const ReferenceCheckPredicateT &pred) const override
29     {
30         return false;
31     }
32 
HandleReference(GC * gc,GCMarkingStackType * objectsStack,const BaseClass * baseClass,const ObjectHeader * object,const ReferenceProcessPredicateT & pred)33     void HandleReference([[maybe_unused]] GC *gc, [[maybe_unused]] GCMarkingStackType *objectsStack,
34                          [[maybe_unused]] const BaseClass *baseClass, [[maybe_unused]] const ObjectHeader *object,
35                          [[maybe_unused]] const ReferenceProcessPredicateT &pred) override
36     {
37     }
38 
ProcessReferences(bool concurrent,bool clearSoftReferences,GCPhase gcPhase,const mem::GC::ReferenceClearPredicateT & pred)39     void ProcessReferences([[maybe_unused]] bool concurrent, [[maybe_unused]] bool clearSoftReferences,
40                            [[maybe_unused]] GCPhase gcPhase,
41                            [[maybe_unused]] const mem::GC::ReferenceClearPredicateT &pred) override
42     {
43     }
44 
ProcessReferencesAfterCompaction(const mem::GC::ReferenceClearPredicateT & pred)45     void ProcessReferencesAfterCompaction([[maybe_unused]] const mem::GC::ReferenceClearPredicateT &pred) override {}
46 
CollectClearedReferences()47     ark::mem::Reference *CollectClearedReferences() override
48     {
49         return nullptr;
50     }
51 
ScheduleForEnqueue(Reference * clearedReferences)52     void ScheduleForEnqueue([[maybe_unused]] Reference *clearedReferences) override {}
53 
Enqueue(ark::mem::Reference * clearedReferences)54     void Enqueue([[maybe_unused]] ark::mem::Reference *clearedReferences) override {}
55 
GetReferenceQueueSize()56     size_t GetReferenceQueueSize() const override
57     {
58         return 0;
59     }
60 
61 private:
62     NO_COPY_SEMANTIC(EmptyReferenceProcessor);
63     NO_MOVE_SEMANTIC(EmptyReferenceProcessor);
64 };
65 
66 }  // namespace ark::mem
67 #endif  // PANDA_MEM_GC_REFERENCE_PROCESSOR_EMPTY_REFERENCE_PROCESSOR_H
68