diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2014-01-13 12:30:44 -0800 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2014-01-14 13:34:59 -0800 |
commit | 6f4ffe41649f1e6381e8cda087ad3749206806e5 (patch) | |
tree | 9848617f37fbe418e59af21a5c204e7b2669a0cc /runtime/gc/collector/semi_space.h | |
parent | 89b7ab4cc6e5372bb4dabcc06a907fc333eca3f6 (diff) | |
download | art-6f4ffe41649f1e6381e8cda087ad3749206806e5.zip art-6f4ffe41649f1e6381e8cda087ad3749206806e5.tar.gz art-6f4ffe41649f1e6381e8cda087ad3749206806e5.tar.bz2 |
Improve the generational mode.
- Turn the compile-time flags for generational mode into a command
line flag.
- In the generational mode, always collect the whole heap, as opposed
to the bump pointer space only, if a collection is an explicit,
native allocation-triggered or last attempt one.
Change-Id: I7a14a707cc47e6e3aa4a3292db62533409f17563
Diffstat (limited to 'runtime/gc/collector/semi_space.h')
-rw-r--r-- | runtime/gc/collector/semi_space.h | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/runtime/gc/collector/semi_space.h b/runtime/gc/collector/semi_space.h index ba9f0f6..bf129a3 100644 --- a/runtime/gc/collector/semi_space.h +++ b/runtime/gc/collector/semi_space.h @@ -63,7 +63,8 @@ namespace collector { class SemiSpace : public GarbageCollector { public: - explicit SemiSpace(Heap* heap, const std::string& name_prefix = ""); + explicit SemiSpace(Heap* heap, bool generational = false, + const std::string& name_prefix = ""); ~SemiSpace() {} @@ -274,25 +275,31 @@ class SemiSpace : public GarbageCollector { Thread* self_; - // Used for kEnableSimplePromo. The end/top of the bump pointer - // space at the end of the last collection. + // When true, the generational mode (promotion and the bump pointer + // space only collection) is enabled. TODO: move these to a new file + // as a new garbage collector? + bool generational_; + + // Used for the generational mode. the end/top of the bump + // pointer space at the end of the last collection. byte* last_gc_to_space_end_; - // Used for kEnableSimplePromo. During a collection, keeps track of - // how many bytes of objects have been copied so far from the bump - // pointer space to the non-moving space. + // Used for the generational mode. During a collection, keeps track + // of how many bytes of objects have been copied so far from the + // bump pointer space to the non-moving space. uint64_t bytes_promoted_; - // When true, collect the whole heap. When false, collect only the - // bump pointer spaces. + // Used for the generational mode. When true, collect the whole + // heap. When false, collect only the bump pointer spaces. bool whole_heap_collection_; - // A counter used to enable whole_heap_collection_ once per - // interval. + // Used for the generational mode. A counter used to enable + // whole_heap_collection_ once per interval. int whole_heap_collection_interval_counter_; - // The default interval of the whole heap collection. If N, the - // whole heap collection occurs every N collections. + // Used for the generational mode. The default interval of the whole + // heap collection. If N, the whole heap collection occurs every N + // collections. static constexpr int kDefaultWholeHeapCollectionInterval = 5; private: |