Integrated: fix normalize method in RuntimeHelper.java.template
    Jason Thomas 
    duke at openjdk.org
       
    Wed Nov  8 17:43:36 UTC 2023
    
    
  
On Sun, 15 Oct 2023 04:10:02 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
This pull request has now been integrated.
Changeset: 8eae6e13
Author:    jason <katsoftwarellc at gmail.com>
Committer: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/jextract/commit/8eae6e1382725b0f6ea97e21a0a19c1b3e298b05
Stats:     1 line in 1 file changed: 0 ins; 0 del; 1 mod
fix normalize method in RuntimeHelper.java.template
Reviewed-by: mcimadamore
-------------
PR: https://git.openjdk.org/jextract/pull/131
    
    
More information about the jextract-dev
mailing list