annotate test/compiler/7088020/Test7088020.java @ 14649:f6301b007a16

6498581: ThreadInterruptTest3 produces wrong output on Windows Summary: There is race condition between os::interrupt and os::is_interrupted on Windows. In JVM_Sleep(Thread.sleep), check if thread gets interrupted, it may see interrupted but not really interrupted so cause spurious waking up (early return from sleep). Fix by checking if interrupt event really gets set thus prevent false return. For intrinsic of _isInterrupted, on Windows, go fastpath only on bit not set. Reviewed-by: acorn, kvn Contributed-by: david.holmes@oracle.com, yumin.qi@oracle.com
author minqi
date Wed, 26 Feb 2014 15:20:41 -0800
parents c565834fb592
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3937
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
1 /*
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
4 *
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
7 * published by the Free Software Foundation.
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
8 *
c565834fb592 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
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
c565834fb592 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
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
13 * accompanied this code).
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
14 *
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
18 *
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
21 * questions.
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
22 *
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
23 */
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
24
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
25 /**
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
26 * @test
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
27 * @bug 7088020
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
28 * @summary SEGV in JNIHandleBlock::release_block
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
29 *
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
30 * @run main Test7088020
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
31 */
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
32
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
33 import java.lang.invoke.*;
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
34
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
35
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
36 public class Test7088020 {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
37 public static boolean test() {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
38 return false;
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
39 }
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
40
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
41 public static void main(String... args) throws Throwable {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
42 MethodHandle test = MethodHandles.lookup().findStatic(Test7088020.class, "test", MethodType.methodType(Boolean.TYPE));
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
43
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
44 // Exercise WMT with different argument alignments
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
45 int thrown = 0;
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
46 try {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
47 test.invokeExact(0);
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
48 } catch (WrongMethodTypeException wmt) {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
49 thrown++;
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
50 if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
51 }
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
52 try {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
53 test.invokeExact(0, 1);
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
54 } catch (WrongMethodTypeException wmt) {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
55 thrown++;
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
56 if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
57 }
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
58 try {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
59 test.invokeExact(0, 1, 2);
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
60 } catch (WrongMethodTypeException wmt) {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
61 thrown++;
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
62 if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
63 }
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
64 try {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
65 test.invokeExact(0, 1, 2, 3);
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
66 } catch (WrongMethodTypeException wmt) {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
67 thrown++;
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
68 if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
69 }
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
70 try {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
71 thrown++;
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
72 test.invokeExact(0, 1, 2, 3, 4);
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
73 } catch (WrongMethodTypeException wmt) {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
74 if (wmt.getStackTrace().length < 1) throw new InternalError("missing stack frames");
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
75 }
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
76 if (thrown != 5) {
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
77 throw new InternalError("not enough throws");
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
78 }
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
79 }
c565834fb592 7088020: SEGV in JNIHandleBlock::release_block
never
parents:
diff changeset
80 }