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