author | dsamersoff |
Sun, 01 May 2016 12:47:00 +0300 | |
changeset 38152 | 80e5da81fb2c |
parent 36851 | 03e2f4d0a421 |
child 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
28732
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
1 |
/* |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
4 |
* |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
8 |
* |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
13 |
* accompanied this code). |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
14 |
* |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
18 |
* |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
21 |
* questions. |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
22 |
*/ |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
23 |
|
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
24 |
/* |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
25 |
* @test |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
26 |
* @summary Make sure pageSize() returns a value that is a power of two |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
27 |
* @library /testlibrary |
36851 | 28 |
* @modules java.base/jdk.internal.misc |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28732
diff
changeset
|
29 |
* java.management |
28732
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
30 |
* @run main PageSize |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
31 |
*/ |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
32 |
|
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
33 |
import java.lang.reflect.Field; |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
34 |
import jdk.test.lib.*; |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36851
diff
changeset
|
35 |
import jdk.internal.misc.Unsafe; |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
36 |
import static jdk.test.lib.Asserts.*; |
28732
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
37 |
|
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
38 |
public class PageSize { |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
39 |
public static void main(String args[]) throws Exception { |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
40 |
Unsafe unsafe = Utils.getUnsafe(); |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
41 |
int pageSize = unsafe.pageSize(); |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
42 |
|
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
43 |
for (int n = 1; n != 0; n <<= 1) { |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
44 |
if (pageSize == n) { |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
45 |
return; |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
46 |
} |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
47 |
} |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
48 |
throw new RuntimeException("Expected pagesize to be a power of two, actual pagesize:" + pageSize); |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
49 |
} |
d4b650e48a8f
8069207: [TESTBUG] Exception thrown for java.lang.NoSuchMethodError: sun.misc.Unsafe.monitorExit
ctornqvi
parents:
diff
changeset
|
50 |
} |