• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ART_RUNTIME_GC_COLLECTOR_STICKY_MARK_SWEEP_H_
18 #define ART_RUNTIME_GC_COLLECTOR_STICKY_MARK_SWEEP_H_
19 
20 #include "base/macros.h"
21 #include "locks.h"
22 #include "partial_mark_sweep.h"
23 
24 namespace art {
25 namespace gc {
26 namespace collector {
27 
28 class StickyMarkSweep : public PartialMarkSweep {
29  public:
GetGcType()30   GcType GetGcType() const {
31     return kGcTypeSticky;
32   }
33 
34   explicit StickyMarkSweep(Heap* heap, bool is_concurrent, const std::string& name_prefix = "");
~StickyMarkSweep()35   ~StickyMarkSweep() {}
36 
37  protected:
38   // Bind the live bits to the mark bits of bitmaps for all spaces, all spaces other than the
39   // alloc space will be marked as immune.
40   void BindBitmaps() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
41 
42   void MarkReachableObjects()
43       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
44       EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_);
45 
46   virtual void MarkThreadRoots(Thread* self)
47       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
48       EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_);
49 
50   void Sweep(bool swap_bitmaps) EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_);
51 
52  private:
53   DISALLOW_COPY_AND_ASSIGN(StickyMarkSweep);
54 };
55 
56 }  // namespace collector
57 }  // namespace gc
58 }  // namespace art
59 
60 #endif  // ART_RUNTIME_GC_COLLECTOR_STICKY_MARK_SWEEP_H_
61