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

Arena::Amalloc may return misaligned address on 32-bit

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • 18
    • hotspot
    • b08

      This is only a problem on 32 bit platforms, but this code has been like this for forever so we don't know why it works.

      From [~stuefe]:

      I'm not sure the alignment handling is correct. Either that or I don't understand the contract of the Amalloc... functions.

      I thought:

      Amalloc(x) -> allocate x bytes, align returned pointer to 64bit
      AmallocWords(x) -> allocate x bytes, align returned pointer to pointer size
      ?

      Because the functions just align the given byte size (well, Amalloc() aligns automatically, AmallocWords() asserts). But that has no effect on the returned pointer.

      Consider this sequence, on 32bit:

      AmallocWords(4) -> _hwm = 4
      Amalloc(8) -> will return a pointer to offset 4, so not 64bit aligned.

            stuefe Thomas Stuefe
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: