src/share/vm/gc_implementation/parallelScavenge/psScavenge.hpp

Mon, 09 Mar 2009 13:28:46 -0700

author
xdono
date
Mon, 09 Mar 2009 13:28:46 -0700
changeset 1014
0fbdb4381b99
parent 631
d1605aabd0a1
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6814575: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 03/09
Reviewed-by: katleman, tbell, ohair

duke@435 1 /*
xdono@631 2 * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 class GCTaskManager;
duke@435 26 class GCTaskQueue;
duke@435 27 class OopStack;
duke@435 28 class ReferenceProcessor;
duke@435 29 class ParallelScavengeHeap;
duke@435 30 class PSIsAliveClosure;
duke@435 31 class PSRefProcTaskExecutor;
duke@435 32
duke@435 33 class PSScavenge: AllStatic {
duke@435 34 friend class PSIsAliveClosure;
duke@435 35 friend class PSKeepAliveClosure;
duke@435 36 friend class PSPromotionManager;
duke@435 37
duke@435 38 enum ScavengeSkippedCause {
duke@435 39 not_skipped = 0,
duke@435 40 to_space_not_empty,
duke@435 41 promoted_too_large,
duke@435 42 full_follows_scavenge
duke@435 43 };
duke@435 44
duke@435 45 // Saved value of to_space->top(), used to prevent objects in to_space from
duke@435 46 // being rescanned.
duke@435 47 static HeapWord* _to_space_top_before_gc;
duke@435 48
duke@435 49 // Number of consecutive attempts to scavenge that were skipped
duke@435 50 static int _consecutive_skipped_scavenges;
duke@435 51
duke@435 52
duke@435 53 protected:
duke@435 54 // Flags/counters
duke@435 55 static ReferenceProcessor* _ref_processor; // Reference processor for scavenging.
duke@435 56 static PSIsAliveClosure _is_alive_closure; // Closure used for reference processing
duke@435 57 static CardTableExtension* _card_table; // We cache the card table for fast access.
duke@435 58 static bool _survivor_overflow; // Overflow this collection
duke@435 59 static int _tenuring_threshold; // tenuring threshold for next scavenge
duke@435 60 static elapsedTimer _accumulated_time; // total time spent on scavenge
duke@435 61 static HeapWord* _young_generation_boundary; // The lowest address possible for the young_gen.
duke@435 62 // This is used to decide if an oop should be scavenged,
duke@435 63 // cards should be marked, etc.
duke@435 64 static GrowableArray<markOop>* _preserved_mark_stack; // List of marks to be restored after failed promotion
duke@435 65 static GrowableArray<oop>* _preserved_oop_stack; // List of oops that need their mark restored.
duke@435 66 static CollectorCounters* _counters; // collector performance counters
duke@435 67
duke@435 68 static void clean_up_failed_promotion();
duke@435 69
duke@435 70 static bool should_attempt_scavenge();
duke@435 71
duke@435 72 static HeapWord* to_space_top_before_gc() { return _to_space_top_before_gc; }
duke@435 73 static inline void save_to_space_top_before_gc();
duke@435 74
duke@435 75 // Private accessors
duke@435 76 static CardTableExtension* const card_table() { assert(_card_table != NULL, "Sanity"); return _card_table; }
duke@435 77
duke@435 78 public:
duke@435 79 // Accessors
duke@435 80 static int tenuring_threshold() { return _tenuring_threshold; }
duke@435 81 static elapsedTimer* accumulated_time() { return &_accumulated_time; }
duke@435 82 static bool promotion_failed()
duke@435 83 { return _preserved_mark_stack != NULL; }
duke@435 84 static int consecutive_skipped_scavenges()
duke@435 85 { return _consecutive_skipped_scavenges; }
duke@435 86
duke@435 87 // Performance Counters
duke@435 88 static CollectorCounters* counters() { return _counters; }
duke@435 89
duke@435 90 // Used by scavenge_contents && psMarkSweep
duke@435 91 static ReferenceProcessor* const reference_processor() {
duke@435 92 assert(_ref_processor != NULL, "Sanity");
duke@435 93 return _ref_processor;
duke@435 94 }
duke@435 95 // Used to add tasks
duke@435 96 static GCTaskManager* const gc_task_manager();
duke@435 97 // The promotion managers tell us if they encountered overflow
duke@435 98 static void set_survivor_overflow(bool state) {
duke@435 99 _survivor_overflow = state;
duke@435 100 }
duke@435 101 // Adaptive size policy support. When the young generation/old generation
duke@435 102 // boundary moves, _young_generation_boundary must be reset
duke@435 103 static void set_young_generation_boundary(HeapWord* v) {
duke@435 104 _young_generation_boundary = v;
duke@435 105 }
duke@435 106
duke@435 107 // Called by parallelScavengeHeap to init the tenuring threshold
duke@435 108 static void initialize();
duke@435 109
duke@435 110 // Scavenge entry point
duke@435 111 static void invoke();
duke@435 112 // Return true is a collection was done. Return
duke@435 113 // false if the collection was skipped.
duke@435 114 static bool invoke_no_policy();
duke@435 115
duke@435 116 // If an attempt to promote fails, this method is invoked
duke@435 117 static void oop_promotion_failed(oop obj, markOop obj_mark);
duke@435 118
coleenp@548 119 template <class T> static inline bool should_scavenge(T* p);
duke@435 120
duke@435 121 // These call should_scavenge() above and, if it returns true, also check that
duke@435 122 // the object was not newly copied into to_space. The version with the bool
duke@435 123 // argument is a convenience wrapper that fetches the to_space pointer from
duke@435 124 // the heap and calls the other version (if the arg is true).
coleenp@548 125 template <class T> static inline bool should_scavenge(T* p, MutableSpace* to_space);
coleenp@548 126 template <class T> static inline bool should_scavenge(T* p, bool check_to_space);
duke@435 127
coleenp@548 128 template <class T> inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p);
duke@435 129
duke@435 130 // Is an object in the young generation
duke@435 131 // This assumes that the HeapWord argument is in the heap,
duke@435 132 // so it only checks one side of the complete predicate.
duke@435 133 inline static bool is_obj_in_young(HeapWord* o) {
duke@435 134 const bool result = (o >= _young_generation_boundary);
duke@435 135 return result;
duke@435 136 }
duke@435 137 };

mercurial