RFR: 8291359: Specification of method j.l.foreign.VaList::skip still deserves clarification [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Dec 1 17:22:51 UTC 2022


On Wed, 30 Nov 2022 18:54:49 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> A small clarification of the VaList spec to say that attempts to access elements through an incorrect memory layout result in undefined behavior.
>
> Jorn Vernee has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   Clarify spec

src/java.base/share/classes/java/lang/foreign/VaList.java line 55:

> 53:  * and any other type that fits into a {@code long}.
> 54:  * <h2 id="safety">Safety considerations</h2>
> 55:  * The behavior of any attempts to access a value in the va list, whether through one of the {@code nextVarg} overloads

Suggestion:

 * The behavior of any attempts to access a value in the variable argument list, whether through one of the {@code nextVarg} overloads

src/java.base/share/classes/java/lang/foreign/VaList.java line 56:

> 54:  * <h2 id="safety">Safety considerations</h2>
> 55:  * The behavior of any attempts to access a value in the va list, whether through one of the {@code nextVarg} overloads
> 56:  * or {@link #skip(MemoryLayout...)}, using a memory layout other than the layout of the accessed value, or any subsequent

Not super sure what you mean here by using a layout "other than the layout of the accessed value". I think you mean the layout of the underlying value that needs to be accessed? Also, is the behavior undefined even when the VaList is created safely, from Java code?

src/java.base/share/classes/java/lang/foreign/VaList.java line 57:

> 55:  * The behavior of any attempts to access a value in the va list, whether through one of the {@code nextVarg} overloads
> 56:  * or {@link #skip(MemoryLayout...)}, using a memory layout other than the layout of the accessed value, or any subsequent
> 57:  * accesses to the same va list, is undefined.

Suggestion:

 * accesses to the same variable argument list, is undefined.

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

PR: https://git.openjdk.org/jdk/pull/11440


More information about the core-libs-dev mailing list