jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
author alanb
Thu, 01 Dec 2016 08:57:53 +0000
changeset 42338 a60f280f803c
parent 37890 f6cb5112c878
child 43733 25b25148d346
permissions -rw-r--r--
8169069: Module system implementation refresh (11/2016) Reviewed-by: plevart, chegar, psandoz, mchung, alanb, dfuchs, naoto, coffeys, weijun Contributed-by: alan.bateman@oracle.com, mandy.chung@oracle.com, claes.redestad@oracle.com, mark.reinhold@oracle.com
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
/*
37890
f6cb5112c878 8156695: Fix @modules in tests in java/lang/management
shurailine
parents: 33402
diff changeset
     2
 * Copyright (c) 2014, 2016, 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
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    30
 * @library /lib/testlibrary/jsr292 /lib/testlibrary
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
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 37890
diff changeset
    33
 *          jdk.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
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    41
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
    42
import java.util.Collections;
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    43
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
    44
import java.util.HashMap;
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    45
import java.util.Map;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    46
import java.util.concurrent.BrokenBarrierException;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    47
import java.util.concurrent.ConcurrentLinkedQueue;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    48
import java.util.concurrent.CountDownLatch;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    49
import java.util.concurrent.CyclicBarrier;
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    50
import com.oracle.testlibrary.jsr292.CodeCacheOverflowProcessor;
26600
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 {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    60
        EnumSet<TestMethods.Kind> set = EnumSet.complementOf(EnumSet.of(TestMethods.Kind.EXCEPT));
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    61
        KINDS = set.toArray(new TestMethods.Kind[set.size()]);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    62
        if (KINDS.length < 2) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    63
            throw new Error("TESTBUG: KINDS.length[" + KINDS.length + "] should be at least 2");
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    64
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    65
    }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    66
    private static final int CORES = Math.max(KINDS.length, Runtime.getRuntime().availableProcessors());
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    67
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    68
    /**
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    69
     * 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
    70
     *
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    71
     * @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
    72
     * returns a {@code j.l.i.MethodHandle} instance.
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
    public LFMultiThreadCachingTest(TestMethods testMethod) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    75
        super(testMethod);
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
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    78
    @Override
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    79
    public void doTest() {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    80
        Map<String, Object> data = getTestMethod().getTestCaseData();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    81
        ConcurrentLinkedQueue<MethodHandle> adapters = new ConcurrentLinkedQueue<>();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    82
        CyclicBarrier begin = new CyclicBarrier(CORES);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    83
        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
    84
        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
    85
                = Collections.synchronizedMap(new HashMap<Thread, Throwable>(CORES));
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    86
        for (int i = 0; i < CORES; ++i) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    87
            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
    88
            Thread t = new Thread(() -> {
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    89
                try {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    90
                    begin.await();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    91
                    adapters.add(getTestMethod().getTestCaseMH(data, kind));
31251
f13b582c8179 8129532: LFMultiThreadCachingTest.java failed with ConcurrentModificationException
kshefov
parents: 31179
diff changeset
    92
                } catch (Throwable ex) {
f13b582c8179 8129532: LFMultiThreadCachingTest.java failed with ConcurrentModificationException
kshefov
parents: 31179
diff changeset
    93
                    threadUncaughtExceptions.put(Thread.currentThread(), ex);
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    94
                } finally {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    95
                    end.countDown();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    96
                }
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    97
            });
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
    98
            t.start();
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
    99
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   100
        try {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   101
            end.await();
31179
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   102
            boolean vmeThrown = false;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   103
            boolean nonVmeThrown = false;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   104
            Throwable vme = null;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   105
            for (Map.Entry<Thread,
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   106
                    Throwable> entry : threadUncaughtExceptions.entrySet()) {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   107
                Thread t =  entry.getKey();
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   108
                Throwable e = entry.getValue();
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   109
                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
   110
                        + " 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
   111
                e.printStackTrace();
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   112
                if (CodeCacheOverflowProcessor.isThrowableCausedByVME(e)) {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   113
                    vmeThrown = true;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   114
                    vme = e;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   115
                } else {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   116
                    nonVmeThrown = true;
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   117
                }
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   118
                if (nonVmeThrown) {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   119
                    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
   120
                            + " 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
   121
                }
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   122
                if (vmeThrown) {
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   123
                    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
   124
                            + " thrown VirtualMachineError caused by"
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   125
                            + " 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
   126
                }
a823fb6fdf2e 8062904: TEST_BUG: Tests java/lang/invoke/LFCaching fail when run with -Xcomp option
kshefov
parents: 27758
diff changeset
   127
            }
26600
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   128
        } catch (InterruptedException ex) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   129
            throw new Error("Unexpected exception: ", ex);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   130
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   131
        if (adapters.size() < CORES) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   132
            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
   133
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   134
        MethodHandle prev = adapters.poll();
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   135
        for (MethodHandle current : adapters) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   136
            checkLFCaching(prev, current);
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   137
            prev = current;
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   138
        }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   139
    }
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   140
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
     * Main routine for multiple threaded lambda forms caching test.
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
     * @param args Accepts no arguments.
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   145
     */
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   146
    public static void main(String[] args) {
27b115fe8b3c 8057719: Develop new tests for LambdaForm Reduction and Caching feature
kshefov
parents:
diff changeset
   147
        LambdaFormTestCase.runTests(LFMultiThreadCachingTest::new, EnumSet.allOf(TestMethods.class));
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
}