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 *
23 */
24
25 #ifndef SHARE_VM_GC_PARALLEL_PSSCAVENGE_HPP
26 #define SHARE_VM_GC_PARALLEL_PSSCAVENGE_HPP
27
28 #include "gc/parallel/cardTableExtension.hpp"
29 #include "gc/parallel/psVirtualspace.hpp"
30 #include "gc/shared/collectorCounters.hpp"
31 #include "gc/shared/gcTrace.hpp"
32 #include "memory/allocation.hpp"
33 #include "oops/oop.hpp"
34 #include "utilities/stack.hpp"
35
36 class GCTaskManager;
37 class GCTaskQueue;
38 class OopStack;
39 class ReferenceProcessor;
40 class ParallelScavengeHeap;
41 class ParallelScavengeTracer;
42 class PSIsAliveClosure;
43 class PSRefProcTaskExecutor;
44 class STWGCTimer;
45
46 class PSScavenge: AllStatic {
47 friend class PSIsAliveClosure;
48 friend class PSKeepAliveClosure;
50
51 enum ScavengeSkippedCause {
52 not_skipped = 0,
53 to_space_not_empty,
54 promoted_too_large,
55 full_follows_scavenge
56 };
57
58 // Saved value of to_space->top(), used to prevent objects in to_space from
59 // being rescanned.
60 static HeapWord* _to_space_top_before_gc;
61
62 // Number of consecutive attempts to scavenge that were skipped
63 static int _consecutive_skipped_scavenges;
64
65
66 protected:
67 // Flags/counters
68 static ReferenceProcessor* _ref_processor; // Reference processor for scavenging.
69 static PSIsAliveClosure _is_alive_closure; // Closure used for reference processing
70 static CardTableExtension* _card_table; // We cache the card table for fast access.
71 static bool _survivor_overflow; // Overflow this collection
72 static uint _tenuring_threshold; // tenuring threshold for next scavenge
73 static elapsedTimer _accumulated_time; // total time spent on scavenge
74 static STWGCTimer _gc_timer; // GC time book keeper
75 static ParallelScavengeTracer _gc_tracer; // GC tracing
76 // The lowest address possible for the young_gen.
77 // This is used to decide if an oop should be scavenged,
78 // cards should be marked, etc.
79 static HeapWord* _young_generation_boundary;
80 // Used to optimize compressed oops young gen boundary checking.
81 static uintptr_t _young_generation_boundary_compressed;
82 static CollectorCounters* _counters; // collector performance counters
83
84 static void clean_up_failed_promotion();
85
86 static bool should_attempt_scavenge();
87
88 static HeapWord* to_space_top_before_gc() { return _to_space_top_before_gc; }
89 static inline void save_to_space_top_before_gc();
90
91 // Private accessors
92 static CardTableExtension* const card_table() { assert(_card_table != NULL, "Sanity"); return _card_table; }
93 static const ParallelScavengeTracer* gc_tracer() { return &_gc_tracer; }
94
95 public:
96 // Accessors
97 static uint tenuring_threshold() { return _tenuring_threshold; }
98 static elapsedTimer* accumulated_time() { return &_accumulated_time; }
99 static int consecutive_skipped_scavenges()
100 { return _consecutive_skipped_scavenges; }
101
102 // Performance Counters
103 static CollectorCounters* counters() { return _counters; }
104
105 // Used by scavenge_contents && psMarkSweep
106 static ReferenceProcessor* const reference_processor() {
107 assert(_ref_processor != NULL, "Sanity");
108 return _ref_processor;
109 }
110 // Used to add tasks
111 static GCTaskManager* const gc_task_manager();
112 // The promotion managers tell us if they encountered overflow
|
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 *
23 */
24
25 #ifndef SHARE_VM_GC_PARALLEL_PSSCAVENGE_HPP
26 #define SHARE_VM_GC_PARALLEL_PSSCAVENGE_HPP
27
28 #include "gc/parallel/psCardTable.hpp"
29 #include "gc/parallel/psVirtualspace.hpp"
30 #include "gc/shared/collectorCounters.hpp"
31 #include "gc/shared/gcTrace.hpp"
32 #include "memory/allocation.hpp"
33 #include "oops/oop.hpp"
34 #include "utilities/stack.hpp"
35
36 class GCTaskManager;
37 class GCTaskQueue;
38 class OopStack;
39 class ReferenceProcessor;
40 class ParallelScavengeHeap;
41 class ParallelScavengeTracer;
42 class PSIsAliveClosure;
43 class PSRefProcTaskExecutor;
44 class STWGCTimer;
45
46 class PSScavenge: AllStatic {
47 friend class PSIsAliveClosure;
48 friend class PSKeepAliveClosure;
50
51 enum ScavengeSkippedCause {
52 not_skipped = 0,
53 to_space_not_empty,
54 promoted_too_large,
55 full_follows_scavenge
56 };
57
58 // Saved value of to_space->top(), used to prevent objects in to_space from
59 // being rescanned.
60 static HeapWord* _to_space_top_before_gc;
61
62 // Number of consecutive attempts to scavenge that were skipped
63 static int _consecutive_skipped_scavenges;
64
65
66 protected:
67 // Flags/counters
68 static ReferenceProcessor* _ref_processor; // Reference processor for scavenging.
69 static PSIsAliveClosure _is_alive_closure; // Closure used for reference processing
70 static PSCardTable* _card_table; // We cache the card table for fast access.
71 static bool _survivor_overflow; // Overflow this collection
72 static uint _tenuring_threshold; // tenuring threshold for next scavenge
73 static elapsedTimer _accumulated_time; // total time spent on scavenge
74 static STWGCTimer _gc_timer; // GC time book keeper
75 static ParallelScavengeTracer _gc_tracer; // GC tracing
76 // The lowest address possible for the young_gen.
77 // This is used to decide if an oop should be scavenged,
78 // cards should be marked, etc.
79 static HeapWord* _young_generation_boundary;
80 // Used to optimize compressed oops young gen boundary checking.
81 static uintptr_t _young_generation_boundary_compressed;
82 static CollectorCounters* _counters; // collector performance counters
83
84 static void clean_up_failed_promotion();
85
86 static bool should_attempt_scavenge();
87
88 static HeapWord* to_space_top_before_gc() { return _to_space_top_before_gc; }
89 static inline void save_to_space_top_before_gc();
90
91 // Private accessors
92 static PSCardTable* const card_table() { assert(_card_table != NULL, "Sanity"); return _card_table; }
93 static const ParallelScavengeTracer* gc_tracer() { return &_gc_tracer; }
94
95 public:
96 // Accessors
97 static uint tenuring_threshold() { return _tenuring_threshold; }
98 static elapsedTimer* accumulated_time() { return &_accumulated_time; }
99 static int consecutive_skipped_scavenges()
100 { return _consecutive_skipped_scavenges; }
101
102 // Performance Counters
103 static CollectorCounters* counters() { return _counters; }
104
105 // Used by scavenge_contents && psMarkSweep
106 static ReferenceProcessor* const reference_processor() {
107 assert(_ref_processor != NULL, "Sanity");
108 return _ref_processor;
109 }
110 // Used to add tasks
111 static GCTaskManager* const gc_task_manager();
112 // The promotion managers tell us if they encountered overflow
|