hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java
author sspitsyn
Wed, 03 May 2017 02:32:02 +0000
changeset 46426 02a1fc064144
parent 43972 1ade39b8381b
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39249
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
     1
/*
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
     4
 *
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
     8
 *
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    13
 * accompanied this code).
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    14
 *
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    18
 *
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    21
 * questions.
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    22
 */
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    23
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    24
/**
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    25
 * @test
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    26
 * @bug 8156034
42607
acd91f1875d4 8170227: use vm.jvmci property in compiler/jvmci tests
iignatyev
parents: 41725
diff changeset
    27
 * @requires vm.jvmci
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40081
diff changeset
    28
 * @library / /test/lib
39249
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    29
 * @library ../common/patches
39266
be8d2fb376bd 8158351: [JVMCI] NoClassDefFoundError: jdk/vm/ci/runtime/JVMCI
dnsimon
parents: 39249
diff changeset
    30
 * @modules java.base/jdk.internal.misc
40053
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    31
 *          java.base/jdk.internal.org.objectweb.asm
39249
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    32
 *          java.base/jdk.internal.org.objectweb.asm.tree
43972
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    33
 *          jdk.internal.vm.ci/jdk.vm.ci.hotspot
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    34
 *          jdk.internal.vm.ci/jdk.vm.ci.code
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    35
 *          jdk.internal.vm.ci/jdk.vm.ci.meta
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    36
 *          jdk.internal.vm.ci/jdk.vm.ci.runtime
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    37
 *          jdk.internal.vm.ci/jdk.vm.ci.services
40053
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    38
 *
43972
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    39
 * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
39249
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    40
 * @build compiler.jvmci.common.JVMCIHelpers
40053
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    41
 * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyBootstrapFinishedEventTest.config
41725
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    42
 *     ./META-INF/services/jdk.vm.ci.services.JVMCIServiceLocator
40053
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    43
 * @run driver ClassFileInstaller
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    44
 *      compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    45
 *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    46
 *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    47
 *      compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
40081
50be9fe0e9c2 8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents: 40053
diff changeset
    48
 * @run main/othervm -XX:+UnlockExperimentalVMOptions
39249
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    49
 *     -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    50
 *     -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    51
 *     -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=false
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    52
 *     compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
40081
50be9fe0e9c2 8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents: 40053
diff changeset
    53
 * @run main/othervm -XX:+UnlockExperimentalVMOptions
39249
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    54
 *     -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    55
 *     -XX:+UseJVMCICompiler -XX:+BootstrapJVMCI
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    56
 *     -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=true
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    57
 *     compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    58
 */
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    59
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    60
package compiler.jvmci.events;
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    61
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    62
import jdk.test.lib.Asserts;
41725
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    63
import jdk.vm.ci.services.JVMCIServiceLocator;
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    64
import jdk.vm.ci.hotspot.HotSpotVMEventListener;
39249
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    65
41725
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    66
public class JvmciNotifyBootstrapFinishedEventTest extends JVMCIServiceLocator implements HotSpotVMEventListener {
39249
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    67
    private static final boolean BOOTSTRAP = Boolean
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    68
            .getBoolean("compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap");
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    69
    private static volatile int gotBoostrapNotification = 0;
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    70
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    71
    public static void main(String args[]) {
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    72
        if (BOOTSTRAP) {
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    73
            Asserts.assertEQ(gotBoostrapNotification, 1, "Did not receive expected number of bootstrap events");
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    74
        } else {
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    75
            Asserts.assertEQ(gotBoostrapNotification, 0, "Got unexpected bootstrap event");
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    76
        }
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    77
    }
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    78
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    79
    @Override
41725
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    80
    public <S> S getProvider(Class<S> service) {
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    81
        if (service == HotSpotVMEventListener.class) {
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    82
            return service.cast(this);
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    83
        }
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    84
        return null;
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    85
    }
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    86
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    87
    @Override
39249
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    88
    public void notifyBootstrapFinished() {
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    89
        gotBoostrapNotification++;
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    90
    }
f1572aba14f2 8157292: [JVMCI] add missing test files from 8156034
never
parents:
diff changeset
    91
}