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>(),
167 }
168
169 ShenandoahPLAB* shenandoah_plab = ShenandoahThreadLocalData::shenandoah_plab(thread);
170 if (shenandoah_plab != nullptr) {
171 shenandoah_plab->retire();
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::clone_barrier_runtime(oop src) {
188 if (_heap->has_forwarded_objects()) {
189 clone_barrier(src);
190 }
191 }
192
193 void ShenandoahBarrierSet::write_ref_array(HeapWord* start, size_t count) {
194 assert(ShenandoahCardBarrier, "Should have been checked by caller");
195
196 HeapWord* end = (HeapWord*)((char*) start + (count * heapOopSize));
197 // In the case of compressed oops, start and end may potentially be misaligned;
198 // so we need to conservatively align the first downward (this is not
199 // strictly necessary for current uses, but a case of good hygiene and,
200 // if you will, aesthetics) and the second upward (this is essential for
201 // current uses) to a HeapWord boundary, so we mark all cards overlapping
202 // this write.
203 HeapWord* aligned_start = align_down(start, HeapWordSize);
204 HeapWord* aligned_end = align_up (end, HeapWordSize);
205 // If compressed oops were not being used, these should already be aligned
206 assert(UseCompressedOops || (aligned_start == start && aligned_end == end),
207 "Expected heap word alignment of start and end");
208 _heap->old_generation()->card_scan()->mark_range_as_dirty(aligned_start, (aligned_end - aligned_start));
209 }
210
|
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>(),
166 }
167
168 ShenandoahPLAB* shenandoah_plab = ShenandoahThreadLocalData::shenandoah_plab(thread);
169 if (shenandoah_plab != nullptr) {
170 shenandoah_plab->retire();
171 }
172
173 // SATB protocol requires to keep alive reachable oops from roots at the beginning of GC
174 if (ShenandoahStackWatermarkBarrier) {
175 if (_heap->is_concurrent_mark_in_progress()) {
176 ShenandoahKeepAliveClosure oops;
177 StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
178 } else if (_heap->is_concurrent_weak_root_in_progress() && _heap->is_evacuation_in_progress()) {
179 ShenandoahContextEvacuateUpdateRootsClosure oops;
180 StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
181 }
182 }
183 }
184 }
185
186 void ShenandoahBarrierSet::write_ref_array(HeapWord* start, size_t count) {
187 assert(ShenandoahCardBarrier, "Should have been checked by caller");
188
189 HeapWord* end = (HeapWord*)((char*) start + (count * heapOopSize));
190 // In the case of compressed oops, start and end may potentially be misaligned;
191 // so we need to conservatively align the first downward (this is not
192 // strictly necessary for current uses, but a case of good hygiene and,
193 // if you will, aesthetics) and the second upward (this is essential for
194 // current uses) to a HeapWord boundary, so we mark all cards overlapping
195 // this write.
196 HeapWord* aligned_start = align_down(start, HeapWordSize);
197 HeapWord* aligned_end = align_up (end, HeapWordSize);
198 // If compressed oops were not being used, these should already be aligned
199 assert(UseCompressedOops || (aligned_start == start && aligned_end == end),
200 "Expected heap word alignment of start and end");
201 _heap->old_generation()->card_scan()->mark_range_as_dirty(aligned_start, (aligned_end - aligned_start));
202 }
203
|