On Fri, 24 Jan 2025 11:57:06 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> The main goal here is that passing/receiving raw addresses as longs is 
>> cheaper than as `MemorySegment`s.
>
> But the address is immediately converted to memory segment using 
> MemorySegment::ofAddress, which is what the linker does anyway?

Only the return value of `CALLOC` is converted to `MemorySegment` in an 
equivalent way, I believe passing a `MemorySegment` to a downcall involves 
acquiring the corresponding segment? As a result, `FREE` is made to accept the 
raw address, and `CALLOC` is changed in the same manner for consistency.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22610#discussion_r1929440246

Reply via email to