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

Jorn Vernee jvernee at openjdk.java.net
Fri Feb 21 14:57:43 UTC 2020


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