Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8289333

Specification of method j.l.foreign.VaList::skip deserves clarification

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • 19
    • core-libs

        Specificaition of method VaList::skip is rather short

        > Skips a number of elements with the given memory layouts, and advances this variable argument list's position.

        It's not perfectly clear what would for example produce the following code

                try (var session = MemorySession.openConfined()) {
                    VaList vaList = VaList.make(builder -> builder.addVarg(ValueLayout.JAVA_INT, 77)
                            .addVarg(ValueLayout.JAVA_LONG, -78),
                            session);
                    vaList.skip(ValueLayout.JAVA_DOUBLE, ValueLayout.JAVA_BOOLEAN);
                    System.out.println(vaList.nextVarg(ValueLayout.JAVA_INT));
                }

        On MacOS x86 the result is

        -78

        In the OpenJDK implementation behaves correctly, the spec of ::skip would benefit from more detailed explaination or some references or hints.

              jvernee Jorn Vernee
              dbessono Dmitry Bessonov
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: