Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/compiler/6663621/IVTest.java
32285 views
/*1* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324/**25* @test26* @bug 666362127* @summary JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.28*/2930public class IVTest {31static int paddedSize;3233static void padV15(byte[] padded) {34int psSize = padded.length;35int k = 0;36while (psSize-- > 0) {37padded[k++] = (byte)0xff;38}39}4041static void padV15_2(int paddedSize) {42byte[] padded = new byte[paddedSize];43int psSize = padded.length;44int k = 0;45while (psSize-- > 0) {46padded[k++] = (byte)0xff;47}48}4950static void padV15_3() {51byte[] padded = new byte[paddedSize];52int psSize = padded.length;53int k = 0;54while (psSize-- > 0) {55padded[k++] = (byte)0xff;56}57}5859static void padV15_4() {60byte[] padded = new byte[paddedSize];61int psSize = padded.length;62for (int k = 0;psSize > 0; psSize--) {63int i = padded.length - psSize;64padded[i] = (byte)0xff;65}66}6768static void padV15_5() {69byte[] padded = new byte[paddedSize];70int psSize = padded.length;71int k = psSize - 1;72for (int i = 0; i < psSize; i++) {73padded[k--] = (byte)0xff;74}75}7677public static void main(String argv[]) {78int bounds = 1024;79int lim = 500000;80long start = System.currentTimeMillis();81for (int j = 0; j < lim; j++) {82paddedSize = j % bounds;83padV15(new byte[paddedSize]);84}85long end = System.currentTimeMillis();86System.out.println(end - start);87start = System.currentTimeMillis();88for (int j = 0; j < lim; j++) {89paddedSize = j % bounds;90padV15_2(paddedSize);91}92end = System.currentTimeMillis();93System.out.println(end - start);94start = System.currentTimeMillis();95for (int j = 0; j < lim; j++) {96paddedSize = j % bounds;97padV15_3();98}99end = System.currentTimeMillis();100System.out.println(end - start);101start = System.currentTimeMillis();102for (int j = 0; j < lim; j++) {103paddedSize = j % bounds;104padV15_4();105}106end = System.currentTimeMillis();107System.out.println(end - start);108start = System.currentTimeMillis();109for (int j = 0; j < lim; j++) {110paddedSize = j % bounds;111padV15_5();112}113end = System.currentTimeMillis();114System.out.println(end - start);115}116}117118119