annotate test/runtime/8003720/Test8003720.java @ 17716:cdb71841f4bc

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 dad48145e775
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7179
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
1 /*
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
4 *
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
7 * published by the Free Software Foundation.
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
8 *
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
13 * accompanied this code).
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
14 *
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
18 *
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
21 * questions.
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
22 *
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
23 */
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
24
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
25 /*
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
26 * @test
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
27 * @bug 8003720
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
28 * @summary Method in interpreter stack frame can be deallocated
7186
dad48145e775 8004199: Change the ASM package for Test8003720
stefank
parents: 7179
diff changeset
29 * @compile -XDignore.symbol.file -source 1.7 -target 1.7 Victim.java
7179
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
30 * @run main/othervm -Xverify:all -Xint Test8003720
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
31 */
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
32
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
33 // Attempts to make the JVM unload a class while still executing one of its methods.
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
34 public class Test8003720 {
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
35 final static String VICTIM_CLASS_NAME = "Victim";
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
36 final static boolean QUIET = true;
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
37 final static long DURATION = 30000;
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
38
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
39 public interface CallMe { void callme(); }
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
40
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
41 public static void main(String... av) throws Throwable {
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
42 newVictimClassLoader();
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
43 System.gc();
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
44
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
45 newVictimClass();
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
46 System.gc();
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
47
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
48 newVictimInstance();
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
49 System.gc();
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
50
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
51 ((CallMe)newVictimInstance()).callme();
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
52 }
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
53
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
54 public static Object newVictimInstance() throws Throwable {
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
55 return newVictimClass().newInstance();
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
56 }
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
57
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
58 public static Class<?> newVictimClass() throws Throwable {
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
59 return Class.forName(VICTIM_CLASS_NAME, true, new VictimClassLoader());
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
60 }
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
61
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
62 public static ClassLoader newVictimClassLoader() throws Throwable {
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
63 return new VictimClassLoader();
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
64 }
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
65
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
66 public static void println(String line) {
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
67 if (!QUIET) {
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
68 System.out.println(line);
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
69 }
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
70 }
d0aa87f04bd5 8003720: NPG: Method in interpreter stack frame can be deallocated
stefank
parents:
diff changeset
71 }