author | hseigel |
Wed, 01 Mar 2017 08:00:02 -0500 | |
changeset 46194 | 5596e6f63072 |
parent 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
39967
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
1 |
/* |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
3 |
* Copyright (c) 2016, Red Hat Inc. All rights reserved. |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
5 |
* |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
9 |
* |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
14 |
* accompanied this code). |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
15 |
* |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License version |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
19 |
* |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
22 |
* questions. |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
23 |
*/ |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
24 |
|
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
25 |
/** |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
26 |
* @test |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
27 |
* @bug 8026049 8151163 |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
28 |
* @modules java.base/jdk.internal.misc |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39967
diff
changeset
|
29 |
* @library /test/lib |
39967
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
30 |
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 DirectByteBufferTest |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
31 |
* @run main/othervm -Djdk.test.lib.random.seed=0 DirectByteBufferTest |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
32 |
* @summary Verify that direct byte buffers are correctly accessed. |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
33 |
*/ |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
34 |
|
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
35 |
public class DirectByteBufferTest extends ByteBufferTest { |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
36 |
|
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
37 |
public DirectByteBufferTest(long iterations, boolean direct) { |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
38 |
super(iterations, direct); |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
39 |
} |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
40 |
|
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
41 |
public static void main(String[] args) { |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
42 |
// The number of iterations is high to ensure that tiered |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
43 |
// compilation kicks in all the way up to C2. |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
44 |
long iterations = 100000; |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
45 |
if (args.length > 0) |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
46 |
iterations = Long.parseLong(args[0]); |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
47 |
|
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
48 |
new DirectByteBufferTest(iterations, true).run(); |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
49 |
} |
69932114a0fc
8151163: All Buffer implementations should leverage Unsafe unaligned accessors
psandoz
parents:
diff
changeset
|
50 |
} |