|
1 /* |
|
2 * Copyright (c) 2015 SAP SE. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 /* @test |
|
25 * @bug 8139258 |
|
26 * @summary Regression test for 8139258 which failed to properly pass float args |
|
27 * to a jni function on ppc64le. |
|
28 * @run main/othervm -Xint Test15FloatJNIArgs |
|
29 * @run main/othervm -XX:+TieredCompilation -Xcomp Test15FloatJNIArgs |
|
30 * @run main/othervm -XX:-TieredCompilation -Xcomp Test15FloatJNIArgs |
|
31 */ |
|
32 |
|
33 public class Test15FloatJNIArgs { |
|
34 static { |
|
35 try { |
|
36 System.loadLibrary("Test15FloatJNIArgs"); |
|
37 } catch (UnsatisfiedLinkError e) { |
|
38 System.out.println("could not load native lib: " + e); |
|
39 } |
|
40 } |
|
41 |
|
42 public static native float add15floats( |
|
43 float f1, float f2, float f3, float f4, |
|
44 float f5, float f6, float f7, float f8, |
|
45 float f9, float f10, float f11, float f12, |
|
46 float f13, float f14, float f15); |
|
47 |
|
48 static void test() throws Exception { |
|
49 float sum = Test15FloatJNIArgs.add15floats(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, |
|
50 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); |
|
51 if (sum != 15.0f) { |
|
52 throw new Error("Passed 15 times 1.0f to jni function which didn't add them properly: " + sum); |
|
53 } |
|
54 } |
|
55 |
|
56 public static void main(String[] args) throws Exception { |
|
57 for (int i = 0; i < 200; ++i) { |
|
58 test(); |
|
59 } |
|
60 } |
|
61 } |