< prev index next >

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

Print this page
*** 30,10 ***
--- 30,11 ---
  #include "gc/shared/gcTimer.hpp"
  #include "gc/shared/gcTraceTime.inline.hpp"
  #include "gc/shared/locationPrinter.inline.hpp"
  #include "gc/shared/memAllocator.hpp"
  #include "gc/shared/plab.hpp"
+ #include "gc/shared/slidingForwarding.hpp"
  #include "gc/shared/tlab_globals.hpp"
  
  #include "gc/shenandoah/shenandoahBarrierSet.hpp"
  #include "gc/shenandoah/shenandoahClosures.inline.hpp"
  #include "gc/shenandoah/shenandoahCollectionSet.hpp"

*** 190,10 ***
--- 191,12 ---
    _heap_region_special = heap_rs.special();
  
    assert((((size_t) base()) & ShenandoahHeapRegion::region_size_bytes_mask()) == 0,
           "Misaligned heap: " PTR_FORMAT, p2i(base()));
  
+   _forwarding = new SlidingForwarding(_heap_region, ShenandoahHeapRegion::region_size_words_shift());
+ 
  #if SHENANDOAH_OPTIMIZED_MARKTASK
    // The optimized ShenandoahMarkTask takes some bits away from the full object bits.
    // Fail if we ever attempt to address more than we can.
    if ((uintptr_t)heap_rs.end() >= ShenandoahMarkTask::max_addressable()) {
      FormatBuffer<512> buf("Shenandoah reserved [" PTR_FORMAT ", " PTR_FORMAT") for the heap, \n"

*** 946,11 ***
    ShenandoahConcurrentEvacuateRegionObjectClosure(ShenandoahHeap* heap) :
      _heap(heap), _thread(Thread::current()) {}
  
    void do_object(oop p) {
      shenandoah_assert_marked(NULL, p);
!     if (!p->is_forwarded()) {
        _heap->evacuate_object(p, _thread);
      }
    }
  };
  
--- 949,11 ---
    ShenandoahConcurrentEvacuateRegionObjectClosure(ShenandoahHeap* heap) :
      _heap(heap), _thread(Thread::current()) {}
  
    void do_object(oop p) {
      shenandoah_assert_marked(NULL, p);
!     if (!ShenandoahForwarding::is_forwarded(p)) {
        _heap->evacuate_object(p, _thread);
      }
    }
  };
  

*** 1234,11 ***
        oop obj = CompressedOops::decode_not_null(o);
        if (_heap->is_concurrent_weak_root_in_progress() && !_marking_context->is_marked(obj)) {
          // There may be dead oops in weak roots in concurrent root phase, do not touch them.
          return;
        }
!       obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
  
        assert(oopDesc::is_oop(obj), "must be a valid oop");
        if (!_bitmap->is_marked(obj)) {
          _bitmap->mark(obj);
          _oop_stack->push(obj);
--- 1237,14 ---
        oop obj = CompressedOops::decode_not_null(o);
        if (_heap->is_concurrent_weak_root_in_progress() && !_marking_context->is_marked(obj)) {
          // There may be dead oops in weak roots in concurrent root phase, do not touch them.
          return;
        }
! 
+       // We must not expose from-space oops to the rest of runtime, or else it
+       // will call klass() on it, which might fail because of unexpected header.
+       obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(obj);
  
        assert(oopDesc::is_oop(obj), "must be a valid oop");
        if (!_bitmap->is_marked(obj)) {
          _bitmap->mark(obj);
          _oop_stack->push(obj);

*** 1290,10 ***
--- 1296,11 ---
  
    // Work through the oop stack to traverse heap
    while (! oop_stack.is_empty()) {
      oop obj = oop_stack.pop();
      assert(oopDesc::is_oop(obj), "must be a valid oop");
+     shenandoah_assert_not_in_cset_except(NULL, obj, cancelled_gc());
      cl->do_object(obj);
      obj->oop_iterate(&oops);
    }
  
    assert(oop_stack.is_empty(), "should be empty");
< prev index next >