RFR: 8291359: Specification of method j.l.foreign.VaList::skip still deserves clarification [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Dec 1 22:00:09 UTC 2022
On Thu, 1 Dec 2022 17:53:02 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Yes, I mean the layout of the underlying value that is being accessed. i.e. can't access a boolean as an int.
>>
>> The behavior is undefined either way. Even when a VaList is created from Java, we create the same underlying native data structure (because we want to pass it to native code). This doesn't keep track of the layouts the list was built with, so there can still be mismatches.
>
> Right.
This sentence still needs to be clarified IMHO. E.g. it is not clear when reading what "using a memory layout other than the layout of the accessed value" - since we are passing a layout to the access operation... it feels like we're trying to compress too much. We should say something like:
The values in a variable argument list are stored in one or more regions of memory in a platform specific fashion.
Any attempt to access (or skip) any such value with a mismatched memory layout (example) will result in undefined behavior.
-------------
PR: https://git.openjdk.org/jdk/pull/11440
More information about the core-libs-dev
mailing list