blob: e8f0672426c5fbcf22d54a01088bc8a224dd3c2f [file] [log] [blame]
Mathieu Chartier2b82db42012-11-14 17:29:05 -08001/*
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
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_RUNTIME_GC_COLLECTOR_STICKY_MARK_SWEEP_H_
18#define ART_RUNTIME_GC_COLLECTOR_STICKY_MARK_SWEEP_H_
Mathieu Chartier2b82db42012-11-14 17:29:05 -080019
Elliott Hughes76160052012-12-12 16:31:20 -080020#include "base/macros.h"
Mathieu Chartier2b82db42012-11-14 17:29:05 -080021#include "partial_mark_sweep.h"
Mathieu Chartier2b82db42012-11-14 17:29:05 -080022
23namespace art {
Ian Rogers1d54e732013-05-02 21:10:01 -070024namespace gc {
25namespace collector {
Mathieu Chartier2b82db42012-11-14 17:29:05 -080026
Ian Rogers6fac4472014-02-25 17:01:10 -080027class StickyMarkSweep FINAL : public PartialMarkSweep {
Mathieu Chartier2b82db42012-11-14 17:29:05 -080028 public:
Ian Rogers6fac4472014-02-25 17:01:10 -080029 GcType GetGcType() const OVERRIDE {
Mathieu Chartier2b82db42012-11-14 17:29:05 -080030 return kGcTypeSticky;
31 }
32
Roland Levillain3887c462015-08-12 18:15:42 +010033 StickyMarkSweep(Heap* heap, bool is_concurrent, const std::string& name_prefix = "");
Ian Rogers1d54e732013-05-02 21:10:01 -070034 ~StickyMarkSweep() {}
Mathieu Chartier2b82db42012-11-14 17:29:05 -080035
Brian Carlstrom02c8cc62013-07-18 15:54:44 -070036 protected:
Ian Rogers1d54e732013-05-02 21:10:01 -070037 // Bind the live bits to the mark bits of bitmaps for all spaces, all spaces other than the
38 // alloc space will be marked as immune.
Mathieu Chartier90443472015-07-16 20:32:27 -070039 void BindBitmaps() OVERRIDE SHARED_REQUIRES(Locks::mutator_lock_);
Ian Rogers1d54e732013-05-02 21:10:01 -070040
Ian Rogers6fac4472014-02-25 17:01:10 -080041 void MarkReachableObjects() OVERRIDE
Mathieu Chartier90443472015-07-16 20:32:27 -070042 SHARED_REQUIRES(Locks::mutator_lock_)
43 REQUIRES(Locks::heap_bitmap_lock_);
Mathieu Chartier2b82db42012-11-14 17:29:05 -080044
Ian Rogers719d1a32014-03-06 12:13:39 -080045 void Sweep(bool swap_bitmaps) OVERRIDE
Mathieu Chartier90443472015-07-16 20:32:27 -070046 SHARED_REQUIRES(Locks::mutator_lock_)
47 REQUIRES(Locks::heap_bitmap_lock_);
Mathieu Chartier2b82db42012-11-14 17:29:05 -080048
Mathieu Chartier02e25112013-08-14 16:14:24 -070049 private:
Mathieu Chartier3130cdf2015-05-03 15:20:23 -070050 DISALLOW_IMPLICIT_CONSTRUCTORS(StickyMarkSweep);
Mathieu Chartier2b82db42012-11-14 17:29:05 -080051};
52
Ian Rogers1d54e732013-05-02 21:10:01 -070053} // namespace collector
54} // namespace gc
Mathieu Chartier2b82db42012-11-14 17:29:05 -080055} // namespace art
56
Brian Carlstromfc0e3212013-07-17 14:40:12 -070057#endif // ART_RUNTIME_GC_COLLECTOR_STICKY_MARK_SWEEP_H_