[foreign-memaccess+abi] RFR: 8300201: When storing MemoryAddress.ofLong(0x0000000080000000L), MemorySegment.get is not equal to MemorySegment.set because of the expanded sign

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jan 23 17:31:55 UTC 2023


On Mon, 23 Jan 2023 16:52:39 GMT, Per Minborg <pminborg at openjdk.org> wrote:

> This PR proposes to normalize the upper 32-bit to zero on 32-bit systems.

src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 1048:

> 1046:      * On 32-bit platforms, the given address value will be normalized such that the
> 1047:      * returned memory segment's method {@link MemorySegment#address() address} will always return
> 1048:      * zeros for the upper 32 bits of the address.

Suggestion:

     * On 32-bit platforms, the given address value will be normalized such that the
     * upper 32 bits of the {@link MemorySegment#address() address} of returned memory segment
     * are set to zero.

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

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


More information about the panama-dev mailing list