RFR: 8275063: Implementation of Foreign Function & Memory API (Second incubator) [v10]

Paul Sandoz psandoz at openjdk.java.net
Tue Nov 2 15:44:13 UTC 2021


On Tue, 2 Nov 2021 10:30:42 GMT, Maurizio Cimadamore <mcimadamore at 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



More information about the build-dev mailing list