< prev index next >

src/hotspot/share/gc/z/zRelocate.cpp

Print this page
*** 62,19 ***
  
  static uintptr_t relocate_object_inner(ZForwarding* forwarding, uintptr_t from_addr, ZForwardingCursor* cursor) {
    assert(ZHeap::heap()->is_object_live(from_addr), "Should be live");
  
    // Allocate object
!   const size_t size = ZUtils::object_size(from_addr);
    const uintptr_t to_addr = ZHeap::heap()->alloc_object_for_relocation(size);
    if (to_addr == 0) {
      // Allocation failed
      return 0;
    }
  
    // Copy object
!   ZUtils::object_copy_disjoint(from_addr, to_addr, size);
  
    // Insert forwarding
    const uintptr_t to_addr_final = forwarding_insert(forwarding, from_addr, to_addr, cursor);
    if (to_addr_final != to_addr) {
      // Already relocated, try undo allocation
--- 62,19 ---
  
  static uintptr_t relocate_object_inner(ZForwarding* forwarding, uintptr_t from_addr, ZForwardingCursor* cursor) {
    assert(ZHeap::heap()->is_object_live(from_addr), "Should be live");
  
    // Allocate object
!   const size_t size = ZUtils::object_compact_size(from_addr);
    const uintptr_t to_addr = ZHeap::heap()->alloc_object_for_relocation(size);
    if (to_addr == 0) {
      // Allocation failed
      return 0;
    }
  
    // Copy object
!   ZUtils::object_copy_disjoint_compact(from_addr, to_addr, size);
  
    // Insert forwarding
    const uintptr_t to_addr_final = forwarding_insert(forwarding, from_addr, to_addr, cursor);
    if (to_addr_final != to_addr) {
      // Already relocated, try undo allocation

*** 286,23 ***
        // Already relocated
        return true;
      }
  
      // Allocate object
!     const size_t size = ZUtils::object_size(from_addr);
      const uintptr_t to_addr = _allocator->alloc_object(_target, size);
      if (to_addr == 0) {
        // Allocation failed
        return false;
      }
  
      // Copy object. Use conjoint copying if we are relocating
      // in-place and the new object overlapps with the old object.
      if (_forwarding->in_place() && to_addr + size > from_addr) {
!       ZUtils::object_copy_conjoint(from_addr, to_addr, size);
      } else {
!       ZUtils::object_copy_disjoint(from_addr, to_addr, size);
      }
  
      // Insert forwarding
      if (forwarding_insert(_forwarding, from_addr, to_addr, &cursor) != to_addr) {
        // Already relocated, undo allocation
--- 286,23 ---
        // Already relocated
        return true;
      }
  
      // Allocate object
!     const size_t size = ZUtils::object_compact_size(from_addr);
      const uintptr_t to_addr = _allocator->alloc_object(_target, size);
      if (to_addr == 0) {
        // Allocation failed
        return false;
      }
  
      // Copy object. Use conjoint copying if we are relocating
      // in-place and the new object overlapps with the old object.
      if (_forwarding->in_place() && to_addr + size > from_addr) {
!       ZUtils::object_copy_conjoint_compact(from_addr, to_addr, size);
      } else {
!       ZUtils::object_copy_disjoint_compact(from_addr, to_addr, size);
      }
  
      // Insert forwarding
      if (forwarding_insert(_forwarding, from_addr, to_addr, &cursor) != to_addr) {
        // Already relocated, undo allocation
< prev index next >