hotspot/test/compiler/calls/common/InvokeSpecial.java
author dsamersoff
Sun, 01 May 2016 12:47:00 +0300
changeset 38152 80e5da81fb2c
parent 35128 bb8baf284c67
permissions -rw-r--r--
8154258: [TESTBUG] Various serviceability tests fail compilation Summary: Replace sun.misc.Unsafe with jdk.internal.misc.Unsafe Reviewed-by: chegar, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35128
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
     1
/*
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
     4
 *
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
     8
 *
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    13
 * accompanied this code).
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    14
 *
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    18
 *
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    21
 * questions.
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    22
 */
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    23
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    24
package compiler.calls.common;
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    25
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    26
import jdk.test.lib.Asserts;
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    27
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    28
/**
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    29
 * A test class checking InvokeSpecial instruction
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    30
 */
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    31
public class InvokeSpecial extends CallsBase {
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    32
    private static final Object LOCK = new Object();
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    33
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    34
    public static void main(String args[]) {
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    35
        new InvokeSpecial().runTest(args);
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    36
    }
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    37
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    38
    /**
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    39
     * A native caller method, assumed to called "callee"/"calleeNative"
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    40
     */
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    41
    @Override
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    42
    public native void callerNative();
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    43
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    44
    /**
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    45
     * A caller method, assumed to called "callee"/"calleeNative"
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    46
     */
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    47
    @Override
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    48
    public void caller() {
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    49
        if (nativeCallee) {
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    50
            Asserts.assertTrue(calleeNative(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    51
        } else {
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    52
            Asserts.assertTrue(callee(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    53
        }
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    54
    }
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    55
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    56
    /**
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    57
     * A callee method, assumed to be called by "caller"/"callerNative"
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    58
     */
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    59
    private boolean callee(int param1, long param2, float param3, double param4,
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    60
            String param5) {
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    61
        calleeVisited = true;
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    62
        CallsBase.checkValues(param1, param2, param3, param4, param5);
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    63
        return true;
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    64
    }
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    65
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    66
    /**
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    67
     * A native callee method, assumed to be called by "caller"/"callerNative"
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    68
     */
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    69
    public native boolean calleeNative(int param1, long param2, float param3,
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    70
            double param4, String param5);
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    71
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    72
    /**
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    73
     * Returns object to lock execution on
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    74
     * @return lock object
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    75
     */
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    76
    @Override
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    77
    protected Object getLockObject() {
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    78
        return LOCK;
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    79
    }
bb8baf284c67 8141351: Create tests for direct invoke instructions testing
dpochepk
parents:
diff changeset
    80
}