From: Matthew Fortune Date: Wed, 13 Jul 2016 21:34:35 +0000 (+0000) Subject: Fix the use of FFI closures in the java interpreter for integer returns X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=845a4b727a88af8f4008e24e1a02ce49607bd91a;p=gcc.git Fix the use of FFI closures in the java interpreter for integer returns libjava/ * interpret-run.cc: Use ffi_arg for FFI integer return types. * testsuite/libjava.jar/arraysort.java: New file. * testsuite/libjava.jar/arraysort.jar: New file. * testsuite/libjava.jar/arraysort.out: New file. * testsuite/libjava.jar/arraysort.xfail: New file. From-SVN: r238311 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index a3bead2fa9a..06b354d7777 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2016-07-13 Matthew Fortune + + * interpret-run.cc: Use ffi_arg for FFI integer return types. + * testsuite/libjava.jar/arraysort.java: New file. + * testsuite/libjava.jar/arraysort.jar: New file. + * testsuite/libjava.jar/arraysort.out: New file. + * testsuite/libjava.jar/arraysort.xfail: New file. + 2016-06-01 Matthias Klose * libtool-version: Bump soversion. diff --git a/libjava/interpret-run.cc b/libjava/interpret-run.cc index a4c2d4dab43..6be354eaf5e 100644 --- a/libjava/interpret-run.cc +++ b/libjava/interpret-run.cc @@ -1838,7 +1838,7 @@ details. */ return; insn_ireturn: - *(jint *) retp = POPI (); + *(ffi_arg *) retp = POPI (); return; insn_return: diff --git a/libjava/testsuite/libjava.jar/arraysort.jar b/libjava/testsuite/libjava.jar/arraysort.jar new file mode 100644 index 00000000000..ee051e45a83 Binary files /dev/null and b/libjava/testsuite/libjava.jar/arraysort.jar differ diff --git a/libjava/testsuite/libjava.jar/arraysort.java b/libjava/testsuite/libjava.jar/arraysort.java new file mode 100644 index 00000000000..56c181dd088 --- /dev/null +++ b/libjava/testsuite/libjava.jar/arraysort.java @@ -0,0 +1,44 @@ +import java.util.Arrays; +import java.util.Comparator; + +public class arraysort +{ + private static final Comparator STRING_COMPARATOR = new Comparator() + { + public int compare(String str1, String str2) + { + return str1.compareTo(str2); + } + }; + + static void dumpArray(String[] strings) + { + int i; + + for (i = 0 ; i < strings.length ; i++) + { + System.out.println("[" + i + "] " + strings[i]); + } + } + + public static void main(String[] args) + { + String[] strings; + + strings = new String[4]; + + strings[0] = "a"; + strings[1] = "c"; + strings[2] = "b"; + strings[3] = "d"; + + System.out.println("Array of string, before:"); + dumpArray(strings); + + Arrays.sort(strings, STRING_COMPARATOR); + + System.out.println("Array of string, after:"); + dumpArray(strings); + } +} + diff --git a/libjava/testsuite/libjava.jar/arraysort.out b/libjava/testsuite/libjava.jar/arraysort.out new file mode 100644 index 00000000000..938ce9fd855 --- /dev/null +++ b/libjava/testsuite/libjava.jar/arraysort.out @@ -0,0 +1,10 @@ +Array of string, before: +[0] a +[1] c +[2] b +[3] d +Array of string, after: +[0] a +[1] b +[2] c +[3] d diff --git a/libjava/testsuite/libjava.jar/arraysort.xfail b/libjava/testsuite/libjava.jar/arraysort.xfail new file mode 100644 index 00000000000..2bbbe562517 --- /dev/null +++ b/libjava/testsuite/libjava.jar/arraysort.xfail @@ -0,0 +1 @@ +main=arraysort