# HG changeset patch # User Roman Kennke # Date 1421685079 -3600 # Node ID 1ef0e3bb0a215294e064f51ea74e742a59df1377 # Parent 84bd193aad3696a92cee8877d01f70041ad050ca Don't enter write barrier if evacuation has been turned off in the meantime. Don't set cancel-evacuation flag to false at beginning of evacuation. diff -r 84bd193aad36 -r 1ef0e3bb0a21 src/share/vm/gc_implementation/shenandoah/shenandoahBarrierSet.cpp --- a/src/share/vm/gc_implementation/shenandoah/shenandoahBarrierSet.cpp Fri Jan 16 23:59:37 2015 +0100 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahBarrierSet.cpp Mon Jan 19 17:31:19 2015 +0100 @@ -277,6 +277,11 @@ oop ShenandoahBarrierSet::resolve_and_maybe_copy_oop_work2(oop src) { ShenandoahHeap *sh = (ShenandoahHeap*) Universe::heap(); + if (! sh->is_evacuation_in_progress()) { + // We may get here through a barrier that just took a safepoint that + // turned off evacuation. In this case, return right away. + return ShenandoahBarrierSet::resolve_oop_static(src); + } assert(src != NULL, "only evacuated non NULL oops"); assert(sh->heap_region_containing(src)->is_in_collection_set(), "only evacuate objects in collection set"); assert(! sh->heap_region_containing(src)->is_humonguous(), "never evacuate humonguous objects"); diff -r 84bd193aad36 -r 1ef0e3bb0a21 src/share/vm/gc_implementation/shenandoah/shenandoahHeap.cpp --- a/src/share/vm/gc_implementation/shenandoah/shenandoahHeap.cpp Fri Jan 16 23:59:37 2015 +0100 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahHeap.cpp Mon Jan 19 17:31:19 2015 +0100 @@ -1074,8 +1074,6 @@ void ShenandoahHeap::prepare_for_concurrent_evacuation() { - _cancelled_evacuation = false; - if (! ShenandoahUpdateRefsEarly) { recycle_dirty_regions(); } @@ -1166,7 +1164,7 @@ ShenandoahHeapRegion* region = _regions->claim_next(); ShenandoahHeap* heap = ShenandoahHeap::heap(); while (region != NULL) { - if (! ((region->is_in_collection_set() && ! heap->cancelled_evacuation()) || region->is_humonguous_continuation())) { + if ((! region->is_in_collection_set() || heap->cancelled_evacuation()) && ! region->is_humonguous_continuation()) { HeapWord* failed = region->object_iterate_careful(&update_refs_cl); assert(failed == NULL, "careful iteration is implemented safe for now in Shenandaoh"); } @@ -1489,6 +1487,8 @@ if (forwarded_oop != heap_oop) { // tty->print_cr("updating old ref: %p pointing to %p to new ref: %p", p, heap_oop, forwarded_oop); assert(forwarded_oop->is_oop(), "oop required"); + assert(is_in(forwarded_oop), "forwardee must be in heap"); + assert(! heap_region_containing(forwarded_oop)->is_in_collection_set(), "forwardee must not be in collection set"); // If this fails, another thread wrote to p before us, it will be logged in SATB and the // reference be updated later. oop result = (oop) Atomic::cmpxchg_ptr(forwarded_oop, p, heap_oop); @@ -2337,7 +2337,6 @@ // until all GC threads are done, and then we // return the forwardee. oop resolved = ShenandoahBarrierSet::resolve_oop_static(p); - tty->print_cr("possible emergency allocation needed: %p", (oopDesc*) resolved); return resolved; }