Path: blob/master/test/hotspot/jtreg/compiler/runtime/Test7088020.java
41152 views
/*1* Copyright (c) 2011, 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*/2223/**24* @test25* @bug 708802026* @summary SEGV in JNIHandleBlock::release_block27*28* @run main compiler.runtime.Test708802029*/3031package compiler.runtime;3233import java.lang.invoke.MethodHandle;34import java.lang.invoke.MethodHandles;35import java.lang.invoke.MethodType;36import java.lang.invoke.WrongMethodTypeException;3738public class Test7088020 {39public static boolean test() {40return false;41}4243public static void main(String... args) throws Throwable {44MethodHandle test = MethodHandles.lookup().findStatic(Test7088020.class, "test", MethodType.methodType(Boolean.TYPE));4546// Exercise WMT with different argument alignments47int thrown = 0;48try {49test.invokeExact(0);50} catch (WrongMethodTypeException wmt) {51thrown++;52if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");53}54try {55test.invokeExact(0, 1);56} catch (WrongMethodTypeException wmt) {57thrown++;58if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");59}60try {61test.invokeExact(0, 1, 2);62} catch (WrongMethodTypeException wmt) {63thrown++;64if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");65}66try {67test.invokeExact(0, 1, 2, 3);68} catch (WrongMethodTypeException wmt) {69thrown++;70if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");71}72try {73thrown++;74test.invokeExact(0, 1, 2, 3, 4);75} catch (WrongMethodTypeException wmt) {76if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");77}78if (thrown != 5) {79throw new InternalError("not enough throws");80}81}82}838485