From 845a4b727a88af8f4008e24e1a02ce49607bd91a Mon Sep 17 00:00:00 2001 From: Matthew Fortune Date: Wed, 13 Jul 2016 21:34:35 +0000 Subject: [PATCH] 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 --- libjava/ChangeLog | 8 ++++ libjava/interpret-run.cc | 2 +- libjava/testsuite/libjava.jar/arraysort.jar | Bin 0 -> 1864 bytes libjava/testsuite/libjava.jar/arraysort.java | 44 ++++++++++++++++++ libjava/testsuite/libjava.jar/arraysort.out | 10 ++++ libjava/testsuite/libjava.jar/arraysort.xfail | 1 + 6 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 libjava/testsuite/libjava.jar/arraysort.jar create mode 100644 libjava/testsuite/libjava.jar/arraysort.java create mode 100644 libjava/testsuite/libjava.jar/arraysort.out create mode 100644 libjava/testsuite/libjava.jar/arraysort.xfail 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 0000000000000000000000000000000000000000..ee051e45a836f99563e3e15ce748795d01e87e4e GIT binary patch literal 1864 zcmWIWW@h1H00Eo28y;W=l;C8LVeoYgan$wnbJGtE;bdT59F`k?28c^5xEUB(K+3>G z0MG~#AcuqDY3&Vhc|A-l0JQ1!kM^U9M!>OsNp&~w^S#_!D?W9NbpB}La^B>!6 zf679aMLA>g&6#s+KR(F@shrQeTEeQ8w}Z?^h=dPVkenOk>e|0rMi-+iCS#$T&; zxb+?@$^5Q+eCgY*AKuMvY}5IuFJ*KjdYf*_eb%V2AOY9rgI(hadp)!}ML_B6{E_pAF8h>l&Hv~Th#@!2G-0~yG9}%$^ zeA`brP$af}+PN(~Q~1icBJwUtiwKBj>~#=bGtFDV$*IHe@;8UJEyia{vJUOGe>C}g z5|fLP`~&$P#;@#{rzvdpe4g^{X7<~y-{U?%zP{a?Ve^ei7Y;qRo*QkyE^?dl!P6HC zm(*VfPQ7d6lPlI&aWRo2)B5(#-mTwnp8dM^>D#As&*rwx+cP`7yr)PjJ9O2qwbs+- zs#%@2FezQ0SKL-{d5O=zWi8Kcv{lZib91l^){$QJ&?fnVOY&}>duu`;3B5DiVye=2 zo^64`iUrJ!Z1Klfe;iz(mC@R-IK$j$U*LL?9eWpxpR!@#Z(6b{WPQkVR&LM!clSdD zZhu|O&n)ySzt_Qfo#mcI3O$aKQm_kD!*)g{N%TBRDxb7|=4GQK9^Lm!Ofv;es2mP4 ze)r#qU%4})!c`Zd%OFq zppy}cCcZE-DiKM&a4pjD7`K&|QJBQ9JGriFnmx|4swlJ8CETphbhur&a)GohUx ze!fI;)CNNh%gay7wyn9IwWm#R(yN93y@?JxCi`{Xi&8l3U2pHAohveP$&4RcV;yc< zJO2)E*|%eZUlrS((_vPv=dGm{C|b?j(K&zNYqh)2*;ws;Us#p4-(x-5qyAZPvigg? z2QJL3`p={MFt}&+#o!~4A6iz;OL`@;SzeO+xW4`0f0c(<2{B*rGirLWv8>3ujp15TQQ3}(bI-p4F)_62ligDPYK!J$}aBC zdhnoU0l(Bj1x*#fkKbQa6&M#;dFZZDnPpUd;mEDsjvT$;F4)^|+1QpOq7?Bd(VXkx z4E=i-_XQq260Ng$wqc=!U&vbq*AEwUp3N=S5AbGWl4HhIyh{LG4FUoTZyiB2Qen>u zDeN%{dXRCrih7uF3=B&eoq@(-DfofLf(m{D#-f%$$i^}Q%O$w6u=0qop_owxF%(!! f0o|(4isW^ah{F{MtZbm*VgbTXpb>Y0`WYAikEqBO literal 0 HcmV?d00001 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 -- 2.30.2