< prev index next >

src/hotspot/share/gc/serial/defNewGeneration.cpp

Print this page
*** 735,11 ***
  }
  
  oop DefNewGeneration::copy_to_survivor_space(oop old) {
    assert(is_in_reserved(old) && !old->is_forwarded(),
           "shouldn't be scavenging this oop");
!   size_t s = old->size();
    oop obj = nullptr;
  
    // Try allocating obj in to-space (unless too old)
    if (old->age() < tenuring_threshold()) {
      obj = cast_to_oop(to()->allocate(s));
--- 735,13 ---
  }
  
  oop DefNewGeneration::copy_to_survivor_space(oop old) {
    assert(is_in_reserved(old) && !old->is_forwarded(),
           "shouldn't be scavenging this oop");
!   size_t old_size = old->size();
+   size_t s = old->copy_size(old_size, old->mark());
+ 
    oop obj = nullptr;
  
    // Try allocating obj in to-space (unless too old)
    if (old->age() < tenuring_threshold()) {
      obj = cast_to_oop(to()->allocate(s));

*** 760,20 ***
    // Prefetch beyond obj
    const intx interval = PrefetchCopyIntervalInBytes;
    Prefetch::write(obj, interval);
  
    // Copy obj
!   Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(old), cast_from_oop<HeapWord*>(obj), s);
  
    ContinuationGCSupport::transform_stack_chunk(obj);
  
    if (!new_obj_is_tenured) {
      // Increment age if obj still in new generation
      obj->incr_age();
      age_table()->add(obj, s);
    }
  
    // Done, insert forward pointer to obj in this header
    old->forward_to(obj);
  
    if (SerialStringDedup::is_candidate_from_evacuation(obj, new_obj_is_tenured)) {
      // Record old; request adds a new weak reference, which reference
--- 762,22 ---
    // Prefetch beyond obj
    const intx interval = PrefetchCopyIntervalInBytes;
    Prefetch::write(obj, interval);
  
    // Copy obj
!   Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(old), cast_from_oop<HeapWord*>(obj), old_size);
  
    ContinuationGCSupport::transform_stack_chunk(obj);
  
    if (!new_obj_is_tenured) {
      // Increment age if obj still in new generation
      obj->incr_age();
      age_table()->add(obj, s);
    }
  
+   obj->initialize_hash_if_necessary(old);
+ 
    // Done, insert forward pointer to obj in this header
    old->forward_to(obj);
  
    if (SerialStringDedup::is_candidate_from_evacuation(obj, new_obj_is_tenured)) {
      // Record old; request adds a new weak reference, which reference
< prev index next >