1 /*
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1047
1048 // Fraction of current occupancy at which to start a CMS collection which
1049 // will collect this generation (at least).
1050 double _initiating_occupancy;
1051
1052 protected:
1053 // Shrink generation by specified size (returns false if unable to shrink)
1054 void shrink_free_list_by(size_t bytes);
1055
1056 // Update statistics for GC
1057 virtual void update_gc_stats(int level, bool full);
1058
1059 // Maximum available space in the generation (including uncommitted)
1060 // space.
1061 size_t max_available() const;
1062
1063 // getter and initializer for _initiating_occupancy field.
1064 double initiating_occupancy() const { return _initiating_occupancy; }
1065 void init_initiating_occupancy(intx io, uintx tr);
1066
1067 public:
1068 ConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size,
1069 int level, CardTableRS* ct,
1070 bool use_adaptive_freelists,
1071 FreeBlockDictionary<FreeChunk>::DictionaryChoice);
1072
1073 // Accessors
1074 CMSCollector* collector() const { return _collector; }
1075 static void set_collector(CMSCollector* collector) {
1076 assert(_collector == NULL, "already set");
1077 _collector = collector;
1078 }
1079 CompactibleFreeListSpace* cmsSpace() const { return _cmsSpace; }
1080
1081 Mutex* freelistLock() const;
1082
1083 virtual Generation::Name kind() { return Generation::ConcurrentMarkSweep; }
1084
1085 void set_did_compact(bool v) { _did_compact = v; }
1086
1173 HeapWord* expand_and_allocate(size_t word_size,
1174 bool tlab,
1175 bool parallel = false);
1176
1177 // GC prologue and epilogue
1178 void gc_prologue(bool full);
1179 void gc_prologue_work(bool full, bool registerClosure,
1180 ModUnionClosure* modUnionClosure);
1181 void gc_epilogue(bool full);
1182 void gc_epilogue_work(bool full);
1183
1184 // Time since last GC of this generation
1185 jlong time_of_last_gc(jlong now) {
1186 return collector()->time_of_last_gc(now);
1187 }
1188 void update_time_of_last_gc(jlong now) {
1189 collector()-> update_time_of_last_gc(now);
1190 }
1191
1192 // Allocation failure
1193 void expand(size_t bytes, size_t expand_bytes,
1194 CMSExpansionCause::Cause cause);
1195 virtual bool expand(size_t bytes, size_t expand_bytes);
1196 void shrink(size_t bytes);
1197 void shrink_by(size_t bytes);
1198 HeapWord* expand_and_par_lab_allocate(CMSParGCThreadState* ps, size_t word_sz);
1199 bool expand_and_ensure_spooling_space(PromotionInfo* promo);
1200
1201 // Iteration support and related enquiries
1202 void save_marks();
1203 bool no_allocs_since_save_marks();
1204 void younger_refs_iterate(OopsInGenClosure* cl);
1205
1206 // Iteration support specific to CMS generations
1207 void save_sweep_limit();
1208
1209 // More iteration support
1210 virtual void oop_iterate(ExtendedOopClosure* cl);
1211 virtual void safe_object_iterate(ObjectClosure* cl);
1212 virtual void object_iterate(ObjectClosure* cl);
1213
1214 // Need to declare the full complement of closures, whether we'll
|
1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1047
1048 // Fraction of current occupancy at which to start a CMS collection which
1049 // will collect this generation (at least).
1050 double _initiating_occupancy;
1051
1052 protected:
1053 // Shrink generation by specified size (returns false if unable to shrink)
1054 void shrink_free_list_by(size_t bytes);
1055
1056 // Update statistics for GC
1057 virtual void update_gc_stats(int level, bool full);
1058
1059 // Maximum available space in the generation (including uncommitted)
1060 // space.
1061 size_t max_available() const;
1062
1063 // getter and initializer for _initiating_occupancy field.
1064 double initiating_occupancy() const { return _initiating_occupancy; }
1065 void init_initiating_occupancy(intx io, uintx tr);
1066
1067 void expand_for_gc_cause(size_t bytes, size_t expand_bytes, CMSExpansionCause::Cause cause);
1068
1069 public:
1070 ConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size,
1071 int level, CardTableRS* ct,
1072 bool use_adaptive_freelists,
1073 FreeBlockDictionary<FreeChunk>::DictionaryChoice);
1074
1075 // Accessors
1076 CMSCollector* collector() const { return _collector; }
1077 static void set_collector(CMSCollector* collector) {
1078 assert(_collector == NULL, "already set");
1079 _collector = collector;
1080 }
1081 CompactibleFreeListSpace* cmsSpace() const { return _cmsSpace; }
1082
1083 Mutex* freelistLock() const;
1084
1085 virtual Generation::Name kind() { return Generation::ConcurrentMarkSweep; }
1086
1087 void set_did_compact(bool v) { _did_compact = v; }
1088
1175 HeapWord* expand_and_allocate(size_t word_size,
1176 bool tlab,
1177 bool parallel = false);
1178
1179 // GC prologue and epilogue
1180 void gc_prologue(bool full);
1181 void gc_prologue_work(bool full, bool registerClosure,
1182 ModUnionClosure* modUnionClosure);
1183 void gc_epilogue(bool full);
1184 void gc_epilogue_work(bool full);
1185
1186 // Time since last GC of this generation
1187 jlong time_of_last_gc(jlong now) {
1188 return collector()->time_of_last_gc(now);
1189 }
1190 void update_time_of_last_gc(jlong now) {
1191 collector()-> update_time_of_last_gc(now);
1192 }
1193
1194 // Allocation failure
1195 virtual bool expand(size_t bytes, size_t expand_bytes);
1196 void shrink(size_t bytes);
1197 void shrink_by(size_t bytes);
1198 HeapWord* expand_and_par_lab_allocate(CMSParGCThreadState* ps, size_t word_sz);
1199 bool expand_and_ensure_spooling_space(PromotionInfo* promo);
1200
1201 // Iteration support and related enquiries
1202 void save_marks();
1203 bool no_allocs_since_save_marks();
1204 void younger_refs_iterate(OopsInGenClosure* cl);
1205
1206 // Iteration support specific to CMS generations
1207 void save_sweep_limit();
1208
1209 // More iteration support
1210 virtual void oop_iterate(ExtendedOopClosure* cl);
1211 virtual void safe_object_iterate(ObjectClosure* cl);
1212 virtual void object_iterate(ObjectClosure* cl);
1213
1214 // Need to declare the full complement of closures, whether we'll
|