[foreign-jextract] RFR: 8274155 Foreign API refresh - jextract update

Athijegannathan Sundararajan sundar at openjdk.java.net
Thu Sep 23 10:30:24 UTC 2021


On Thu, 23 Sep 2021 09:51:11 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/ConstantBuilder.java line 332:
>> 
>>> 330:         append("MemorySegment ");
>>> 331:         append(fieldName);
>>> 332:         append(" = ResourceScope.newSharedScope().allocateUtf8String(\"");
>> 
>> Do we need shared scope here? or confined scope will do?
>
> This is a string constant - so we don't know which thread will use it. It cannot be confined. Thinking more, perhaps we should even use the global scope - because we don't really want these to ever be cleaned up.

got it

>> src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/ToplevelBuilder.java line 189:
>> 
>>> 187:             emitPrimitiveTypedef(Type.primitive(Type.Primitive.Kind.Double), "C_DOUBLE");
>>> 188:             emitPointerTypedef("C_POINTER");
>>> 189:         }
>> 
>> Will this clash with user's typedef?
>> 
>> typedef int C_INT; 
>> 
>> in user's header?
>
> possibly, perhaps we can introduce some disambiguation later?

sounds good

>> src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/TypeImpl.java line 45:
>> 
>>> 43: 
>>> 44:     public static final boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows");
>>> 45: 
>> 
>> is this used?
>
> yes, ```Long("long", TypeImpl.IS_WINDOWS ? ValueLayout.JAVA_INT : ValueLayout.JAVA_LONG),```

okay. missed that.

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

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


More information about the panama-dev mailing list