Fix the use of FFI closures in the java interpreter for integer returns
authorMatthew Fortune <matthew.fortune@imgtec.com>
Wed, 13 Jul 2016 21:34:35 +0000 (21:34 +0000)
committerMatthew Fortune <mpf@gcc.gnu.org>
Wed, 13 Jul 2016 21:34:35 +0000 (21:34 +0000)
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

libjava/ChangeLog
libjava/interpret-run.cc
libjava/testsuite/libjava.jar/arraysort.jar [new file with mode: 0644]
libjava/testsuite/libjava.jar/arraysort.java [new file with mode: 0644]
libjava/testsuite/libjava.jar/arraysort.out [new file with mode: 0644]
libjava/testsuite/libjava.jar/arraysort.xfail [new file with mode: 0644]

index a3bead2fa9abc77b2dcaba86d4fd99783b51c438..06b354d7777cbdedac8d3b8f7254fb385eab9e1d 100644 (file)
@@ -1,3 +1,11 @@
+2016-07-13  Matthew Fortune  <matthew.fortune@imgtec.com>
+
+       * 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  <doko@ubuntu.com>
 
        * libtool-version: Bump soversion.
index a4c2d4dab43b614543070e7739661d1cfa21a54c..6be354eaf5ef7f33ac2e52fa590a7198b53b516e 100644 (file)
@@ -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 (file)
index 0000000..ee051e4
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 (file)
index 0000000..56c181d
--- /dev/null
@@ -0,0 +1,44 @@
+import java.util.Arrays;
+import java.util.Comparator;
+
+public class arraysort
+{
+  private static final Comparator<String> STRING_COMPARATOR = new Comparator<String>()
+  {
+    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 (file)
index 0000000..938ce9f
--- /dev/null
@@ -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 (file)
index 0000000..2bbbe56
--- /dev/null
@@ -0,0 +1 @@
+main=arraysort