RFR (14) 8235837: Memory access API refinements
Paul Sandoz
paul.sandoz at oracle.com
Fri Jan 17 19:52:41 UTC 2020
A sweet spot for certain cases is to obtain a buffer from a segment, where the nice properties of the segment (esp. temporal bounds) are linked to the buffer. Under such circumstances I am not yet convinced we need equivalent accessors in the foreign API, on say a segment.
Paul.
> On Jan 17, 2020, at 8:22 AM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
>
>
> On 17/01/2020 16:01, Andrew Haley wrote:
>> On 1/16/20 3:15 PM, Maurizio Cimadamore wrote:
>>> On 16/01/2020 14:50, Andrew Haley wrote:
>>>> On 1/15/20 6:48 PM, Maurizio Cimadamore wrote:
>>>>> Maybe this would be best moved on panama-dev?
>>>> Here we are.
>>>>
>>>>> In any case, for obtaining best performances, it is best to use an
>>>>> indexed (or strided) var handle - your loop will create a new memory
>>>>> address on each new iteration, which will not be a problem once
>>>>> MemoryAddress will be an inline type, but in the meantime...
>>>> OK. It's rather unfortunate that your example at the very top of the
>>>> API description uses an anti-pattern, at least from a performance
>>>> point of view. Might I suggest that it should be changed to the best
>>>> way to do the job?
>>> That's a good suggestion, thanks. The rational behind the current
>>> example was to provide a simple example so that people could familiarize
>>> with the API - I'm worried that throwing strided access into the mix in
>>> the first example could be a bit steep, but I'll see what I can do.
>> I think that's a big clue itself. Perhaps the API is the problem here
>> -- if the simple way to do something isn't the best way to do it, some
>> changes may be called for.
>>
>> People are going to want to replace simple ByteBuffer operations with
>> this API, and we'll need a straightforward way to do that.
> Possibly - although this API might be slightly lower-level than your typical BB audience, I think. Anyway, the focus, for now, is on the fundamentals - we want to get the primitive right - later on we can discuss as to whether we should throw in *usability candies* such as having indexed accessors on the memory segment itself which does the right thing VarHandle-wise.
More information about the panama-dev
mailing list