< prev index next >

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

Print this page




 151     oop res_oop = _heap->evacuate_object(obj, thread);
 152 
 153     // Since we are already here and paid the price of getting through runtime call adapters
 154     // and acquiring oom-scope, it makes sense to try and evacuate more adjacent objects,
 155     // thus amortizing the overhead. For sparsely live heaps, scan costs easily dominate
 156     // total assist costs, and can introduce a lot of evacuation latency. This is why we
 157     // only scan for _nearest_ N objects, regardless if they are eligible for evac or not.
 158     // The scan itself should also avoid touching the non-marked objects below TAMS, because
 159     // their metadata (notably, klasses) may be incorrect already.
 160 
 161     size_t max = ShenandoahEvacAssist;
 162     if (max > 0) {
 163       // Traversal is special: it uses incomplete marking context, because it coalesces evac with mark.
 164       // Other code uses complete marking context, because evac happens after the mark.
 165       ShenandoahMarkingContext* ctx = _heap->is_concurrent_traversal_in_progress() ?
 166                                       _heap->marking_context() : _heap->complete_marking_context();
 167 
 168       ShenandoahHeapRegion* r = _heap->heap_region_containing(obj);
 169       assert(r->is_cset(), "sanity");
 170 
 171       HeapWord* cur = (HeapWord*)obj + obj->size();
 172 
 173       size_t count = 0;
 174       while ((cur < r->top()) && ctx->is_marked(oop(cur)) && (count++ < max)) {
 175         oop cur_oop = oop(cur);
 176         if (cur_oop == resolve_forwarded_not_null(cur_oop)) {
 177           _heap->evacuate_object(cur_oop, thread);
 178         }
 179         cur = cur + cur_oop->size();
 180       }
 181     }
 182 
 183     fwd = res_oop;
 184   }
 185 
 186   if (load_addr != NULL && fwd != obj) {
 187     // Since we are here and we know the load address, update the reference.
 188     ShenandoahHeap::cas_oop(fwd, load_addr, obj);
 189   }
 190 
 191   return fwd;




 151     oop res_oop = _heap->evacuate_object(obj, thread);
 152 
 153     // Since we are already here and paid the price of getting through runtime call adapters
 154     // and acquiring oom-scope, it makes sense to try and evacuate more adjacent objects,
 155     // thus amortizing the overhead. For sparsely live heaps, scan costs easily dominate
 156     // total assist costs, and can introduce a lot of evacuation latency. This is why we
 157     // only scan for _nearest_ N objects, regardless if they are eligible for evac or not.
 158     // The scan itself should also avoid touching the non-marked objects below TAMS, because
 159     // their metadata (notably, klasses) may be incorrect already.
 160 
 161     size_t max = ShenandoahEvacAssist;
 162     if (max > 0) {
 163       // Traversal is special: it uses incomplete marking context, because it coalesces evac with mark.
 164       // Other code uses complete marking context, because evac happens after the mark.
 165       ShenandoahMarkingContext* ctx = _heap->is_concurrent_traversal_in_progress() ?
 166                                       _heap->marking_context() : _heap->complete_marking_context();
 167 
 168       ShenandoahHeapRegion* r = _heap->heap_region_containing(obj);
 169       assert(r->is_cset(), "sanity");
 170 
 171       HeapWord* cur = cast_from_oop<HeapWord*>(obj) + obj->size();
 172 
 173       size_t count = 0;
 174       while ((cur < r->top()) && ctx->is_marked(oop(cur)) && (count++ < max)) {
 175         oop cur_oop = oop(cur);
 176         if (cur_oop == resolve_forwarded_not_null(cur_oop)) {
 177           _heap->evacuate_object(cur_oop, thread);
 178         }
 179         cur = cur + cur_oop->size();
 180       }
 181     }
 182 
 183     fwd = res_oop;
 184   }
 185 
 186   if (load_addr != NULL && fwd != obj) {
 187     // Since we are here and we know the load address, update the reference.
 188     ShenandoahHeap::cas_oop(fwd, load_addr, obj);
 189   }
 190 
 191   return fwd;


< prev index next >