< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp

Print this page

  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>(),

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

  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>(),

162     if (gclab != nullptr) {
163       gclab->retire();
164     }
165 
166     ShenandoahPLAB* shenandoah_plab = ShenandoahThreadLocalData::shenandoah_plab(thread);
167     if (shenandoah_plab != nullptr) {
168       shenandoah_plab->retire();
169     }
170 
171     // SATB protocol requires to keep alive reachable oops from roots at the beginning of GC
172     if (_heap->is_concurrent_mark_in_progress()) {
173       ShenandoahKeepAliveClosure oops;
174       StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
175     } else if (_heap->is_concurrent_weak_root_in_progress() && _heap->is_evacuation_in_progress()) {
176       ShenandoahContextEvacuateUpdateRootsClosure oops;
177       StackWatermarkSet::finish_processing(JavaThread::cast(thread), &oops, StackWatermarkKind::gc);
178     }
179   }
180 }
181 






182 void ShenandoahBarrierSet::write_ref_array(HeapWord* start, size_t count) {
183   assert(ShenandoahCardBarrier, "Should have been checked by caller");
184 
185   HeapWord* end = (HeapWord*)((char*) start + (count * heapOopSize));
186   // In the case of compressed oops, start and end may potentially be misaligned;
187   // so we need to conservatively align the first downward (this is not
188   // strictly necessary for current uses, but a case of good hygiene and,
189   // if you will, aesthetics) and the second upward (this is essential for
190   // current uses) to a HeapWord boundary, so we mark all cards overlapping
191   // this write.
192   HeapWord* aligned_start = align_down(start, HeapWordSize);
193   HeapWord* aligned_end   = align_up  (end,   HeapWordSize);
194   // If compressed oops were not being used, these should already be aligned
195   assert(UseCompressedOops || (aligned_start == start && aligned_end == end),
196          "Expected heap word alignment of start and end");
197   _heap->old_generation()->card_scan()->mark_range_as_dirty(aligned_start, (aligned_end - aligned_start));
198 }
199 
< prev index next >