sticky_mark_sweep.h revision 6fac447555dc94a935b78198479cce645c837b89
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 FINAL : public PartialMarkSweep { 29 public: 30 GcType GetGcType() const OVERRIDE { 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() OVERRIDE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); 41 42 void MarkReachableObjects() OVERRIDE 43 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) 44 EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); 45 46 void Sweep(bool swap_bitmaps) OVERRIDE EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_); 47 48 // Don't need to do anything special here since we scan all the cards which may have references 49 // to the newly allocated objects. 50 void UpdateAndMarkModUnion() OVERRIDE { } 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