[foreign-abi] RFR 8237762: Add platform dependent MemoryLayout constants
Remi Forax
forax at univ-mlv.fr
Thu Jan 23 16:20:09 UTC 2020
Hi Jorn,
that seems very inefficient, because you are testing the ABI for each static final,
you can do it once in the static block.
static {
var c_bool;
switch (abi.name()) {
case ABI_SYSV -> {
c_bool = ...
}
case ABI_WINDOWS -> {
c_bool = ...
}
case ABI_AARCH64 -> {
c_bool = ...
}
default -> throw new UnsupportedOperationException("Unsupported ABI: " + abi.name());
}
C_BOOL = c_bool;
}
This solution will not scale well because you need one local variable per type, but that should be good enough in this case.
regards,
Rémi
----- Mail original -----
> De: "Jorn Vernee" <jorn.vernee at oracle.com>
> À: "panama-dev at openjdk.java.net'" <panama-dev at openjdk.java.net>
> Envoyé: Jeudi 23 Janvier 2020 17:03:02
> Objet: [foreign-abi] RFR 8237762: Add platform dependent MemoryLayout constants
> Hi,
>
> Please review the following patch that adds platform/ABI dependent
> MemoryLayout constants to MemoryLayouts.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8237762
> Webrev:
> http://cr.openjdk.java.net/~jvernee/panama/webrevs/8237762/webrev.00/
>
> Thanks,
> Jorn
More information about the panama-dev
mailing list