[foreign-memaccess] RFR: 8249879: Split MemorySegment and MemoryAddress [v3]

Jorn Vernee jvernee at openjdk.java.net
Mon Jul 27 12:56:47 UTC 2020


On Mon, 27 Jul 2020 12:45:33 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> test/jdk/java/foreign/TestVarHandleCombinators.java line 114:
>> 
>>> 113:                 for (long j = 0; j < inner_size; j++) {
>>> 114:                     vh.set(segment, i * 40 + j * 8, count);
>>> 115:                     assertEquals(
>> 
>> Can this be done with combinators instead of manual offsets like before? Mostly curious about how this use-case changes.
>
> I can change this, for sure, but in real world, such use case would just go through the layout ABI, which does all the
> combination you want for free. Are you sure you want me to write what MemoryLayout::varHandle does inside the test?

Ok, just wanted to know if it should use the layout API or it couldn't for some reason.

>> test/micro/org/openjdk/bench/jdk/incubator/foreign/LoopOverNonConstantMapped.java line 149:
>> 
>>> 148:         for (int i = 0; i < ELEM_SIZE; i ++) {
>>> 149:             res += MemoryAccess.getIntAtIndex(segment, i * CARRIER_SIZE);
>>> 150:         }
>> 
>> Why this multiply by CARRIER_SIZE? That should be done by the accessor.
>
> mistake - will fix (but this has nothing to do with this patch, I think?)

Well, this patch adds the multiply...

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

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


More information about the panama-dev mailing list