test/hotspot/jtreg/compiler/jsr292/NonInlinedCall/InvokeTest.java
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 55301 a9188ba494a3
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
     1
/*
55301
a9188ba494a3 8149040: Cleanup compiler/jsr292/NonInlinedCall tests after JDK-8148994
iignatyev
parents: 53509
diff changeset
     2
 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
     4
 *
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
     8
 *
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    13
 * accompanied this code).
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    14
 *
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    18
 *
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    21
 * questions.
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    22
 */
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    23
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    24
/*
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    25
 * @test
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    26
 * @bug 8072008
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    27
 * @library /test/lib / ../patches
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 36508
diff changeset
    28
 * @modules java.base/jdk.internal.misc
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38207
diff changeset
    29
 *          java.base/jdk.internal.vm.annotation
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38207
diff changeset
    30
 *
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    31
 * @build java.base/java.lang.invoke.MethodHandleHelper
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38207
diff changeset
    32
 *        sun.hotspot.WhiteBox
38188
e76af590ea2f 8155751: Some tests miss othervm for main/bootclasspath mode
vlivanov
parents: 38152
diff changeset
    33
 * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions
e76af590ea2f 8155751: Some tests miss othervm for main/bootclasspath mode
vlivanov
parents: 38152
diff changeset
    34
 *                                 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
e76af590ea2f 8155751: Some tests miss othervm for main/bootclasspath mode
vlivanov
parents: 38152
diff changeset
    35
 *                                 -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1
e76af590ea2f 8155751: Some tests miss othervm for main/bootclasspath mode
vlivanov
parents: 38152
diff changeset
    36
 *                                 compiler.jsr292.NonInlinedCall.InvokeTest
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    37
 */
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    38
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    39
package compiler.jsr292.NonInlinedCall;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    40
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38207
diff changeset
    41
import jdk.internal.vm.annotation.DontInline;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38207
diff changeset
    42
import sun.hotspot.WhiteBox;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38207
diff changeset
    43
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    44
import java.lang.invoke.MethodHandle;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    45
import java.lang.invoke.MethodHandleHelper;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    46
import java.lang.invoke.MethodHandles;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    47
import java.lang.invoke.MethodType;
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    48
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38207
diff changeset
    49
