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

Henry Jen henryjen at openjdk.java.net
Fri Feb 21 03:24:19 UTC 2020


On Fri, 21 Feb 2020 01:14:07 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> 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.
> 
> src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/TypeMaker.java line 185:
> 
>> 184:             case Record: {
>> 185:                 if (treeMaker == null) {
>> 186:                     // Macro evaluation, type is meaningless as this can only be pointer and we only care value
> 
> Do we get a crash if we go here inside macro eval? Why the special casing - I mean I get that we probably don't care, but trying to understand.

We get a NPE since treeMaker is null. If we simply plug-in a TreeMaker, then we get crash as TU in Macro is not usable.

I am thinking we could provide a inquiry-only TreeMaker of the precompile TU for macro case, then we can get the correct type.

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

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


More information about the panama-dev mailing list