RFR: fix normalize method in RuntimeHelper.java.template [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Nov 6 13:54:51 UTC 2023


On Mon, 6 Nov 2023 13:48:53 GMT, Jason Thomas <duke at openjdk.org> wrote:

>> This was failing for non-primitive types. Here's an example that demonstrates the behavior.
>> 
>> `jextract --source -t org.unix -I /usr/include /usr/include/stdio.h`
>> 
>> 
>> import java.lang.foreign.Arena;
>> import java.lang.foreign.MemorySegment;
>> 
>> import static org.unix.stdio_h.*;
>> 
>> public class Testing {
>>     public static void main(String[] args) {
>>         Arena arena = Arena.ofConfined();
>>         MemorySegment hello = arena.allocateUtf8String("Hello %s\n");
>>         MemorySegment world = arena.allocateUtf8String("World");
>>         printf(hello, world);
>>         fflush(NULL());
>>     }
>> }
>> 
>> Exception in thread "main" java.lang.AssertionError: should not reach here
>> 	at org.unix.stdio_h.printf(stdio_h.java:1520)
>> 	at org.jt70.panama_article.Testing.main(Testing.java:13)
>> Caused by: java.lang.IllegalArgumentException: Invalid type for ABI: jdk.internal.foreign.NativeMemorySegmentImpl
>> 	at org.unix.RuntimeHelper$VarargsInvoker.normalize(RuntimeHelper.java:231)
>> 	at org.unix.RuntimeHelper$VarargsInvoker.invoke(RuntimeHelper.java:166)
>> 	at org.unix.stdio_h.printf(stdio_h.java:1518)
>> 	... 1 more
>
> Jason Thomas has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
> 
>   fix normalize method

Looks good - thanks!

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

Marked as reviewed by mcimadamore (Committer).

PR Review: https://git.openjdk.org/jextract/pull/131#pullrequestreview-1715229466


More information about the jextract-dev mailing list