Path: blob/master/test/hotspot/jtreg/compiler/calls/common/InvokeStatic.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 InvokeStatic instruction29*/30public class InvokeStatic extends CallsBase {31private static final Object LOCK = new Object();3233public static void main(String args[]) {34new InvokeStatic().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(this, 1, 2L, 3.0f, 4.0d, "5"),50CALL_ERR_MSG);51} else {52Asserts.assertTrue(callee(this, 1, 2L, 3.0f, 4.0d, "5"),53CALL_ERR_MSG);54}55}5657/**58* A callee method, assumed to be called by "caller"/"callerNative"59*/60public static boolean callee(InvokeStatic instance, int param1,61long param2, float param3, double param4, String param5) {62instance.calleeVisited = true;63CallsBase.checkValues(param1, param2, param3, param4, param5);64return true;65}6667/**68* A native callee method, assumed to be called by "caller"/"callerNative"69*/70public static native boolean calleeNative(InvokeStatic instance,71int param1, long param2, float param3, double param4, String param5);7273/**74* Returns object to lock execution on75* @return lock object76*/77@Override78protected Object getLockObject() {79return LOCK;80}8182/**83* Provides callee parameters types to search method84* @return array of types85*/86protected Class[] getCalleeParametersTypes() {87return new Class[]{InvokeStatic.class, int.class, long.class,88float.class, double.class, String.class};89}90}919293