jdk/test/sun/misc/CopyMemory.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
child 30046 cf2c86e1819e
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/* @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * @bug 6565543
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @summary Minimal test for unsafe.copyMemory() and unsafe.setMemory()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.lang.reflect.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.nio.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import sun.misc.Unsafe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.nio.ch.DirectBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
public class CopyMemory {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    private final static int BUFFER_SIZE = 1024;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    private final static int N = 16 * 1024;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private final static int FILLER = 0x55;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    private final static int FILLER2 = 0x33;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private final static Random random = new Random();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private static void set(byte[] b, int ofs, int len, int value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
            b[ofs + i] = (byte)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private static void check(byte[] b, int ofs, int len, int value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
            int r = b[ofs + i] & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
            if (r != value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                throw new RuntimeException("mismatch");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private static void set(Unsafe unsafe, long addr, int ofs, int len, int value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
            unsafe.putByte(null, addr + ofs + i, (byte)value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    private static void check(Unsafe unsafe, long addr, int ofs, int len, int value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
            int r = unsafe.getByte(null, addr + ofs + i) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
            if (r != value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                throw new RuntimeException("mismatch");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    private static final List<ByteBuffer> buffers = new ArrayList<ByteBuffer>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    private static long getMemory(int n) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        ByteBuffer b = ByteBuffer.allocateDirect(n);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        if (b instanceof DirectBuffer == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
            throw new RuntimeException("Not a direct buffer");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        buffers.add(b); // make sure the buffer does not get GCed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        return ((DirectBuffer)b).address();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    private static void testSetByteArray(Unsafe unsafe) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        System.out.println("Testing setMemory() for byte[]...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        byte[] b = new byte[BUFFER_SIZE];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        for (int i = 0; i < N; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            set(b, 0, BUFFER_SIZE, FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
            int ofs = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            int len = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            int val = random.nextInt(256);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            unsafe.setMemory(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + ofs, len, (byte)val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            check(b, 0, ofs - 1, FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            check(b, ofs, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
            check(b, ofs + len, BUFFER_SIZE - (ofs + len), FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    private static void testSetRawMemory(Unsafe unsafe) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        System.out.println("Testing setMemory() for raw memory...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        long b = getMemory(BUFFER_SIZE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        for (int i = 0; i < N; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            set(unsafe, b, 0, BUFFER_SIZE, FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
            int ofs = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            int len = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            int val = random.nextInt(256);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            unsafe.setMemory(null, b + ofs, len, (byte)val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            check(unsafe, b, 0, ofs - 1, FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            check(unsafe, b, ofs, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            check(unsafe, b, ofs + len, BUFFER_SIZE - (ofs + len), FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    private static void testCopyByteArrayToByteArray(Unsafe unsafe) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        System.out.println("Testing copyMemory() for byte[] to byte[]...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        byte[] b1 = new byte[BUFFER_SIZE];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        byte[] b2 = new byte[BUFFER_SIZE];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        for (int i = 0; i < N; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            set(b1, 0, BUFFER_SIZE, FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            set(b2, 0, BUFFER_SIZE, FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            int ofs = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            int len = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            int val = random.nextInt(256);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            set(b1, ofs, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            int ofs2 = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            unsafe.copyMemory(b1, Unsafe.ARRAY_BYTE_BASE_OFFSET + ofs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                b2, Unsafe.ARRAY_BYTE_BASE_OFFSET + ofs2, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            check(b2, 0, ofs2 - 1, FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            check(b2, ofs2, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            check(b2, ofs2 + len, BUFFER_SIZE - (ofs2 + len), FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    private static void testCopyByteArrayToRawMemory(Unsafe unsafe) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        System.out.println("Testing copyMemory() for byte[] to raw memory...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        byte[] b1 = new byte[BUFFER_SIZE];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        long b2 = getMemory(BUFFER_SIZE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        for (int i = 0; i < N; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            set(b1, 0, BUFFER_SIZE, FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            set(unsafe, b2, 0, BUFFER_SIZE, FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            int ofs = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            int len = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            int val = random.nextInt(256);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            set(b1, ofs, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            int ofs2 = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            unsafe.copyMemory(b1, Unsafe.ARRAY_BYTE_BASE_OFFSET + ofs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                null, b2 + ofs2, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            check(unsafe, b2, 0, ofs2 - 1, FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            check(unsafe, b2, ofs2, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            check(unsafe, b2, ofs2 + len, BUFFER_SIZE - (ofs2 + len), FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    private static void testCopyRawMemoryToByteArray(Unsafe unsafe) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        System.out.println("Testing copyMemory() for raw memory to byte[]...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        long b1 = getMemory(BUFFER_SIZE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        byte[] b2 = new byte[BUFFER_SIZE];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        for (int i = 0; i < N; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            set(unsafe, b1, 0, BUFFER_SIZE, FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            set(b2, 0, BUFFER_SIZE, FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            int ofs = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            int len = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            int val = random.nextInt(256);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            set(unsafe, b1, ofs, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            int ofs2 = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            unsafe.copyMemory(null, b1 + ofs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                b2, Unsafe.ARRAY_BYTE_BASE_OFFSET + ofs2, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            check(b2, 0, ofs2 - 1, FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            check(b2, ofs2, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            check(b2, ofs2 + len, BUFFER_SIZE - (ofs2 + len), FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    private static void testCopyRawMemoryToRawMemory(Unsafe unsafe) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        System.out.println("Testing copyMemory() for raw memory to raw memory...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        long b1 = getMemory(BUFFER_SIZE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        long b2 = getMemory(BUFFER_SIZE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        for (int i = 0; i < N; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            set(unsafe, b1, 0, BUFFER_SIZE, FILLER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            set(unsafe, b2, 0, BUFFER_SIZE, FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            int ofs = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            int len = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            int val = random.nextInt(256);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            set(unsafe, b1, ofs, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            int ofs2 = random.nextInt(BUFFER_SIZE / 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            unsafe.copyMemory(null, b1 + ofs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                null, b2 + ofs2, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            check(unsafe, b2, 0, ofs2 - 1, FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            check(unsafe, b2, ofs2, len, val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            check(unsafe, b2, ofs2 + len, BUFFER_SIZE - (ofs2 + len), FILLER2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    private static Unsafe getUnsafe() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        Field f = Unsafe.class.getDeclaredField("theUnsafe");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        f.setAccessible(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        return (Unsafe)f.get(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    public static void main(String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        Unsafe unsafe = getUnsafe();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        testSetByteArray(unsafe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        testSetRawMemory(unsafe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        testCopyByteArrayToByteArray(unsafe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        testCopyByteArrayToRawMemory(unsafe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        testCopyRawMemoryToByteArray(unsafe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        testCopyRawMemoryToRawMemory(unsafe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        System.out.println("OK");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
}