Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/verifier/VerifyInitLocal/VerifyInitLocal.java
41159 views
/*1* Copyright (c) 2008, 2020, 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*26* @summary converted from VM Testbase jit/verifier/VerifyInitLocal.27* VM Testbase keywords: [jit, quick]28*29* @library /vmTestbase30* /test/lib31* @compile VerifyInitLocal1P.jasm32* @compile VerifyInitLocal2N.jasm33* @compile VerifyInitLocal3N.jasm34* @run main/othervm jit.verifier.VerifyInitLocal.VerifyInitLocal35*/3637package jit.verifier.VerifyInitLocal;3839import nsk.share.TestFailure;4041/**42* @(#)VerifyInitLocal.java 1.1 01/03/1543* @bug 440826144* @summary Make sure verifier allows initialization of local fields.45*/4647public abstract class VerifyInitLocal {48static final boolean debug = true;49public static void main(String[] args) throws Exception {50String[] classes = { "jit.verifier.VerifyInitLocal.VerifyInitLocal1P",51"jit.verifier.VerifyInitLocal.VerifyInitLocal2N",52"jit.verifier.VerifyInitLocal.VerifyInitLocal3N" };53for (int i = 0; i < classes.length; i++) {54boolean is_neg = classes[i].endsWith("N");55try {56if (debug) System.out.println(classes[i]);57Class.forName(classes[i]).newInstance();58if (is_neg) {59throw new TestFailure("shouldn't successfully verify " +60classes[i]);61}62} catch (VerifyError e) {63if (!is_neg) {64System.out.println(e);65throw new TestFailure("should successfully verify " +66classes[i]);67}68if (debug) System.out.println(e);69}70}71}7273// Superclass stuff for tests to inherit from:74protected boolean touch_me_not;75VerifyInitLocal() {76if (!verify()) {77throw new TestFailure("verify()==false in " + getClass());78}79}80public abstract boolean verify();81}828384