test/hotspot/jtreg/compiler/jvmci/events/JvmciNotifyInstallEventTest.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 55295 14283f280695
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     1
/*
54669
ad45b3802d4e 8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents: 47216
diff changeset
     2
 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     4
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     8
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    13
 * accompanied this code).
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    14
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    18
 *
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    21
 * questions.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    22
 */
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    23
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    24
/*
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    25
 * @test
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    26
 * @bug 8136421
55295
14283f280695 8225350: compiler/jvmci/compilerToVM/IsCompilableTest.java timed out
kvn
parents: 55272
diff changeset
    27
 * @requires vm.jvmci & !vm.graal.enabled & vm.compMode == "Xmixed"
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40081
diff changeset
    28
 * @library / /test/lib
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35823
diff changeset
    29
 * @library ../common/patches
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 37285
diff changeset
    30
 * @modules java.base/jdk.internal.misc
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35823
diff changeset
    31
 * @modules java.base/jdk.internal.org.objectweb.asm
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35823
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.code.site
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    36
 *          jdk.internal.vm.ci/jdk.vm.ci.meta
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    37
 *          jdk.internal.vm.ci/jdk.vm.ci.runtime
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    38
 *          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
    39
 *
43972
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents: 42607
diff changeset
    40
 * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    41
 * @build compiler.jvmci.common.JVMCIHelpers
40053
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    42
 * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config
41725
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    43
 *     ./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
    44
 * @run driver ClassFileInstaller
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    45
 *      compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    46
 *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
b3617982544e 8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents: 40034
diff changeset
    47
 *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40081
diff changeset
    48
 *      compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
40081
50be9fe0e9c2 8161265: [JVMCI] EnableJVMCI should only be required when its not implied by other flags
dnsimon
parents: 40059
diff changeset
    49
 * @run main/othervm -XX:+UnlockExperimentalVMOptions
55295
14283f280695 8225350: compiler/jvmci/compilerToVM/IsCompilableTest.java timed out
kvn
parents: 55272
diff changeset
    50
 *     -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
44836
45196b7066e3 8177845: Need a mechanism to load Graal
dnsimon
parents: 43972
diff changeset
    51
 *     -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    52
 *     compiler.jvmci.events.JvmciNotifyInstallEventTest
44836
45196b7066e3 8177845: Need a mechanism to load Graal
dnsimon
parents: 43972
diff changeset
    53
 * @run main/othervm -XX:+UnlockExperimentalVMOptions
55295
14283f280695 8225350: compiler/jvmci/compilerToVM/IsCompilableTest.java timed out
kvn
parents: 55272
diff changeset
    54
 *     -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
44836
45196b7066e3 8177845: Need a mechanism to load Graal
dnsimon
parents: 43972
diff changeset
    55
 *     -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:JVMCINMethodSizeLimit=0
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    56
 *     compiler.jvmci.events.JvmciNotifyInstallEventTest
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    57
 */
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    58
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    59
package compiler.jvmci.events;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    60
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    61
import compiler.jvmci.common.CTVMUtilities;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    62
import compiler.jvmci.common.testcases.SimpleClass;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    63
import jdk.test.lib.Asserts;
37285
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
    64
import jdk.test.lib.Utils;
41725
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    65
import jdk.vm.ci.services.JVMCIServiceLocator;
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35148
diff changeset
    66
import jdk.vm.ci.code.CompiledCode;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    67
import jdk.vm.ci.code.InstalledCode;
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35148
diff changeset
    68
import jdk.vm.ci.code.site.DataPatch;
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35148
diff changeset
    69
import jdk.vm.ci.code.site.Site;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    70
import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35148
diff changeset
    71
import jdk.vm.ci.hotspot.HotSpotCompiledCode;
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35148
diff changeset
    72
import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment;
54669
ad45b3802d4e 8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents: 47216
diff changeset
    73
import jdk.vm.ci.hotspot.HotSpotCompiledNmethod;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    74
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33160
diff changeset
    75
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
41725
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    76
import jdk.vm.ci.hotspot.HotSpotVMEventListener;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40055
diff changeset
    77
import jdk.vm.ci.meta.Assumptions.Assumption;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40055
diff changeset
    78
import jdk.vm.ci.meta.ResolvedJavaMethod;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40055
diff changeset
    79
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 40055
diff changeset
    80
