author | iignatyev |
Mon, 18 Feb 2019 09:31:07 -0800 | |
changeset 53791 | bec6c8739833 |
parent 51573 | 3b3685479784 |
permissions | -rw-r--r-- |
51573
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
1 |
/* |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, 2016 SAP SE. All rights reserved. |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
3 |
* Copyright (c) 2018 Red Hat, Inc. All rights reserved. |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
5 |
* |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
9 |
* |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
14 |
* accompanied this code). |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
15 |
* |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License version |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
19 |
* |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
22 |
* questions. |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
23 |
*/ |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
24 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
25 |
/* @test |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
26 |
* @bug 8207838 |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
27 |
* @summary Regression test for passing float args to a synchronized jni function. |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
28 |
* |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
29 |
* |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
30 |
* @run main/othervm/native compiler.floatingpoint.TestFloatSyncJNIArgs |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
31 |
*/ |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
32 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
33 |
package compiler.floatingpoint; |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
34 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
35 |
public class TestFloatSyncJNIArgs { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
36 |
static { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
37 |
try { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
38 |
System.loadLibrary("TestFloatSyncJNIArgs"); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
39 |
} catch (UnsatisfiedLinkError e) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
40 |
System.out.println("could not load native lib: " + e); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
41 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
42 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
43 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
44 |
private static final int numberOfThreads = 8; |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
45 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
46 |
static volatile Error testFailed = null; |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
47 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
48 |
public synchronized static native float combine15floats( |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
49 |
float f1, float f2, float f3, float f4, |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
50 |
float f5, float f6, float f7, float f8, |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
51 |
float f9, float f10, float f11, float f12, |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
52 |
float f13, float f14, float f15); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
53 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
54 |
public synchronized static native double combine15doubles( |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
55 |
double d1, double d2, double d3, double d4, |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
56 |
double d5, double d6, double d7, double d8, |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
57 |
double d9, double d10, double d11, double d12, |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
58 |
double d13, double d14, double d15); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
59 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
60 |
static void test() throws Exception { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
61 |
Thread[] threads = new Thread[numberOfThreads]; |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
62 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
63 |
for (int i = 0; i < numberOfThreads; i++) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
64 |
threads[i] = new Thread(() -> { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
65 |
for (int j = 0; j < 10000; j++) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
66 |
float f = combine15floats(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
67 |
9, 10, 11, 12, 13, 14, 15); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
68 |
if (f != 81720.0f) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
69 |
testFailed = new Error("jni function didn't combine 15 float args properly: " + f); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
70 |
throw testFailed; |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
71 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
72 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
73 |
}); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
74 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
75 |
for (int i = 0; i < numberOfThreads; i++) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
76 |
threads[i].start(); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
77 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
78 |
for (int i = 0; i < numberOfThreads; i++) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
79 |
threads[i].join(); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
80 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
81 |
if (testFailed != null) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
82 |
throw testFailed; |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
83 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
84 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
85 |
for (int i = 0; i < numberOfThreads; i++) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
86 |
threads[i] = new Thread(() -> { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
87 |
for (int j = 0; j < 10000; j++) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
88 |
double d = combine15doubles(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
89 |
9, 10, 11, 12, 13, 14, 15); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
90 |
if (d != 81720.0) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
91 |
testFailed = new Error("jni function didn't combine 15 double args properly: " + d); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
92 |
throw testFailed; |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
93 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
94 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
95 |
}); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
96 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
97 |
for (int i = 0; i < numberOfThreads; i++) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
98 |
threads[i].start(); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
99 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
100 |
for (int i = 0; i < numberOfThreads; i++) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
101 |
threads[i].join(); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
102 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
103 |
if (testFailed != null) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
104 |
throw testFailed; |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
105 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
106 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
107 |
|
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
108 |
public static void main(String[] args) throws Exception { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
109 |
for (int i = 0; i < 200; ++i) { |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
110 |
test(); |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
111 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
112 |
} |
3b3685479784
8207838: AArch64: Float registers incorrectly restored in JNI call
aph
parents:
diff
changeset
|
113 |
} |