import static jdk.test.lib.Asserts.assertEquals;
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    50
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    51
public class InvokeTest {
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 36331
diff changeset
    52
    static MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    53
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
    54
    static final MethodHandle virtualMH; // invokevirtual   T.f1
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
    55
    static final MethodHandle staticMH;  // invokestatic    T.f2
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
    56
    static final MethodHandle intfMH;    // invokeinterface I.f3
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
    57
    static final MethodHandle defaultMH; // invokevirtual   T.f3
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
    58
    static final MethodHandle specialMH; // invokespecial   T.f4 T
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
    59
    static final MethodHandle privateMH; // invokespecial   I.f4 T
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    60
53509
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
    61
    static final MethodHandle intrinsicMH; // invokevirtual Object.hashCode
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
    62
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    63
    static final WhiteBox WB = WhiteBox.getWhiteBox();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    64
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    65
    static volatile boolean doDeopt = false;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    66
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    67
    static {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    68
        try {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    69
            MethodType mtype = MethodType.methodType(Class.class);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    70
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    71
            virtualMH  = LOOKUP.findVirtual(T.class, "f1", mtype);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    72
            staticMH   = LOOKUP.findStatic (T.class, "f2", mtype);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    73
            intfMH     = LOOKUP.findVirtual(I.class, "f3", mtype);
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
    74
            defaultMH  = LOOKUP.findVirtual(T.class, "f3", mtype);
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    75
            specialMH  = LOOKUP.findSpecial(T.class, "f4", mtype, T.class);
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
    76
            privateMH  = LOOKUP.findSpecial(I.class, "f4", mtype, I.class);
53509
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
    77
            intrinsicMH = LOOKUP.findVirtual(Object.class, "hashCode", MethodType.methodType(int.class));
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    78
        } catch (Exception e) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    79
            throw new Error(e);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    80
        }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    81
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    82
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    83
    static class T implements I {
35108
ccb4e1f2a6cf 8145137: Incorrect call signature can be used in nmethod::preserve_callee_argument_oops
vlivanov
parents: 35107
diff changeset
    84
        @DontInline public        Class<?> f1() { if (doDeopt) WB.deoptimizeAll(); return T.class; }
ccb4e1f2a6cf 8145137: Incorrect call signature can be used in nmethod::preserve_callee_argument_oops
vlivanov
parents: 35107
diff changeset
    85
        @DontInline public static Class<?> f2() { if (doDeopt) WB.deoptimizeAll(); return T.class; }
ccb4e1f2a6cf 8145137: Incorrect call signature can be used in nmethod::preserve_callee_argument_oops
vlivanov
parents: 35107
diff changeset
    86
        @DontInline private       Class<?> f4() { if (doDeopt) WB.deoptimizeAll(); return T.class; }
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    87
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    88
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    89
    static class P1 extends T {
35108
ccb4e1f2a6cf 8145137: Incorrect call signature can be used in nmethod::preserve_callee_argument_oops
vlivanov
parents: 35107
diff changeset
    90
        @DontInline public Class<?> f1() { if (doDeopt) WB.deoptimizeAll(); return P1.class; }
ccb4e1f2a6cf 8145137: Incorrect call signature can be used in nmethod::preserve_callee_argument_oops
vlivanov
parents: 35107
diff changeset
    91
        @DontInline public Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return P1.class; }
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    92
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    93
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    94
    static class P2 extends T {
35108
ccb4e1f2a6cf 8145137: Incorrect call signature can be used in nmethod::preserve_callee_argument_oops
vlivanov
parents: 35107
diff changeset
    95
        @DontInline public Class<?> f1() { if (doDeopt) WB.deoptimizeAll(); return P2.class; }
ccb4e1f2a6cf 8145137: Incorrect call signature can be used in nmethod::preserve_callee_argument_oops
vlivanov
parents: 35107
diff changeset
    96
        @DontInline public Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return P2.class; }
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    97
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
    98
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
    99
    interface I {
35108
ccb4e1f2a6cf 8145137: Incorrect call signature can be used in nmethod::preserve_callee_argument_oops
vlivanov
parents: 35107
diff changeset
   100
        @DontInline default Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return I.class; }
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   101
        @DontInline private Class<?> f4() { if (doDeopt) WB.deoptimizeAll(); return I.class; }
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   102
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   103
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   104
    interface J1 extends I {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   105
        @DontInline default Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return J1.class; }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   106
    }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   107
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   108
    interface J2 extends I {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   109
        @DontInline default Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return J2.class; }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   110
    }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   111
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   112
    interface J3 extends I {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   113
        @DontInline default Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return J3.class; }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   114
    }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   115
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   116
    static class Q1 extends T implements J1 {}
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   117
    static class Q2 extends T implements J2 {}
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   118
    static class Q3 extends T implements J3 {}
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   119
53509
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   120
    static class H {
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   121
        public int hashCode() { return 0; }
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   122
    }
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   123
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   124
    @DontInline
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   125
    static void linkToVirtual(T recv, Class<?> expected) {
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   126
        try {
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   127
            Class<?> cls = (Class<?>)virtualMH.invokeExact(recv);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   128
            assertEquals(cls, expected);
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   129
        } catch (Throwable e) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   130
            throw new Error(e);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   131
        }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   132
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   133
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   134
    @DontInline
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   135
    static void linkToVirtualDefault(T recv, Class<?> expected) {
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   136
        try {
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   137
            Class<?> cls = (Class<?>)defaultMH.invokeExact(recv);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   138
            assertEquals(cls, expected);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   139
        } catch (Throwable e) {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   140
            throw new Error(e);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   141
        }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   142
    }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   143
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   144
    @DontInline
53509
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   145
    static void linkToVirtualIntrinsic(Object recv, int expected) {
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   146
        try {
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   147
            int v = (int)intrinsicMH.invokeExact(recv);
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   148
            assertEquals(v, expected);
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   149
        } catch (Throwable e) {
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   150
            throw new Error(e);
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   151
        }
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   152
    }
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   153
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   154
    @DontInline
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   155
    static void linkToInterface(I recv, Class<?> expected) {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   156
        try {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   157
            Class<?> cls = (Class<?>)intfMH.invokeExact(recv);
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   158
            assertEquals(cls, expected);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   159
        } catch (Throwable e) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   160
            throw new Error(e);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   161
        }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   162
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   163
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   164
    @DontInline
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   165
    static void linkToStatic() {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   166
        try {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   167
            Class<?> cls = (Class<?>)staticMH.invokeExact();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   168
            assertEquals(cls, T.class);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   169
        } catch (Throwable e) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   170
            throw new Error(e);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   171
        }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   172
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   173
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   174
    @DontInline
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   175
    static void linkToSpecial(T recv, Class<?> expected) {
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   176
        try {
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   177
            Class<?> cls = (Class<?>)specialMH.invokeExact(recv);
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   178
            assertEquals(cls, expected);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   179
        } catch (Throwable e) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   180
            throw new Error(e);
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   181
        }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   182
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   183
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   184
    @DontInline
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   185
    static void linkToSpecialIntf(I recv, Class<?> expected) {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   186
        try {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   187
            Class<?> cls = (Class<?>)privateMH.invokeExact(recv);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   188
            assertEquals(cls, expected);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   189
        } catch (Throwable e) {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   190
            throw new Error(e);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   191
        }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   192
    }
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   193
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   194
    static void run(Runnable r) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   195
        for (int i = 0; i < 20_000; i++) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   196
            r.run();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   197
        }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   198
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   199
        doDeopt = true;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   200
        r.run();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   201
        doDeopt = false;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   202
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   203
        WB.clearInlineCaches();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   204
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   205
        for (int i = 0; i < 20_000; i++) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   206
            r.run();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   207
        }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   208
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   209
        doDeopt = true;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   210
        r.run();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   211
        doDeopt = false;
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   212
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   213
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   214
    static void testVirtual() {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   215
        System.out.println("linkToVirtual");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   216
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   217
        // Monomorphic case (optimized virtual call)
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   218
        run(() -> linkToVirtual(new T(), T.class));
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   219
        run(() -> linkToVirtualDefault(new T(), I.class));
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   220
53509
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   221
        run(() -> linkToVirtualIntrinsic(new H(), 0));
28aa41c4165b 8217760: C2: Missing symbolic info on a call from intrinsics when invoked through MethodHandle
vlivanov
parents: 50449
diff changeset
   222
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   223
        // Megamorphic case (optimized virtual call)
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   224
        run(() -> {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   225
            linkToVirtual(new T() {}, T.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   226
            linkToVirtual(new T() {}, T.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   227
            linkToVirtual(new T() {}, T.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   228
        });
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   229
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   230
        run(() -> {
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   231
            linkToVirtualDefault(new T(){}, I.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   232
            linkToVirtualDefault(new T(){}, I.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   233
            linkToVirtualDefault(new T(){}, I.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   234
        });
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   235
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   236
        // Megamorphic case (virtual call), multiple implementations
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   237
        run(() -> {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   238
            linkToVirtual(new T(),  T.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   239
            linkToVirtual(new P1(), P1.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   240
            linkToVirtual(new P2(), P2.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   241
        });
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   242
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   243
        run(() -> {
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   244
            linkToVirtualDefault(new Q1(), J1.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   245
            linkToVirtualDefault(new Q2(), J2.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   246
            linkToVirtualDefault(new Q3(), J3.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   247
        });
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   248
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   249
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   250
    static void testInterface() {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   251
        System.out.println("linkToInterface");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   252
36331
eeeb86fd9922 8150436: Incorrect invocation mode when linkToInteface linker is eliminated
vlivanov
parents: 35108
diff changeset
   253
        // Monomorphic case (optimized virtual call), concrete target method
eeeb86fd9922 8150436: Incorrect invocation mode when linkToInteface linker is eliminated
vlivanov
parents: 35108
diff changeset
   254
        run(() -> linkToInterface(new P1(), P1.class));
eeeb86fd9922 8150436: Incorrect invocation mode when linkToInteface linker is eliminated
vlivanov
parents: 35108
diff changeset
   255
eeeb86fd9922 8150436: Incorrect invocation mode when linkToInteface linker is eliminated
vlivanov
parents: 35108
diff changeset
   256
        // Monomorphic case (optimized virtual call), default target method
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   257
        run(() -> linkToInterface(new T(), I.class));
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   258
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   259
        // Megamorphic case (virtual call)
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   260
        run(() -> {
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   261
            linkToInterface(new T(),  I.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   262
            linkToInterface(new P1(), P1.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   263
            linkToInterface(new P2(), P2.class);
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   264
        });
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   265
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   266
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   267
    static void testSpecial() {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   268
        System.out.println("linkToSpecial");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   269
        // Monomorphic case (optimized virtual call)
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   270
        run(() -> linkToSpecial(new T(), T.class));
50449
acdfeede95ff 8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods
vlivanov
parents: 47216
diff changeset
   271
        run(() -> linkToSpecialIntf(new T(), I.class));
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   272
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   273
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   274
    static void testStatic() {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   275
        System.out.println("linkToStatic");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   276
        // static call
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   277
        run(() -> linkToStatic());
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   278
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   279
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   280
    public static void main(String[] args) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   281
        testVirtual();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   282
        testInterface();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   283
        testSpecial();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   284
        testStatic();
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   285
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
diff changeset
   286
}