Path: blob/master/test/hotspot/jtreg/compiler/calls/common/InvokeSpecial.java
41153 views
/*1* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package compiler.calls.common;2425import jdk.test.lib.Asserts;2627/**28* A test class checking InvokeSpecial instruction29*/30public class InvokeSpecial extends CallsBase {31private static final Object LOCK = new Object();3233public static void main(String args[]) {34new InvokeSpecial().runTest(args);35}3637/**38* A native caller method, assumed to called "callee"/"calleeNative"39*/40@Override41public native void callerNative();4243/**44* A caller method, assumed to called "callee"/"calleeNative"45*/46@Override47public void caller() {48if (nativeCallee) {49Asserts.assertTrue(calleeNative(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);50} else {51Asserts.assertTrue(callee(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);52}53}5455/**56* A callee method, assumed to be called by "caller"/"callerNative"57*/58private boolean callee(int param1, long param2, float param3, double param4,59String param5) {60calleeVisited = true;61CallsBase.checkValues(param1, param2, param3, param4, param5);62return true;63}6465/**66* A native callee method, assumed to be called by "caller"/"callerNative"67*/68public native boolean calleeNative(int param1, long param2, float param3,69double param4, String param5);7071/**72* Returns object to lock execution on73* @return lock object74*/75@Override76protected Object getLockObject() {77return LOCK;78}79}808182