CopyMemory.java revision 2362
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * This code is free software; you can redistribute it and/or modify it
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * under the terms of the GNU General Public License version 2 only, as
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * published by the Free Software Foundation.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * This code is distributed in the hope that it will be useful, but WITHOUT
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * version 2 for more details (a copy is included in the LICENSE file that
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * accompanied this code).
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * You should have received a copy of the GNU General Public License version
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * 2 along with this work; if not, write to the Free Software Foundation,
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f71f7a61dec7c9089378d14493ad564a1dedf0b5neil_a_wilson * or visit www.oracle.com if you need additional information or have any
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson * @bug 6565543
a3d3ab94806056d2355afea6fe8daac41059b9fbludovicp * @summary Minimal test for unsafe.copyMemory() and unsafe.setMemory()
69de0fe5b7ed905860bef5f86937d30cc206ef7dneil_a_wilson private final static Random random = new Random();
69de0fe5b7ed905860bef5f86937d30cc206ef7dneil_a_wilson private static void set(byte[] b, int ofs, int len, int value) {
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara private static void check(byte[] b, int ofs, int len, int value) {
0cf0e19d7abb0e7659df6d191269f96b3ffe7f45neil_a_wilson private static void set(Unsafe unsafe, long addr, int ofs, int len, int value) {
if (r != value) {
private static long getMemory(int n) {
if (b instanceof DirectBuffer == false) {
byte[] b = new byte[BUFFER_SIZE];
f.setAccessible(true);