< prev index next >

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

Print this page
*** 619,24 ***
    }
  
    zaddress try_relocate_object_inner(zaddress from_addr) {
      ZForwardingCursor cursor;
  
-     const size_t size = ZUtils::object_size(from_addr);
      ZPage* const to_page = target(_forwarding->to_age());
  
      // Lookup forwarding
      {
        const zaddress to_addr = forwarding_find(_forwarding, from_addr, &cursor);
        if (!is_null(to_addr)) {
          // Already relocated
          increase_other_forwarded(size);
          return to_addr;
        }
      }
  
      // Allocate object
      const zaddress allocated_addr = _allocator->alloc_object(to_page, size);
      if (is_null(allocated_addr)) {
        // Allocation failed
        return zaddress::null;
      }
--- 619,25 ---
    }
  
    zaddress try_relocate_object_inner(zaddress from_addr) {
      ZForwardingCursor cursor;
  
      ZPage* const to_page = target(_forwarding->to_age());
  
      // Lookup forwarding
      {
        const zaddress to_addr = forwarding_find(_forwarding, from_addr, &cursor);
        if (!is_null(to_addr)) {
          // Already relocated
+         const size_t size = ZUtils::object_size(to_addr);
          increase_other_forwarded(size);
          return to_addr;
        }
      }
  
      // Allocate object
+     const size_t size = ZUtils::object_size(from_addr);
      const zaddress allocated_addr = _allocator->alloc_object(to_page, size);
      if (is_null(allocated_addr)) {
        // Allocation failed
        return zaddress::null;
      }
< prev index next >