[foreign-abi] [Rev 01] RFR: 8241017: Enhance AllocationScope to support "unbounded" mode

Jorn Vernee jvernee at openjdk.java.net
Mon Mar 16 10:56:26 UTC 2020


On Fri, 13 Mar 2020 21:49:45 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/UnboundedAllocationScope.java line 71:
>> 
>>> 70:                 sp = start + bytesSize;
>>> 71:                 size += Utils.alignUp(bytesSize, bytesAlignment);
>>> 72:                 return slice.baseAddress();
>> 
>> Aren't `sp` and `size` always the same? Are 2 separate fields really needed?
>
> The idea is that size keeps track of total allocation size, sp is just a pointer into current segment and is reset
> every time - unless I made a mistake

Oh I see. Yeah, then it makes sense to have 2 fields.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/53


More information about the panama-dev mailing list