HeapByteBufferTest.java revision 11720:f8e096377840
1289848Sjkim/* 2289848Sjkim * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3289848Sjkim * Copyright (c) 2016, Red Hat Inc. All rights reserved. 4289848Sjkim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5289848Sjkim * 6289848Sjkim * This code is free software; you can redistribute it and/or modify it 7289848Sjkim * under the terms of the GNU General Public License version 2 only, as 8289848Sjkim * published by the Free Software Foundation. 9289848Sjkim * 10289848Sjkim * This code is distributed in the hope that it will be useful, but WITHOUT 11289848Sjkim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12289848Sjkim * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13289848Sjkim * version 2 for more details (a copy is included in the LICENSE file that 14289848Sjkim * accompanied this code). 15289848Sjkim * 16289848Sjkim * You should have received a copy of the GNU General Public License version 17289848Sjkim * 2 along with this work; if not, write to the Free Software Foundation, 18289848Sjkim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19289848Sjkim * 20295009Sjkim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21295009Sjkim * or visit www.oracle.com if you need additional information or have any 22295009Sjkim * questions. 23295009Sjkim */ 24289848Sjkim 25289848Sjkim/** 26289848Sjkim * @test 27289848Sjkim * @bug 8026049 8151163 28289848Sjkim * @summary Verify that byte buffers are correctly accessed. 29289848Sjkim * @modules java.base/jdk.internal.misc 30289848Sjkim * @library /testlibrary 31289848Sjkim * 32289848Sjkim * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 33289848Sjkim * HeapByteBufferTest 34289848Sjkim * @run main/othervm -Djdk.test.lib.random.seed=0 35289848Sjkim * HeapByteBufferTest 36289848Sjkim */ 37289848Sjkim 38289848Sjkimpublic class HeapByteBufferTest extends ByteBufferTest { 39289848Sjkim 40289848Sjkim public HeapByteBufferTest(long iterations, boolean direct) { 41289848Sjkim super(iterations, direct); 42289848Sjkim } 43289848Sjkim 44289848Sjkim public static void main(String[] args) { 45289848Sjkim // The number of iterations is high to ensure that tiered 46289848Sjkim // compilation kicks in all the way up to C2. 47289848Sjkim long iterations = 100000; 48289848Sjkim if (args.length > 0) 49289848Sjkim iterations = Long.parseLong(args[0]); 50289848Sjkim 51289848Sjkim new HeapByteBufferTest(iterations, false).run(); 52289848Sjkim } 53289848Sjkim} 54289848Sjkim