RFR: 8273459: Update code segment alignment to 64 bytes [v3]

Scott Gibbons github.com+6704669+asgibbons at openjdk.java.net
Tue Sep 28 17:31:36 UTC 2021


On Tue, 28 Sep 2021 16:21:59 GMT, Scott Gibbons <github.com+6704669+asgibbons at openjdk.org> wrote:

>> Change the default code entry alignment to 64 bytes from 32 bytes.  This allows for maintaining proper 64-byte alignment of data within a code segment, which is required by several AVX-512 instructions.
>> 
>> I ran into this while implementing Base64 encoding and decoding.  Code segments which were allocated with the address mod 32 == 0 but with the address mod 64 != 0 would cause the align() macro to misalign.  This is because the align macro aligns to the size of the code segment and not the offset of the PC.  So align(64) would align the PC to a multiple of 64 bytes from the start of the segment, and not to a pure 64-byte boundary as requested.  Changing the alignment of the segment to 64 bytes fixes the issue.
>> 
>> I have not seen any measurable difference in either performance or memory usage with the tests I have run.
>> 
>> See [this ](https://mail.openjdk.java.net/pipermail/hotspot-dev/2021-August/054180.html) article for the discussion thread.
>
> Scott Gibbons has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
> 
>  - Merge branch 'openjdk:master' into asgibbons-align-fix
>  - Revert alignment of 64-bytes; Add align64()
>  - Change default code entry alignment to 64 bytes
>  - Fix align() directive
>    
>    Change align(x) to be relative to the current section's end rather than its size.  Issue was uncovered with a raw align(64).
>  - Merge branch 'openjdk:master' into master
>  - Merge branch 'openjdk:master' into master
>  - Fixing .gitignore

Thanks for the comments.  I reverted the .gitignore change and added comments as requested.  I also found a couple of unmodified align(64) which were changed.

As suggested, I added an assert in align() to flag spots where alignment cannot be ensured.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5547



More information about the build-dev mailing list