[foreign-abi] [Rev 01] RFR: 8244720: Check MethodType and FunctionDescritpor used when linking
Jorn Vernee
jvernee at openjdk.java.net
Mon May 11 11:44:59 UTC 2020
On Mon, 11 May 2020 10:34:54 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev
>> excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since
>> the last revision:
>> - Reduce code duplication as suggested in review
>> - Add more type checking for MethodType and FunctionDescriptors used for linking
>
> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/SharedUtils.java line 189:
>
>> 188: return dest;
>> 189: }
>> 190:
>
> I recalled that we do this check in the foreign memory access API (see `LayoutPath.java`):
>
> if (!carrier.isPrimitive() || carrier == void.class || carrier == boolean.class // illegal carrier?
> || Wrapper.forPrimitiveType(carrier).bitWidth() != layout.bitSize()) { // carrier has the right size?
> throw new IllegalArgumentException("Invalid carrier: " + carrier + ", for layout " + layout);
> }
> Can we perhaps unify a little? It seems like your check should subsume the existing check (at least for ValueLayouts).
I've moved some of the common code into jdk.internal.foreign.Utils
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/158
More information about the panama-dev
mailing list