sticky_mark_sweep.h revision 02c8cc6d1312a2b55533f02f6369dc7c94672f90
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 24namespace art { 25namespace gc { 26namespace collector { 27 28class StickyMarkSweep : public PartialMarkSweep { 29 public: 30 GcType GetGcType() const { 31 return kGcTypeSticky; 32 } 33 34 explicit StickyMarkSweep(Heap* heap, bool is_concurrent, const std::string& name_prefix = ""); 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 void Sweep(bool swap_bitmaps) EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); 47 48 DISALLOW_COPY_AND_ASSIGN(StickyMarkSweep); 49}; 50 51} // namespace collector 52} // namespace gc 53} // namespace art 54 55#endif // ART_RUNTIME_GC_COLLECTOR_STICKY_MARK_SWEEP_H_ 56