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