[foreign-jextract] [Rev 01] RFR: 8239128: Macro defines constant pointers can crash VM via jextract API

Henry Jen henryjen at openjdk.java.net
Thu Feb 20 21:44:54 UTC 2020


> The fundamental issue of the crash is that clang cursor/type may no longer valid after reparse another macro, and with pointer type lazily resolve the pointee type, if the clang cursor/type no longer valid, access invalid memory cause the crash.
> 
> The other issue is the a macro pointer to a record type like struct/union can cause NPE, and that cause the macro to be ignored on generation without a warning.
> 
> The fix remove the laziness from Type API perspective, but leave that as an implementation detail, so implementation of Pointer type need to figure out how to do that safely internally.
> 
> Record type in macro are reduces to void, as currently the Declaration implementation is depending on clang as well, we cannot guarantee that works after reparse.

The pull request has been updated with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase.

-------------

Added commits:
 - 73e2c418: Merge remote-tracking branch 'openjdk/foreign-jextract' into foreign-jextract
 - e038e170: Automatic merge of foreign-abi into foreign-jextract
 - 83bf29ce: 8239345: need an enum for standard C types and a way to get a memory layout for those C types
 - ceb5ebce: Fix type reference resolution to pointer types

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/21/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/21/files/a5893a2c..73e2c418

Webrevs:
 - full: https://webrevs.openjdk.java.net/panama-foreign/21/webrev.01
 - incr: https://webrevs.openjdk.java.net/panama-foreign/21/webrev.00-01

  Stats: 495 lines in 21 files changed: 352 ins; 66 del; 77 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/21.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/21/head:pull/21

PR: https://git.openjdk.java.net/panama-foreign/pull/21


More information about the panama-dev mailing list