[foreign-jextract] RFR: JDK-8244270: reorganize ABI-dependent layout constants (second attempt)
mcimadamore at openjdk.java.net
Tue May 5 09:52:35 UTC 2020
On Sat, 2 May 2020 15:03:09 GMT, Henry Jen <henryjen at openjdk.org> wrote:
> Bottom line, type is reasonable to expose to public, ABI implementation detail such as classification is not.
There's a tradeoff here. The ABI obviously needs more info than those attached to a layout to do the classification;
otherwise the layout of a `float` and that of an `int` would be the same on most platform. One might argue - but why
not just using the carrier types attached to the `MethodType` (also passed to the ABI) to do the classification?
Because that's brittle - it works for primitives, it doesn't work for structs passed by value, which, on certain ABI
(e.g. SysV) require a fair amount of recursive classification.
So the choices are between augmenting layouts (with attributes) and coming up with a _new_ abstraction which is
essentially a layout + some classification info (and maybe a Java carrier). In the name of minimality of the API
surface we opted for the first option. Every time we considered moving away from layouts, the "bang for bucks" factor
seemed relatively low.
More information about the panama-dev