[foreign-abi] RFR: 8239784: Circular initialization causes C_XXX constants to be null

sundararajan.athijegannathan at oracle.com sundararajan.athijegannathan at oracle.com
Fri Feb 21 16:20:10 UTC 2020


* May I suggest another othervm test to check the other init order 
(MemoryLayouts first and then platform specific ABI init later)?

* May I also request to piggyback: please add "long double" missing 
constants to other ABIs (Windows etc.)? This was suggested in another PR 
https://git.openjdk.java.net/panama-foreign/pull/25

-Sundar

On 21/02/20 8:27 pm, Jorn Vernee wrote:
> See the bug for a complete description. Essentially, the problem is that
>
> public static void main(String[] args) {
>      System.out.println(MemoryLayouts.WinABI.C_CHAR);
>      System.out.println(MemoryLayouts.C_CHAR);
> }
>
> Will print
>
> b8
> null
> Because of a circular dependency between the constants.
>
> The fix is to extract the constants that the platform specific classes depend on into a separate, shared class, which removes the circular dependency. (This fix was suggested by Sundar)
>
> -------------
>
> Commits:
>   - e98fa46a: Prevent circular initialization between MemoryLayouts and platform specific constant holder classes
>
> Changes: https://git.openjdk.java.net/panama-foreign/pull/26/files
>   Webrev: https://webrevs.openjdk.java.net/panama-foreign/26/webrev.00
>    Issue: https://bugs.openjdk.java.net/browse/JDK-8239784
>    Stats: 100 lines in 2 files changed: 50 ins; 0 del; 50 mod
>    Patch: https://git.openjdk.java.net/panama-foreign/pull/26.diff
>    Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/26/head:pull/26
>
> PR: https://git.openjdk.java.net/panama-foreign/pull/26


More information about the panama-dev mailing list