MemoryLayout api
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Jan 21 18:51:44 UTC 2020
> if you stay away from MemoryAddress.offset/addOffset(), yes !
>
>> One question - do all your ByteBuffer benchmarks use Unsafe.invokeCleaner() ?
> The tests marked "Creation + loop" do allocation + loop + de-allocation,
> They measure the whole cost. For thoses i use Unsafe.invokeCleaner() [1].
>
> The tests marked "Loop only, constant memory" do not do allocation in the test but in a static block [2] and there is no deallocation.
> They only measure the cost of the loop when the MemoryAddress/ByteBuffer/long is constant.
> This is the cost i'm most interested in with my hat of writer of a dynamic language runtime.
Ok, makes sense.
Maurizio
>
>>
>> Maurizio
> Rémi
>
> [1] https://github.com/forax/panama-foreign/blob/master/src/test/java/fr.umlv.foreign/fr/umlv/foreign/ReadMemoryBenchMark.java#L70
> [2] https://github.com/forax/panama-foreign/blob/master/src/test/java/fr.umlv.foreign/fr/umlv/foreign/ReadGlobalMemoryBenchMark.java#L64
>
>
>>
>>> There is something i don't understand.
>>> The memory layout API let you create layouts that are invalid, i.e. that you can
>>> not create any VarHandle on it,
>>> by example a group (struct or union) that contains a sequence without a size, or
>>> a layout that starts with two sequences with no size.
>>>
>>> I get why you can have one sequence free, but you can not have more than one,
>>> otherwise you can not compute the size of the inner layout.
>>>
>>> So why the layout API let users create such badly shaped layout ?
>>> May i have overlooked something ?
>>>
>>> regards,
>>> Rémi
>>>
More information about the panama-dev
mailing list