On Mon, 29 Nov 2021 11:22:45 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
> Following integration of the second incubator of the foreign function and > memory API [1], we detected few divergences between the contents of the jdk > repo and the panama repo: > > * the name of some of the `FunctionDescriptor` wither methods is different > (e.g. `withAppendedLayoutArguments` vs. `appendLayoutArguments`), as it has > been simplified and improved following a change that was not incorporated in > [1]. > > * TestUpcall does not execute all the test combinations, because of an issue > in the jtreg header (also fixed in the panama repo) > > * Addressing some feedback, we would like to bring back alignment to JAVA_INT > layout constants (and related constants). > > Javadoc: > http://cr.openjdk.java.net/~mcimadamore/8277924/v1/javadoc/jdk/incubator/foreign/package-summary.html > Specdiff: > http://cr.openjdk.java.net/~mcimadamore/8277924/v1/spec_diff/overview-summary.html > > [1] - #5907 Marked as reviewed by jvernee (Reviewer). src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/FunctionDescriptor.java line 134: > 132: * layout array of this function descriptor. > 133: * @param index the index at which to insert the arguments > 134: * @param addedLayouts the argument layouts to append. Suggestion: * @param addedLayouts the argument layouts to insert. src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/ValueLayout.java line 205: > 203: > 204: static final int ALIGNED_POS = 0; > 205: static final int UNALIGNED_POS = 1; Suggestion: private static final int ALIGNED_POS = 0; private static final int UNALIGNED_POS = 1; src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/Utils.java line 179: > 177: > 178: @Stable > 179: public static LayoutAccess LAYOUT_ACCESS; Clever :) Maybe some comment here about what this is doing would be nice (I had to look at it for a while). Suggestion: public static LayoutAccess LAYOUT_ACCESS; // shared secret Alternatively, I think you could do this with a MethodHandle acquired through `Lookup.privateLookupIn(lookup(), ValueLayout.class).findVirtual(...)`. ------------- PR: https://git.openjdk.java.net/jdk/pull/6589