hotspot/test/compiler/7088020/Test7088020.java
author never
Sat, 10 Sep 2011 00:11:04 -0700
changeset 10545 fec876499aae
permissions -rw-r--r--
7088020: SEGV in JNIHandleBlock::release_block Reviewed-by: kvn, twisti
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
/**
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    26
 * @test
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    27
 * @bug 7088020
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    28
 * @summary SEGV in JNIHandleBlock::release_block
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    29
 *
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    30
 * @run main Test7088020
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    31
 */
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    32
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    33
import java.lang.invoke.*;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    34
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    35
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    36
public class Test7088020 {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    37
    public static boolean test() {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    38
        return false;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    39
    }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    40
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    41
    public static void main(String... args) throws Throwable {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    42
        MethodHandle test = MethodHandles.lookup().findStatic(Test7088020.class, "test",  MethodType.methodType(Boolean.TYPE));
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    43
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    44
        // Exercise WMT with different argument alignments
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    45
        int thrown = 0;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    46
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    47
            test.invokeExact(0);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    48
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    49
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    50
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    51
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    52
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    53
            test.invokeExact(0, 1);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    54
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    55
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    56
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    57
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    58
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    59
            test.invokeExact(0, 1, 2);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    60
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    61
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    62
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    63
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    64
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    65
            test.invokeExact(0, 1, 2, 3);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    66
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    67
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    68
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    69
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    70
        try {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    71
            thrown++;
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    72
            test.invokeExact(0, 1, 2, 3, 4);
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    73
        } catch (WrongMethodTypeException wmt) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    74
            if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    75
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    76
        if (thrown != 5) {
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    77
            throw new InternalError("not enough throws");
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    78
        }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    79
    }
fec876499aae 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
    80
}