< prev index next >

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

Print this page
rev 57589 : 8237632: Shenandoah fails some vmTestbase_nsk_jvmti tests with "Forwardee must point to a heap address"


 176           _heap->evacuate_object(cur_oop, thread);
 177         }
 178         cur = cur + cur_oop->size();
 179       }
 180     }
 181 
 182     fwd = res_oop;
 183   }
 184 
 185   if (load_addr != NULL && fwd != obj) {
 186     // Since we are here and we know the load address, update the reference.
 187     ShenandoahHeap::cas_oop(fwd, load_addr, obj);
 188   }
 189 
 190   return fwd;
 191 }
 192 
 193 oop ShenandoahBarrierSet::load_reference_barrier_impl(oop obj) {
 194   assert(ShenandoahLoadRefBarrier, "should be enabled");
 195   if (!CompressedOops::is_null(obj)) {
 196     bool evac_in_progress = _heap->is_gc_in_progress_mask(ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL);
 197     oop fwd = resolve_forwarded_not_null(obj);
 198     if (evac_in_progress &&
 199         _heap->in_collection_set(obj) &&
 200         obj == fwd) {
 201       Thread *t = Thread::current();
 202       ShenandoahEvacOOMScope oom_evac_scope;
 203       return _heap->evacuate_object(obj, t);
 204     } else {
 205       return fwd;
 206     }
 207   } else {
 208     return obj;




 209   }

 210 }
 211 
 212 void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
 213   // Create thread local data
 214   ShenandoahThreadLocalData::create(thread);
 215 }
 216 
 217 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
 218   // Destroy thread local data
 219   ShenandoahThreadLocalData::destroy(thread);
 220 }
 221 
 222 void ShenandoahBarrierSet::on_thread_attach(Thread *thread) {
 223   assert(!thread->is_Java_thread() || !SafepointSynchronize::is_at_safepoint(),
 224          "We should not be at a safepoint");
 225   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 226   assert(!queue.is_active(), "SATB queue should not be active");
 227   assert( queue.is_empty(),  "SATB queue should be empty");
 228   queue.set_active(_satb_mark_queue_set.is_active());
 229   if (thread->is_Java_thread()) {




 176           _heap->evacuate_object(cur_oop, thread);
 177         }
 178         cur = cur + cur_oop->size();
 179       }
 180     }
 181 
 182     fwd = res_oop;
 183   }
 184 
 185   if (load_addr != NULL && fwd != obj) {
 186     // Since we are here and we know the load address, update the reference.
 187     ShenandoahHeap::cas_oop(fwd, load_addr, obj);
 188   }
 189 
 190   return fwd;
 191 }
 192 
 193 oop ShenandoahBarrierSet::load_reference_barrier_impl(oop obj) {
 194   assert(ShenandoahLoadRefBarrier, "should be enabled");
 195   if (!CompressedOops::is_null(obj)) {
 196     if (_heap->in_collection_set(obj)) {
 197       oop fwd = resolve_forwarded_not_null(obj);
 198       bool evac_in_progress = _heap->is_gc_in_progress_mask(ShenandoahHeap::EVACUATION | ShenandoahHeap::TRAVERSAL);
 199       if (evac_in_progress && obj == fwd) {

 200         Thread *t = Thread::current();
 201         ShenandoahEvacOOMScope oom_evac_scope;
 202         return _heap->evacuate_object(obj, t);
 203       } else {
 204         return fwd;
 205       }
 206     } else if (_heap->is_concurrent_traversal_in_progress() &&
 207                _heap->is_degenerated_gc_in_progress()) {
 208       // Traversal GC clears collection set before entering degenerated GC.
 209       // At this point, marked pattern indicates forwarding.
 210       return resolve_forwarded_not_null(obj);
 211     }
 212   }
 213   return obj;
 214 }
 215 
 216 void ShenandoahBarrierSet::on_thread_create(Thread* thread) {
 217   // Create thread local data
 218   ShenandoahThreadLocalData::create(thread);
 219 }
 220 
 221 void ShenandoahBarrierSet::on_thread_destroy(Thread* thread) {
 222   // Destroy thread local data
 223   ShenandoahThreadLocalData::destroy(thread);
 224 }
 225 
 226 void ShenandoahBarrierSet::on_thread_attach(Thread *thread) {
 227   assert(!thread->is_Java_thread() || !SafepointSynchronize::is_at_safepoint(),
 228          "We should not be at a safepoint");
 229   SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
 230   assert(!queue.is_active(), "SATB queue should not be active");
 231   assert( queue.is_empty(),  "SATB queue should be empty");
 232   queue.set_active(_satb_mark_queue_set.is_active());
 233   if (thread->is_Java_thread()) {


< prev index next >