[foreign-memaccess+abi] RFR: Simplify code now that bitSize is always aligned to byte boundaries

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Feb 15 14:19:40 UTC 2023


On Wed, 15 Feb 2023 12:54:37 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR suggests some simplifications now that layouts are always aligned to byte boundaries. 
> 
> The PR also contains some other simplifications/cleanups.

src/java.base/share/classes/jdk/internal/foreign/Utils.java line 63:

> 61:     private static final MethodHandle ADDRESS_TO_LONG;
> 62:     private static final MethodHandle LONG_TO_ADDRESS;
> 63:     public static final MethodHandle MH_BITS_TO_BYTES_FOR_OFFSET;

Maybe just `BITS_TO_BYTES`?

src/java.base/share/classes/jdk/internal/foreign/Utils.java line 92:

> 90:     }
> 91: 
> 92:     public static long bitsToBytes(long bits) {

Should we put an assert here - just in case (rather than a comment) ?

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

PR: https://git.openjdk.org/panama-foreign/pull/796


More information about the panama-dev mailing list