test/hotspot/jtreg/compiler/runtime/Test7088020.java
author ysuenaga
Thu, 14 Jun 2018 16:56:58 +0900
changeset 50560 dafb2cc6ba32
parent 47216 71c04702a3d5
permissions -rw-r--r--
8204531: Remove unused chars following '\0' Reviewed-by: dholmes, stuefe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10545
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
     1
/*
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
     4
 *
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
     8
 *
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    13
 * accompanied this code).
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    14
 *
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    18
 *
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    21
 * questions.
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    22
 */
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    23
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    24
/**
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    25
 * @test
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    26
 * @bug 7088020
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    27
 * @summary SEGV in JNIHandleBlock::release_block
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    28
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    29
 * @run main compiler.runtime.Test7088020
10545
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    30
 */
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    31
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    32
package compiler.runtime;
10545
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    33
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    34
import java.lang.invoke.MethodHandle;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    35
import java.lang.invoke.MethodHandles;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    36
import java.lang.invoke.MethodType;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    37
import java.lang.invoke.WrongMethodTypeException;
10545
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    38
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    39
public class Test7088020 {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    40
    public static boolean test() {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    41
        return false;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    42
    }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    43
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    44
    public static void main(String... args) throws Throwable {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    45
        MethodHandle test = MethodHandles.lookup().findStatic(Test7088020.class, "test",  MethodType.methodType(Boolean.TYPE));
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    46
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    47
        // Exercise WMT with different argument alignments
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    48
        int thrown = 0;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    49
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    50
            test.invokeExact(0);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    51
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    52
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    53
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    54
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    55
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    56
            test.invokeExact(0, 1);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    57
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    58
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    59
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    60
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    61
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    62
            test.invokeExact(0, 1, 2);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    63
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    64
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    65
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    66
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    67
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    68
            test.invokeExact(0, 1, 2, 3);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    69
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    70
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    71
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    72
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    73
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    74
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    75
            test.invokeExact(0, 1, 2, 3, 4);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    76
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    77
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    78
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    79
        if (thrown != 5) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    80
            throw new InternalError("not enough throws");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    81
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    82
    }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    83
}