Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8178490

Usages of is_object_aligned with pointers are broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • 9, 10
    • hotspot
    • None
    • gc
    • b21

      is_object_aligned only works correctly for sizes measured in words.

      When a pointer is passed into:
      inline bool is_object_aligned(intptr_t addr) {
        return addr == align_object_size(addr);
      }

      inline intptr_t align_object_size(intptr_t size) {
        return align_size_up(size, MinObjAlignment);
      }

      the pointer is incorrectly interpreted as a word size and the alignment is checked against MinObjectAligment instead of MinObjectAlignmentInBytes.

      This was found while working on JDK-8178489.

            stefank Stefan Karlsson
            stefank Stefan Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: