comparison test/compiler/6663621/IVTest.java @ 72:f705f25597eb

6663621: JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests. Summary: alignment expression with secondary induction variables is sometimes wrong Reviewed-by: kvn, rasbold
author never
date Thu, 20 Mar 2008 10:43:42 -0700
parents
children 2a8ec427fbe1
comparison
equal deleted inserted replaced
71:3d62cb85208d 72:f705f25597eb
1 /*
2 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4 *
5 *
6 *
7 *
8 *
9 *
10 *
11 *
12 *
13 *
14 *
15 *
16 *
17 *
18 *
19 *
20 *
21 *
22 */
23
24 /**
25 * @test
26 * @bug 6663621
27 * @summary JVM crashes while trying to execute api/java_security/Signature/SignatureTests.html#initSign tests.
28 */
29
30 public class IVTest {
31 static int paddedSize;
32
33 static void padV15(byte[] padded) {
34 int psSize = padded.length;
35 int k = 0;
36 while (psSize-- > 0) {
37 padded[k++] = (byte)0xff;
38 }
39 }
40
41 static void padV15_2(int paddedSize) {
42 byte[] padded = new byte[paddedSize];
43 int psSize = padded.length;
44 int k = 0;
45 while (psSize-- > 0) {
46 padded[k++] = (byte)0xff;
47 }
48 }
49
50 static void padV15_3() {
51 byte[] padded = new byte[paddedSize];
52 int psSize = padded.length;
53 int k = 0;
54 while (psSize-- > 0) {
55 padded[k++] = (byte)0xff;
56 }
57 }
58
59 static void padV15_4() {
60 byte[] padded = new byte[paddedSize];
61 int psSize = padded.length;
62 for (int k = 0;psSize > 0; psSize--) {
63 int i = padded.length - psSize;
64 padded[i] = (byte)0xff;
65 }
66 }
67
68 static void padV15_5() {
69 byte[] padded = new byte[paddedSize];
70 int psSize = padded.length;
71 int k = psSize - 1;
72 for (int i = 0; i < psSize; i++) {
73 padded[k--] = (byte)0xff;
74 }
75 }
76
77 public static void main(String argv[]) {
78 int bounds = 1024;
79 int lim = 500000;
80 long start = System.currentTimeMillis();
81 for (int j = 0; j < lim; j++) {
82 paddedSize = j % bounds;
83 padV15(new byte[paddedSize]);
84 }
85 long end = System.currentTimeMillis();
86 System.out.println(end - start);
87 start = System.currentTimeMillis();
88 for (int j = 0; j < lim; j++) {
89 paddedSize = j % bounds;
90 padV15_2(paddedSize);
91 }
92 end = System.currentTimeMillis();
93 System.out.println(end - start);
94 start = System.currentTimeMillis();
95 for (int j = 0; j < lim; j++) {
96 paddedSize = j % bounds;
97 padV15_3();
98 }
99 end = System.currentTimeMillis();
100 System.out.println(end - start);
101 start = System.currentTimeMillis();
102 for (int j = 0; j < lim; j++) {
103 paddedSize = j % bounds;
104 padV15_4();
105 }
106 end = System.currentTimeMillis();
107 System.out.println(end - start);
108 start = System.currentTimeMillis();
109 for (int j = 0; j < lim; j++) {
110 paddedSize = j % bounds;
111 padV15_5();
112 }
113 end = System.currentTimeMillis();
114 System.out.println(end - start);
115 }
116 }