Path: blob/master/test/hotspot/jtreg/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java
41153 views
/*1* Copyright (c) 2016, 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* @bug 815603426* @requires vm.jvmci & !vm.graal.enabled & vm.compMode == "Xmixed" & vm.opt.TieredStopAtLevel == null27* @library / /test/lib28* @library ../common/patches29* @modules java.base/jdk.internal.misc30* java.base/jdk.internal.org.objectweb.asm31* java.base/jdk.internal.org.objectweb.asm.tree32* jdk.internal.vm.ci/jdk.vm.ci.hotspot33* jdk.internal.vm.ci/jdk.vm.ci.code34* jdk.internal.vm.ci/jdk.vm.ci.meta35* jdk.internal.vm.ci/jdk.vm.ci.runtime36* jdk.internal.vm.ci/jdk.vm.ci.services37*38* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper39* @build compiler.jvmci.common.JVMCIHelpers40* @run driver jdk.test.lib.FileInstaller ./JvmciNotifyBootstrapFinishedEventTest.config41* ./META-INF/services/jdk.vm.ci.services.JVMCIServiceLocator42* @run driver jdk.test.lib.helpers.ClassFileInstaller43* compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler44* compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory45* compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult46* compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener47* @run main/othervm -XX:+UnlockExperimentalVMOptions48* -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.49* -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:-UseJVMCINativeLibrary50* -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=false51* compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest52* @run main/othervm -XX:+UnlockExperimentalVMOptions53* -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.54* -XX:+UseJVMCICompiler -XX:+BootstrapJVMCI -XX:-UseJVMCINativeLibrary55* -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=true56* compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest57*/5859package compiler.jvmci.events;6061import jdk.test.lib.Asserts;62import jdk.vm.ci.services.JVMCIServiceLocator;63import jdk.vm.ci.hotspot.HotSpotVMEventListener;6465public class JvmciNotifyBootstrapFinishedEventTest extends JVMCIServiceLocator implements HotSpotVMEventListener {66private static final boolean BOOTSTRAP = Boolean67.getBoolean("compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap");68private static volatile int gotBoostrapNotification = 0;6970public static void main(String args[]) {71if (BOOTSTRAP) {72Asserts.assertEQ(gotBoostrapNotification, 1, "Did not receive expected number of bootstrap events");73} else {74Asserts.assertEQ(gotBoostrapNotification, 0, "Got unexpected bootstrap event");75}76}7778@Override79public <S> S getProvider(Class<S> service) {80if (service == HotSpotVMEventListener.class) {81return service.cast(this);82}83return null;84}8586@Override87public void notifyBootstrapFinished() {88gotBoostrapNotification++;89}90}919293