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 *
23 */
24
25 #ifndef SHARE_VM_MEMORY_DEFNEWGENERATION_HPP
26 #define SHARE_VM_MEMORY_DEFNEWGENERATION_HPP
27
28 #include "gc_implementation/shared/ageTable.hpp"
29 #include "gc_implementation/shared/cSpaceCounters.hpp"
30 #include "gc_implementation/shared/generationCounters.hpp"
31 #include "gc_implementation/shared/copyFailedInfo.hpp"
32 #include "memory/generation.inline.hpp"
33 #include "utilities/stack.hpp"
34
35 class EdenSpace;
36 class ContiguousSpace;
37 class ScanClosure;
38 class STWGCTimer;
39
40 // DefNewGeneration is a young generation containing eden, from- and
41 // to-space.
42
43 class DefNewGeneration: public Generation {
44 friend class VMStructs;
45
46 protected:
47 Generation* _next_gen;
48 uint _tenuring_threshold; // Tenuring threshold for next collection.
49 ageTable _age_table;
50 // Size of object to pretenure in words; command line provides bytes
51 size_t _pretenure_size_threshold_words;
52
53 ageTable* age_table() { return &_age_table; }
54
55 // Initialize state to optimistically assume no promotion failure will
56 // happen.
57 void init_assuming_no_promotion_failure();
58 // True iff a promotion has failed in the current collection.
283 HeapWord* par_allocate(size_t word_size, bool is_tlab);
284
285 // Prologue & Epilogue
286 virtual void gc_prologue(bool full);
287 virtual void gc_epilogue(bool full);
288
289 // Save the tops for eden, from, and to
290 virtual void record_spaces_top();
291
292 // Doesn't require additional work during GC prologue and epilogue
293 virtual bool performs_in_place_marking() const { return false; }
294
295 // Accessing marks
296 void save_marks();
297 void reset_saved_marks();
298 bool no_allocs_since_save_marks();
299
300 // Need to declare the full complement of closures, whether we'll
301 // override them or not, or get message from the compiler:
302 // oop_since_save_marks_iterate_nv hides virtual function...
303 #define DefNew_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \
304 void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
305
306 ALL_SINCE_SAVE_MARKS_CLOSURES(DefNew_SINCE_SAVE_MARKS_DECL)
307
308 #undef DefNew_SINCE_SAVE_MARKS_DECL
309
310 // For non-youngest collection, the DefNewGeneration can contribute
311 // "to-space".
312 virtual void contribute_scratch(ScratchBlock*& list, Generation* requestor,
313 size_t max_alloc_words);
314
315 // Reset for contribution of "to-space".
316 virtual void reset_scratch();
317
318 // GC support
319 virtual void compute_new_size();
320
321 // Returns true if the collection is likely to be safely
322 // completed. Even if this method returns true, a collection
323 // may not be guaranteed to succeed, and the system should be
324 // able to safely unwind and recover from that failure, albeit
325 // at some additional cost. Override superclass's implementation.
326 virtual bool collection_attempt_is_safe();
327
328 virtual void collect(bool full,
|
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 *
23 */
24
25 #ifndef SHARE_VM_MEMORY_DEFNEWGENERATION_HPP
26 #define SHARE_VM_MEMORY_DEFNEWGENERATION_HPP
27
28 #include "gc_implementation/shared/ageTable.hpp"
29 #include "gc_implementation/shared/cSpaceCounters.hpp"
30 #include "gc_implementation/shared/generationCounters.hpp"
31 #include "gc_implementation/shared/copyFailedInfo.hpp"
32 #include "memory/generation.inline.hpp"
33 #include "utilities/stack.hpp"
34
35 class EdenSpace;
36 class ContiguousSpace;
37 class ScanClosure;
38 class STWGCTimer;
39 class CSpaceCounters;
40
41 // DefNewGeneration is a young generation containing eden, from- and
42 // to-space.
43
44 class DefNewGeneration: public Generation {
45 friend class VMStructs;
46
47 protected:
48 Generation* _next_gen;
49 uint _tenuring_threshold; // Tenuring threshold for next collection.
50 ageTable _age_table;
51 // Size of object to pretenure in words; command line provides bytes
52 size_t _pretenure_size_threshold_words;
53
54 ageTable* age_table() { return &_age_table; }
55
56 // Initialize state to optimistically assume no promotion failure will
57 // happen.
58 void init_assuming_no_promotion_failure();
59 // True iff a promotion has failed in the current collection.
284 HeapWord* par_allocate(size_t word_size, bool is_tlab);
285
286 // Prologue & Epilogue
287 virtual void gc_prologue(bool full);
288 virtual void gc_epilogue(bool full);
289
290 // Save the tops for eden, from, and to
291 virtual void record_spaces_top();
292
293 // Doesn't require additional work during GC prologue and epilogue
294 virtual bool performs_in_place_marking() const { return false; }
295
296 // Accessing marks
297 void save_marks();
298 void reset_saved_marks();
299 bool no_allocs_since_save_marks();
300
301 // Need to declare the full complement of closures, whether we'll
302 // override them or not, or get message from the compiler:
303 // oop_since_save_marks_iterate_nv hides virtual function...
304 template <bool nv, typename OopClosureType>
305 void oop_since_save_marks_iterate(OopClosureType* cl);
306
307 // For non-youngest collection, the DefNewGeneration can contribute
308 // "to-space".
309 virtual void contribute_scratch(ScratchBlock*& list, Generation* requestor,
310 size_t max_alloc_words);
311
312 // Reset for contribution of "to-space".
313 virtual void reset_scratch();
314
315 // GC support
316 virtual void compute_new_size();
317
318 // Returns true if the collection is likely to be safely
319 // completed. Even if this method returns true, a collection
320 // may not be guaranteed to succeed, and the system should be
321 // able to safely unwind and recover from that failure, albeit
322 // at some additional cost. Override superclass's implementation.
323 virtual bool collection_attempt_is_safe();
324
325 virtual void collect(bool full,
|