< prev index next >

src/hotspot/share/gc/shared/space.cpp

Print this page
*** 27,10 ***
--- 27,11 ---
  #include "classfile/vmSymbols.hpp"
  #include "gc/shared/blockOffsetTable.inline.hpp"
  #include "gc/shared/collectedHeap.inline.hpp"
  #include "gc/shared/genCollectedHeap.hpp"
  #include "gc/shared/genOopClosures.inline.hpp"
+ #include "gc/shared/slidingForwarding.inline.hpp"
  #include "gc/shared/space.hpp"
  #include "gc/shared/space.inline.hpp"
  #include "gc/shared/spaceDecorator.inline.hpp"
  #include "memory/iterator.inline.hpp"
  #include "memory/universe.hpp"

*** 345,11 ***
    Space::clear(mangle_space);
    _compaction_top = bottom();
  }
  
  HeapWord* CompactibleSpace::forward(oop q, size_t size,
!                                     CompactPoint* cp, HeapWord* compact_top) {
    // q is alive
    // First check if we should switch compaction space
    assert(this == cp->space, "'this' should be current compaction space.");
    size_t compaction_max_size = pointer_delta(end(), compact_top);
    while (size > compaction_max_size) {
--- 346,11 ---
    Space::clear(mangle_space);
    _compaction_top = bottom();
  }
  
  HeapWord* CompactibleSpace::forward(oop q, size_t size,
!                                     CompactPoint* cp, HeapWord* compact_top, SlidingForwarding* const forwarding) {
    // q is alive
    // First check if we should switch compaction space
    assert(this == cp->space, "'this' should be current compaction space.");
    size_t compaction_max_size = pointer_delta(end(), compact_top);
    while (size > compaction_max_size) {

*** 368,17 ***
      compaction_max_size = pointer_delta(cp->space->end(), compact_top);
    }
  
    // store the forwarding pointer into the mark word
    if (cast_from_oop<HeapWord*>(q) != compact_top) {
!     q->forward_to(cast_to_oop(compact_top));
      assert(q->is_gc_marked(), "encoding the pointer should preserve the mark");
    } else {
      // if the object isn't moving we can just set the mark to the default
      // mark and handle it specially later on.
      q->init_mark();
!     assert(q->forwardee() == NULL, "should be forwarded to NULL");
    }
  
    compact_top += size;
  
    // we need to update the offset table so that the beginnings of objects can be
--- 369,17 ---
      compaction_max_size = pointer_delta(cp->space->end(), compact_top);
    }
  
    // store the forwarding pointer into the mark word
    if (cast_from_oop<HeapWord*>(q) != compact_top) {
!     forwarding->forward_to(q, cast_to_oop(compact_top));
      assert(q->is_gc_marked(), "encoding the pointer should preserve the mark");
    } else {
      // if the object isn't moving we can just set the mark to the default
      // mark and handle it specially later on.
      q->init_mark();
!     assert(!q->is_forwarded(), "should not be forwarded");
    }
  
    compact_top += size;
  
    // we need to update the offset table so that the beginnings of objects can be

*** 584,26 ***
    if (factor > 0) {
      size -= size/factor;
    }
    size = align_object_size(size);
  
!   const size_t array_header_size = typeArrayOopDesc::header_size(T_INT);
    if (size >= align_object_size(array_header_size)) {
      size_t length = (size - array_header_size) * (HeapWordSize / sizeof(jint));
      // allocate uninitialized int array
      typeArrayOop t = (typeArrayOop) cast_to_oop(allocate(size));
      assert(t != NULL, "allocation should succeed");
      t->set_mark(markWord::prototype());
      t->set_klass(Universe::intArrayKlassObj());
      t->set_length((int)length);
    } else {
      assert(size == CollectedHeap::min_fill_size(),
             "size for smallest fake object doesn't match");
      instanceOop obj = (instanceOop) cast_to_oop(allocate(size));
      obj->set_mark(markWord::prototype());
-     obj->set_klass_gap(0);
      obj->set_klass(vmClasses::Object_klass());
    }
  }
  
  HeapWord* OffsetTableContigSpace::initialize_threshold() {
    return _offsets.initialize_threshold();
--- 585,33 ---
    if (factor > 0) {
      size -= size/factor;
    }
    size = align_object_size(size);
  
!   const size_t array_header_size = (arrayOopDesc::base_offset_in_bytes(T_INT) + BytesPerWord) / BytesPerWord;
    if (size >= align_object_size(array_header_size)) {
      size_t length = (size - array_header_size) * (HeapWordSize / sizeof(jint));
      // allocate uninitialized int array
      typeArrayOop t = (typeArrayOop) cast_to_oop(allocate(size));
      assert(t != NULL, "allocation should succeed");
+ #ifdef _LP64
+     t->set_mark(Universe::intArrayKlassObj()->prototype_header());
+ #else
      t->set_mark(markWord::prototype());
      t->set_klass(Universe::intArrayKlassObj());
+ #endif
      t->set_length((int)length);
    } else {
      assert(size == CollectedHeap::min_fill_size(),
             "size for smallest fake object doesn't match");
      instanceOop obj = (instanceOop) cast_to_oop(allocate(size));
+ #ifdef _LP64
+     obj->set_mark(vmClasses::Object_klass()->prototype_header());
+ #else
      obj->set_mark(markWord::prototype());
      obj->set_klass(vmClasses::Object_klass());
+ #endif
    }
  }
  
  HeapWord* OffsetTableContigSpace::initialize_threshold() {
    return _offsets.initialize_threshold();
< prev index next >