RFR: 7903181: port jextract for foreign-preview changes

Athijegannathan Sundararajan sundar at openjdk.java.net
Fri May 20 13:49:07 UTC 2022


On Fri, 20 May 2022 13:18:54 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> 7903181: port jextract for foreign-preview changes
>
> samples/dlopen/Dlopen.java line 42:
> 
>> 40:     // implementation of Symbol lookup that loads a given shared object using dlopen
>> 41:     // and looks up symbols using dlsym
>> 42:     private static Function<String, Optional<MemorySegment>> lookup(String libraryName, MemorySession session) {
> 
> Does this sample still make sense with the new `libraryLookup` ?

May be not. But as a POSIX specific example of dlopen/dlsym/dladdr etc. We may be expand to use flags, dladdr etc.

> src/main/java/org/openjdk/jextract/clang/libclang/CXString.java line 56:
> 
>> 54:     }
>> 55:     public static MemoryAddress data$get(MemorySegment seg, long index) {
>> 56:         return (java.lang.foreign.MemoryAddress)CXString.data$VH.get(seg.asSlice(index*sizeof()));
> 
> Maybe jextract should not emit a fully qualified name for the cast target? There's an import anyways.

Yes, pre-existing issue I think. Will address it in another bug

> test/jtreg/generator/testStruct/LibStructTest.java line 72:
> 
>> 70:     @Test
>> 71:     public void testAllocateArray() {
>> 72:         try (MemorySession scope = MemorySession.openConfined()) {
> 
> s/scope/session

Will fix it.

> test/testng/org/openjdk/jextract/test/toolprovider/TestClassGeneration.java line 183:
> 
>> 181:         Method layout_getter = checkMethod(structCls, "$LAYOUT", MemoryLayout.class);
>> 182:         MemoryLayout structLayout = (MemoryLayout) layout_getter.invoke(null);
>> 183:         try (MemorySession scope = MemorySession.openConfined()) {
> 
> s/scope/session

will fix it.

> test/testng/org/openjdk/jextract/test/toolprovider/TestNested.java line 170:
> 
>> 168: 
>> 169:                 Object zero = MethodHandles.zero(type).invoke();
>> 170:                 try (MemorySession scope = MemorySession.openConfined()) {
> 
> s/scope/session

will fix it

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

PR: https://git.openjdk.java.net/jextract/pull/35


More information about the jextract-dev mailing list