On Tue, 2 Nov 2021 10:30:42 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/Utils.java line >> 111: >> >>> 109: class VarHandleCache { >>> 110: private static final Map<ValueLayout, VarHandle> handleMap >>> = new ConcurrentHashMap<>(); >>> 111: private static final Map<ValueLayout, VarHandle> >>> handleMapNoAlignCheck = new ConcurrentHashMap<>(); >> >> Something to consider later if this is an issue. Since the number of >> `ValueLayout` instances is fixed, carrier x order = 18, we can use stable >> arrays with ordinals on the instances. > > What about alignment? Drat, `skipAlignmentCheck` misled me but perhaps there is still benefit for common constants with 8 bit and size alignment and fallback otherwise. ------------- PR: https://git.openjdk.java.net/jdk/pull/5907