8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "gc/shared/barrierSetNMethod.hpp"
27 #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
28 #include "gc/shenandoah/shenandoahBarrierSetClone.inline.hpp"
29 #include "gc/shenandoah/shenandoahBarrierSetNMethod.hpp"
30 #include "gc/shenandoah/shenandoahBarrierSetStackChunk.hpp"
31 #include "gc/shenandoah/shenandoahCardTable.hpp"
32 #include "gc/shenandoah/shenandoahClosures.inline.hpp"
33 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
34 #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp"
35 #include "gc/shenandoah/shenandoahStackWatermark.hpp"
36 #ifdef COMPILER1
37 #include "gc/shenandoah/c1/shenandoahBarrierSetC1.hpp"
38 #endif
39 #ifdef COMPILER2
40 #include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp"
41 #endif
42
43 class ShenandoahBarrierSetC1;
44 class ShenandoahBarrierSetC2;
45
46 ShenandoahBarrierSet::ShenandoahBarrierSet(ShenandoahHeap* heap, MemRegion heap_region) :
47 BarrierSet(make_barrier_set_assembler<ShenandoahBarrierSetAssembler>(),
48 make_barrier_set_c1<ShenandoahBarrierSetC1>(),
168
169 PLAB* plab = ShenandoahThreadLocalData::plab(thread);
170 if (plab != nullptr) {
171 // This will assert if plab is not null in non-generational mode
172 ShenandoahGenerationalHeap::heap()->retire_plab(plab);
173 }
174
175 // SATB protocol requires to keep alive reachable oops from roots at the beginning of GC
176 if (ShenandoahStackWatermarkBarrier) {
177 if (_heap->is_concurrent_mark_in_progress()) {
178 ShenandoahKeepAliveClosure oops;
179 StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
180 } else if (_heap->is_concurrent_weak_root_in_progress() && _heap->is_evacuation_in_progress()) {
181 ShenandoahContextEvacuateUpdateRootsClosure oops;
182 StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
183 }
184 }
185 }
186 }
187
188 void ShenandoahBarrierSet::clone_barrier_runtime(oop src) {
189 if (_heap->has_forwarded_objects()) {
190 clone_barrier(src);
191 }
192 }
193
194 void ShenandoahBarrierSet::write_ref_array(HeapWord* start, size_t count) {
195 assert(ShenandoahCardBarrier, "Should have been checked by caller");
196
197 HeapWord* end = (HeapWord*)((char*) start + (count * heapOopSize));
198 // In the case of compressed oops, start and end may potentially be misaligned;
199 // so we need to conservatively align the first downward (this is not
200 // strictly necessary for current uses, but a case of good hygiene and,
201 // if you will, aesthetics) and the second upward (this is essential for
202 // current uses) to a HeapWord boundary, so we mark all cards overlapping
203 // this write.
204 HeapWord* aligned_start = align_down(start, HeapWordSize);
205 HeapWord* aligned_end = align_up (end, HeapWordSize);
206 // If compressed oops were not being used, these should already be aligned
207 assert(UseCompressedOops || (aligned_start == start && aligned_end == end),
208 "Expected heap word alignment of start and end");
209 _heap->old_generation()->card_scan()->mark_range_as_dirty(aligned_start, (aligned_end - aligned_start));
210 }
211
|
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "gc/shared/barrierSetNMethod.hpp"
27 #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp"
28 #include "gc/shenandoah/shenandoahBarrierSetNMethod.hpp"
29 #include "gc/shenandoah/shenandoahBarrierSetStackChunk.hpp"
30 #include "gc/shenandoah/shenandoahCardTable.hpp"
31 #include "gc/shenandoah/shenandoahClosures.inline.hpp"
32 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
33 #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp"
34 #include "gc/shenandoah/shenandoahStackWatermark.hpp"
35 #ifdef COMPILER1
36 #include "gc/shenandoah/c1/shenandoahBarrierSetC1.hpp"
37 #endif
38 #ifdef COMPILER2
39 #include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp"
40 #endif
41
42 class ShenandoahBarrierSetC1;
43 class ShenandoahBarrierSetC2;
44
45 ShenandoahBarrierSet::ShenandoahBarrierSet(ShenandoahHeap* heap, MemRegion heap_region) :
46 BarrierSet(make_barrier_set_assembler<ShenandoahBarrierSetAssembler>(),
47 make_barrier_set_c1<ShenandoahBarrierSetC1>(),
167
168 PLAB* plab = ShenandoahThreadLocalData::plab(thread);
169 if (plab != nullptr) {
170 // This will assert if plab is not null in non-generational mode
171 ShenandoahGenerationalHeap::heap()->retire_plab(plab);
172 }
173
174 // SATB protocol requires to keep alive reachable oops from roots at the beginning of GC
175 if (ShenandoahStackWatermarkBarrier) {
176 if (_heap->is_concurrent_mark_in_progress()) {
177 ShenandoahKeepAliveClosure oops;
178 StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
179 } else if (_heap->is_concurrent_weak_root_in_progress() && _heap->is_evacuation_in_progress()) {
180 ShenandoahContextEvacuateUpdateRootsClosure oops;
181 StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
182 }
183 }
184 }
185 }
186
187 void ShenandoahBarrierSet::write_ref_array(HeapWord* start, size_t count) {
188 assert(ShenandoahCardBarrier, "Should have been checked by caller");
189
190 HeapWord* end = (HeapWord*)((char*) start + (count * heapOopSize));
191 // In the case of compressed oops, start and end may potentially be misaligned;
192 // so we need to conservatively align the first downward (this is not
193 // strictly necessary for current uses, but a case of good hygiene and,
194 // if you will, aesthetics) and the second upward (this is essential for
195 // current uses) to a HeapWord boundary, so we mark all cards overlapping
196 // this write.
197 HeapWord* aligned_start = align_down(start, HeapWordSize);
198 HeapWord* aligned_end = align_up (end, HeapWordSize);
199 // If compressed oops were not being used, these should already be aligned
200 assert(UseCompressedOops || (aligned_start == start && aligned_end == end),
201 "Expected heap word alignment of start and end");
202 _heap->old_generation()->card_scan()->mark_range_as_dirty(aligned_start, (aligned_end - aligned_start));
203 }
204
|