import java.lang.reflect.Method;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    81
41725
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    82
public class JvmciNotifyInstallEventTest extends JVMCIServiceLocator implements HotSpotVMEventListener {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    83
    private static final String METHOD_NAME = "testMethod";
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    84
    private static volatile int gotInstallNotification = 0;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    85
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    86
    public static void main(String args[]) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    87
        new JvmciNotifyInstallEventTest().runTest();
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    88
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    89
41725
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    90
    @Override
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    91
    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
    92
        if (service == HotSpotVMEventListener.class) {
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    93
            return service.cast(this);
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    94
        }
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    95
        return null;
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    96
    }
5aef0bf3bef7 8167180: [JVMCI] Exported elements referring to inaccessible types in jdk.vm.ci
dnsimon
parents: 40631
diff changeset
    97
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    98
    private void runTest() {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
    99
        if (gotInstallNotification != 0) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   100
            throw new Error("Got install notification before test actions");
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   101
        }
37285
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   102
        HotSpotCodeCacheProvider codeCache;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   103
        try {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   104
            codeCache = (HotSpotCodeCacheProvider) HotSpotJVMCIRuntime.runtime()
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   105
                    .getHostJVMCIBackend().getCodeCache();
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   106
        } catch (InternalError ie) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   107
            // passed
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   108
            return;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   109
        }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   110
        Method testMethod;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   111
        try {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   112
            testMethod = SimpleClass.class.getDeclaredMethod(METHOD_NAME);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   113
        } catch (NoSuchMethodException e) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   114
            throw new Error("TEST BUG: Can't find " + METHOD_NAME, e);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   115
        }
33632
038347770a9e 8139170: JVMCI refresh
twisti
parents: 33160
diff changeset
   116
        HotSpotResolvedJavaMethod method = CTVMUtilities
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   117
                .getResolvedMethod(SimpleClass.class, testMethod);
54669
ad45b3802d4e 8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents: 47216
diff changeset
   118
        HotSpotCompiledCode compiledCode = new HotSpotCompiledNmethod(METHOD_NAME,
37285
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   119
                new byte[0], 0, new Site[0], new Assumption[0],
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   120
                new ResolvedJavaMethod[]{method}, new Comment[0], new byte[0],
54669
ad45b3802d4e 8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents: 47216
diff changeset
   121
                16, new DataPatch[0], false, 0, null,
ad45b3802d4e 8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents: 47216
diff changeset
   122
                method, 0, 1, 0L, false);
37285
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   123
        codeCache.installCode(method, compiledCode, /* installedCode = */ null,
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   124
                /* speculationLog = */ null, /* isDefault = */ false);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   125
        Asserts.assertEQ(gotInstallNotification, 1,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   126
                "Got unexpected event count after 1st install attempt");
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   127
        // since "empty" compilation result is ok, a second attempt should be ok
37285
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   128
        codeCache.installCode(method, compiledCode, /* installedCode = */ null,
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   129
                /* speculationLog = */ null, /* isDefault = */ false);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   130
        Asserts.assertEQ(gotInstallNotification, 2,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   131
                "Got unexpected event count after 2nd install attempt");
37285
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   132
        // and an incorrect cases
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   133
        Utils.runAndCheckException(() -> {
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   134
            codeCache.installCode(method, null, null, null, true);
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   135
        }, NullPointerException.class);
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   136
        Asserts.assertEQ(gotInstallNotification, 2,
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   137
                "Got unexpected event count after 3rd install attempt");
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   138
        Utils.runAndCheckException(() -> {
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   139
            codeCache.installCode(null, null, null, null, true);
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   140
        }, NullPointerException.class);
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   141
        Asserts.assertEQ(gotInstallNotification, 2,
0473a5a36212 8138798: improve tests for HotSpotVMEventListener::notifyInstall
dpochepk
parents: 36508
diff changeset
   142
                "Got unexpected event count after 4th install attempt");
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   143
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   144
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   145
    @Override
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   146
    public void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider,
35582
c32a0cc19877 8147599: [JVMCI] simplify code installation interface
rschatz
parents: 35148
diff changeset
   147
            InstalledCode installedCode, CompiledCode compiledCode) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   148
        gotInstallNotification++;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   149
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
diff changeset
   150
}