Path: blob/master/test/hotspot/jtreg/compiler/calls/common/InvokeVirtual.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 InvokeVirtual instruction29*/3031public class InvokeVirtual extends CallsBase {32private static final Object LOCK = new Object();3334public static void main(String args[]) {35new InvokeVirtual().runTest(args);36}3738/**39* A native caller method, assumed to called "callee"/"calleeNative"40*/41@Override42public native void callerNative();4344/**45* A caller method, assumed to called "callee"/"calleeNative"46*/47@Override48public void caller() {49if (nativeCallee) {50Asserts.assertTrue(calleeNative(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);51} else {52Asserts.assertTrue(callee(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);53}54}5556/**57* A callee method, assumed to be called by "caller"/"callerNative"58*/59public boolean callee(int param1, long param2, float param3, double param4,60String param5) {61calleeVisited = true;62CallsBase.checkValues(param1, param2, param3, param4, param5);63return true;64}6566/**67* A native callee method, assumed to be called by "caller"/"callerNative"68*/69public native boolean calleeNative(int param1, long param2, float param3,70double param4, String param5);7172/**73* Returns object to lock execution on74* @return lock object75*/76@Override77protected Object getLockObject() {78return LOCK;79}80}818283