Mercurial > hg > truffle
annotate test/compiler/7199742/Test7199742.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 | f13867c41f73 |
children |
rev | line source |
---|---|
6824
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
1 /* |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
4 * |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
8 * |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
13 * accompanied this code). |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
14 * |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
18 * |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
21 * questions. |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
22 * |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
23 */ |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
24 |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
25 /** |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
26 * @test |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
27 * @bug 7199742 |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
28 * @summary A lot of C2 OSR compilations of the same method's bci |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
29 * |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
30 * @run main/othervm -Xmx32m -Xbatch Test7199742 |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
31 */ |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
32 |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
33 public class Test7199742 { |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
34 private static final int ITERS = 10000000; |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
35 public static void main(String args[]) { |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
36 Test7199742 t = new Test7199742(); |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
37 for (int i=0; i<10; i++) { |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
38 test(t, 7); |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
39 } |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
40 } |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
41 static Test7199742 test(Test7199742 t, int m) { |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
42 int i = -(ITERS/2); |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
43 if (i == 0) return null; |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
44 Test7199742 v = null; |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
45 while(i < ITERS) { |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
46 if ((i&m) == 0) { |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
47 v = t; |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
48 } |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
49 i++; |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
50 } |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
51 return v; |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
52 } |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
53 } |
f13867c41f73
7199742: A lot of C2 OSR compilations of the same method's bci
kvn
parents:
diff
changeset
|
54 |