• 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_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 panda::mem {
21 
22 class EmptyReferenceProcessor : public panda::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 
CollectClearedReferences()45     panda::mem::Reference *CollectClearedReferences() override
46     {
47         return nullptr;
48     }
49 
ScheduleForEnqueue(Reference * clearedReferences)50     void ScheduleForEnqueue([[maybe_unused]] Reference *clearedReferences) override {}
51 
Enqueue(panda::mem::Reference * clearedReferences)52     void Enqueue([[maybe_unused]] panda::mem::Reference *clearedReferences) override {}
53 
GetReferenceQueueSize()54     size_t GetReferenceQueueSize() const override
55     {
56         return 0;
57     }
58 
59 private:
60     NO_COPY_SEMANTIC(EmptyReferenceProcessor);
61     NO_MOVE_SEMANTIC(EmptyReferenceProcessor);
62 };
63 
64 }  // namespace panda::mem
65 #endif  // PANDA_MEM_GC_REFERENCE_PROCESSOR_EMPTY_REFERENCE_PROCESSOR_H
66