[foreign-abi] RFR 8237762: Add platform dependent MemoryLayout constants
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Jan 23 16:48:18 UTC 2020
Why do you even need the temp local? can't you assign the static final
directly in the switch body?
Maurizio
On 23/01/2020 16:28, Remi Forax wrote:
> just a minor fix,
> c_bool as to be declared, it can not use `var`.
>
> Rémi
>
> ----- Mail original -----
>> De: "Remi Forax" <forax at univ-mlv.fr>
>> À: "Jorn Vernee" <jorn.vernee at oracle.com>
>> Cc: "panama-dev at openjdk.java.net'" <panama-dev at openjdk.java.net>
>> Envoyé: Jeudi 23 Janvier 2020 17:20:09
>> Objet: Re: [foreign-abi] RFR 8237762: Add platform dependent MemoryLayout constants
>> 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