Path: blob/master/test/hotspot/jtreg/compiler/calls/common/InvokeInterface.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 InvokeInterface instruction29*/30public class InvokeInterface extends CallsBase implements CallInterface {31private static final Object LOCK = new Object();3233public static void main(String args[]) {34new InvokeInterface().runTest(args);35}3637/**38* A caller method, assumed to called "callee"/"calleeNative"39*/40@Override41public void caller() {42// cast to CallInterface to force invokeinterface usage43if (nativeCallee) {44Asserts.assertTrue(((CallInterface) this)45.calleeNative(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);46} else {47Asserts.assertTrue(((CallInterface) this)48.callee(1, 2L, 3.0f, 4.0d, "5"), CALL_ERR_MSG);49}50}5152/**53* A callee method, assumed to be called by "caller"/"callerNative"54*/55@Override56public boolean callee(int param1, long param2, float param3, double param4,57String param5) {58calleeVisited = true;59CallsBase.checkValues(param1, param2, param3, param4, param5);60return true;61}6263/**64* A native callee method, assumed to be called by "caller"/"callerNative"65*/66@Override67public native boolean calleeNative(int param1, long param2, float param3,68double param4, String param5);6970/**71* Returns object to lock execution on72* @return lock object73*/74@Override75protected Object getLockObject() {76return LOCK;77}7879@Override80protected void callerNative() {81throw new Error("No native call for invokeinterface");82}83}848586