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

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

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 18
    • Fix Version/s: 18
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b08

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: