jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
author iignatyev
Wed, 07 Jun 2017 08:58:19 -0700
changeset 45460 73ef931229ca
parent 45283 fcb2af038805
child 45466 faf1c55d2046
permissions -rw-r--r--
8180386: remove jdk.testlibrary.TimeLimitedRunner Reviewed-by: rriggs, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
     1
/*
43733
25b25148d346 8174194: Several java/lang tests failing due to undeclared module dependencies
skovalev
parents: 42338
diff changeset
     2
 * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
     4
 *
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
     8
 *
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    13
 * accompanied this code).
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    14
 *
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    18
 *
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    21
 * questions.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    22
 */
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    23
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    24
/*
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    25
 * @test LFMultiThreadCachingTest
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    26
 * @bug 8046703
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    27
 * @key randomness
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    28
 * @summary Test verifies that lambda forms are cached when run with multiple threads
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    29
 * @author kshefov
45460
73ef931229ca 8180386: remove jdk.testlibrary.TimeLimitedRunner
iignatyev
parents: 45283
diff changeset
    30
 * @library /lib/testlibrary /java/lang/invoke/common /test/lib
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37890
diff changeset
    31
 * @modules java.base/java.lang.invoke:open
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37890
diff changeset
    32
 *          java.base/java.lang.ref:open
43733
25b25148d346 8174194: Several java/lang tests failing due to undeclared module dependencies
skovalev
parents: 42338
diff changeset
    33
 *          java.management
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    34
 * @build TestMethods
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    35
 * @build LambdaFormTestCase
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    36
 * @build LFCachingTestCase
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    37
 * @build LFMultiThreadCachingTest
33312
489f8e536bc0 8136967: revert all changes applied to obtain information about 8131129
mhaupt
parents: 32762
diff changeset
    38
 * @run main/othervm LFMultiThreadCachingTest
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    39
 */
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    40
45283
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
    41
import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
    42
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    43
import java.lang.invoke.MethodHandle;
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    44
import java.util.Collections;
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    45
import java.util.EnumSet;
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    46
import java.util.HashMap;
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    47
import java.util.Map;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    48
import java.util.concurrent.ConcurrentLinkedQueue;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    49
import java.util.concurrent.CountDownLatch;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    50
import java.util.concurrent.CyclicBarrier;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    51
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    52
/**
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    53
 * Multiple threaded lambda forms caching test class.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    54
 */
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    55
public final class LFMultiThreadCachingTest extends LFCachingTestCase {
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    56
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    57
    private static final TestMethods.Kind[] KINDS;
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    58
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    59
    static {
45283
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
    60
        EnumSet<TestMethods.Kind> set
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
    61
                = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    62
        KINDS = set.toArray(new TestMethods.Kind[set.size()]);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    63
        if (KINDS.length < 2) {
45283
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
    64
            throw new Error("TESTBUG: KINDS.length[" + KINDS.length
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
    65
                    + "] should be at least 2");
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    66
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    67
    }
45283
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
    68
    private static final int CORES
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
    69
            = Math.max(KINDS.length, Runtime.getRuntime().availableProcessors());
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    70
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    71
    /**
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    72
     * Constructor a for multiple threaded lambda forms caching test case.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    73
     *
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    74
     * @param testMethod A method from {@code j.l.i.MethodHandles} class that
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    75
     * returns a {@code j.l.i.MethodHandle} instance.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    76
     */
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    77
    public LFMultiThreadCachingTest(TestMethods testMethod) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    78
        super(testMethod);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    79
    }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    80
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    81
    @Override
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    82
    public void doTest() {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    83
        Map<String, Object> data = getTestMethod().getTestCaseData();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    84
        ConcurrentLinkedQueue<MethodHandle> adapters = new ConcurrentLinkedQueue<>();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    85
        CyclicBarrier begin = new CyclicBarrier(CORES);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    86
        CountDownLatch end = new CountDownLatch(CORES);
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    87
        final Map<Thread, Throwable> threadUncaughtExceptions
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    88
                = Collections.synchronizedMap(new HashMap<Thread, Throwable>(CORES));
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    89
        for (int i = 0; i < CORES; ++i) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    90
            TestMethods.Kind kind = KINDS[i % KINDS.length];
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    91
            Thread t = new Thread(() -> {
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    92
                try {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    93
                    begin.await();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    94
                    adapters.add(getTestMethod().getTestCaseMH(data, kind));
31251
f13b582c8179 8129532: LFMultiThreadCachingTest.java failed with ConcurrentModificationException
kshefov
parents: 31179
diff changeset
    95
                } catch (Throwable ex) {
f13b582c8179 8129532: LFMultiThreadCachingTest.java failed with ConcurrentModificationException
kshefov
parents: 31179
diff changeset
    96
                    threadUncaughtExceptions.put(Thread.currentThread(), ex);
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    97
                } finally {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    98
                    end.countDown();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    99
                }
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   100
            });
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   101
            t.start();
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   102
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   103
        try {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   104
            end.await();
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   105
            boolean vmeThrown = false;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   106
            boolean nonVmeThrown = false;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   107
            Throwable vme = null;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   108
            for (Map.Entry<Thread,
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   109
                    Throwable> entry : threadUncaughtExceptions.entrySet()) {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   110
                Thread t =  entry.getKey();
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   111
                Throwable e = entry.getValue();
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   112
                System.err.printf("%nA thread with name \"%s\" of %d threads"
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   113
                        + " has thrown exception:%n", t.getName(), CORES);
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   114
                e.printStackTrace();
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   115
                if (CodeCacheOverflowProcessor.isThrowableCausedByVME(e)) {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   116
                    vmeThrown = true;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   117
                    vme = e;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   118
                } else {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   119
                    nonVmeThrown = true;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   120
                }
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   121
                if (nonVmeThrown) {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   122
                    throw new Error("One ore more threads have"
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   123
                            + " thrown unexpected exceptions. See log.");
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   124
                }
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   125
                if (vmeThrown) {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   126
                    throw new Error("One ore more threads have"
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   127
                            + " thrown VirtualMachineError caused by"
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   128
                            + " code cache overflow. See log.", vme);
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   129
                }
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   130
            }
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   131
        } catch (InterruptedException ex) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   132
            throw new Error("Unexpected exception: ", ex);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   133
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   134
        if (adapters.size() < CORES) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   135
            throw new Error("adapters size[" + adapters.size() + "] is less than " + CORES);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   136
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   137
        MethodHandle prev = adapters.poll();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   138
        for (MethodHandle current : adapters) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   139
            checkLFCaching(prev, current);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   140
            prev = current;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   141
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   142
    }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   143
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   144
    /**
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   145
     * Main routine for multiple threaded lambda forms caching test.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   146
     *
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   147
     * @param args Accepts no arguments.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   148
     */
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   149
    public static void main(String[] args) {
45283
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
   150
        LambdaFormTestCase.runTests(LFMultiThreadCachingTest::new,
fcb2af038805 8180890: move c.o.testlibrary.jsr292 classes to jdk/test/java/lang/invoke directory
iignatyev
parents: 43733
diff changeset
   151
                                    EnumSet.allOf(TestMethods.class));
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   152
    }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   153
}