Mercurial > hg > graal-compiler
annotate test/compiler/6942326/Test.java @ 11013:f822ecf621ce
Merge
author | chegar |
---|---|
date | Sun, 28 Apr 2013 08:15:33 +0100 |
parents | 41d4973cf100 |
children |
rev | line source |
---|---|
2320
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
1 /* |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
4 * |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
8 * |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
13 * accompanied this code). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
14 * |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
18 * |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
21 * questions. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
22 * |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
23 */ |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
24 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
25 /** |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
26 * @test |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
27 * @bug 6942326 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
28 * @summary x86 code in string_indexof() could read beyond reserved heap space |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
29 * |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
30 * @run main/othervm/timeout=300 -Xmx32m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=exclude,Test,main -XX:CompileCommand=exclude,Test,test_varsub_indexof -XX:CompileCommand=exclude,Test,test_varstr_indexof -XX:CompileCommand=exclude,Test,test_missub_indexof -XX:CompileCommand=exclude,Test,test_consub_indexof -XX:CompileCommand=exclude,Test,test_conmis_indexof -XX:CompileCommand=exclude,Test,test_subcon Test |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
31 * |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
32 */ |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
33 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
34 public class Test { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
35 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
36 static String[] strings = new String[1024]; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
37 private static final int ITERATIONS = 100000; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
38 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
39 public static void main(String[] args) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
40 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
41 long start_total = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
42 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
43 // search variable size substring in string (33 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
44 String a = " 1111111111111xx1111111111111xx11y"; // +1 to execute a.substring(1) first |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
45 String b = "1111111111111xx1111111111111xx11y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
46 test_varsub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
47 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
48 // search variable size substring in string (32 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
49 a = " 1111111111111xx1111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
50 b = "1111111111111xx1111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
51 test_varsub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
52 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
53 // search variable size substring in string (17 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
54 a = " 1111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
55 b = "1111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
56 test_varsub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
57 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
58 // search variable size substring in string (16 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
59 a = " 111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
60 b = "111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
61 test_varsub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
62 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
63 // search variable size substring in string (8 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
64 a = " 1111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
65 b = "1111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
66 test_varsub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
67 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
68 // search variable size substring in string (7 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
69 a = " 111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
70 b = "111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
71 test_varsub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
72 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
73 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
74 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
75 // search substring (17 chars) in variable size string. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
76 a = "1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
77 b = " 1111111111111xx1111111111111xx1x"; // +1 to execute b.substring(1) first |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
78 test_varstr_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
79 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
80 // search substring (16 chars) in variable size string. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
81 a = "111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
82 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
83 test_varstr_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
84 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
85 // search substring (9 chars) in variable size string. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
86 a = "11111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
87 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
88 test_varstr_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
89 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
90 // search substring (8 chars) in variable size string. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
91 a = "1111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
92 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
93 test_varstr_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
94 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
95 // search substring (4 chars) in variable size string. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
96 a = "xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
97 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
98 test_varstr_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
99 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
100 // search substring (3 chars) in variable size string. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
101 a = "x1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
102 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
103 test_varstr_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
104 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
105 // search substring (2 chars) in variable size string. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
106 a = "1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
107 b = " 1111111111111xx1111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
108 test_varstr_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
109 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
110 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
111 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
112 // search non matching variable size substring in string (33 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
113 a = " 1111111111111xx1111111111111xx11z"; // +1 to execute a.substring(1) first |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
114 b = "1111111111111xx1111111111111xx11y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
115 test_missub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
116 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
117 // search non matching variable size substring in string (32 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
118 a = " 1111111111111xx1111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
119 b = "1111111111111xx1111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
120 test_missub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
121 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
122 // search non matching variable size substring in string (17 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
123 a = " 1111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
124 b = "1111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
125 test_missub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
126 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
127 // search non matching variable size substring in string (16 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
128 a = " 111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
129 b = "111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
130 test_missub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
131 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
132 // search non matching variable size substring in string (8 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
133 a = " 1111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
134 b = "1111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
135 test_missub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
136 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
137 // search non matching variable size substring in string (7 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
138 a = " 111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
139 b = "111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
140 test_missub_indexof(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
141 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
142 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
143 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
144 // Testing constant substring search in variable size string. |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
145 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
146 // search constant substring (17 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
147 b = " 1111111111111xx1111111111111xx1x"; // +1 to execute b.substring(1) first |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
148 TestCon tc = new TestCon17(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
149 test_consub_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
150 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
151 // search constant substring (16 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
152 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
153 tc = new TestCon16(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
154 test_consub_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
155 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
156 // search constant substring (9 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
157 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
158 tc = new TestCon9(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
159 test_consub_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
160 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
161 // search constant substring (8 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
162 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
163 tc = new TestCon8(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
164 test_consub_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
165 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
166 // search constant substring (4 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
167 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
168 tc = new TestCon4(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
169 test_consub_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
170 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
171 // search constant substring (3 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
172 b = " 1111111111111xx1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
173 tc = new TestCon3(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
174 test_consub_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
175 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
176 // search constant substring (2 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
177 b = " 1111111111111xx1111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
178 tc = new TestCon2(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
179 test_consub_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
180 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
181 // search constant substring (1 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
182 b = " 1111111111111xx1111111111111xx1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
183 tc = new TestCon1(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
184 test_consub_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
185 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
186 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
187 // search non matching constant substring (17 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
188 b = " 1111111111111xx1111111111111xx1z"; // +1 to execute b.substring(1) first |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
189 tc = new TestCon17(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
190 test_conmis_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
191 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
192 // search non matching constant substring (16 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
193 b = " 1111111111111xx1111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
194 tc = new TestCon16(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
195 test_conmis_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
196 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
197 // search non matching constant substring (9 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
198 b = " 1111111111111xx1111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
199 tc = new TestCon9(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
200 test_conmis_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
201 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
202 // search non matching constant substring (8 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
203 b = " 1111111111111xx1111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
204 tc = new TestCon8(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
205 test_conmis_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
206 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
207 // search non matching constant substring (4 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
208 b = " 1111111111111xx1111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
209 tc = new TestCon4(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
210 test_conmis_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
211 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
212 // search non matching constant substring (3 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
213 b = " 1111111111111xx1111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
214 tc = new TestCon3(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
215 test_conmis_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
216 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
217 // search non matching constant substring (2 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
218 b = " 1111111111111xx1111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
219 tc = new TestCon2(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
220 test_conmis_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
221 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
222 // search non matching constant substring (1 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
223 b = " 1111111111111xx1111111111111xx1z"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
224 tc = new TestCon1(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
225 test_conmis_indexof(tc, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
226 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
227 long end_total = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
228 System.out.println("End run time: " + (end_total - start_total)); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
229 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
230 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
231 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
232 public static long test_init(String a, String b) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
233 for (int i = 0; i < 512; i++) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
234 strings[i * 2] = new String(b.toCharArray()); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
235 strings[i * 2 + 1] = new String(a.toCharArray()); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
236 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
237 System.out.print(a.length() + " " + b.length() + " "); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
238 return System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
239 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
240 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
241 public static void test_end(String a, String b, int v, int expected, long start) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
242 long end = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
243 int res = (v/ITERATIONS); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
244 System.out.print(" " + res); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
245 System.out.println(" time:" + (end - start)); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
246 if (res != expected) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
247 System.out.println("wrong indexOf result: " + res + ", expected " + expected); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
248 System.out.println("\"" + b + "\".indexOf(\"" + a + "\")"); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
249 System.exit(97); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
250 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
251 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
252 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
253 public static int test_subvar() { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
254 int s = 0; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
255 int v = 0; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
256 for (int i = 0; i < ITERATIONS; i++) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
257 v += strings[s].indexOf(strings[s + 1]); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
258 s += 2; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
259 if (s >= strings.length) s = 0; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
260 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
261 return v; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
262 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
263 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
264 public static void test_varsub_indexof(String a, String b) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
265 System.out.println("Start search variable size substring in string (" + b.length() + " chars)"); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
266 long start_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
267 int limit = 1; // last a.length() == 1 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
268 while (a.length() > limit) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
269 a = a.substring(1); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
270 long start = test_init(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
271 int v = test_subvar(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
272 test_end(a, b, v, (b.length() - a.length()), start); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
273 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
274 long end_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
275 System.out.println("End search variable size substring in string (" + b.length() + " chars), time: " + (end_it - start_it)); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
276 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
277 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
278 public static void test_varstr_indexof(String a, String b) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
279 System.out.println("Start search substring (" + a.length() + " chars) in variable size string"); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
280 long start_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
281 int limit = a.length(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
282 while (b.length() > limit) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
283 b = b.substring(1); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
284 long start = test_init(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
285 int v = test_subvar(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
286 test_end(a, b, v, (b.length() - a.length()), start); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
287 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
288 long end_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
289 System.out.println("End search substring (" + a.length() + " chars) in variable size string, time: " + (end_it - start_it)); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
290 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
291 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
292 public static void test_missub_indexof(String a, String b) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
293 System.out.println("Start search non matching variable size substring in string (" + b.length() + " chars)"); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
294 long start_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
295 int limit = 1; // last a.length() == 1 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
296 while (a.length() > limit) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
297 a = a.substring(1); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
298 long start = test_init(a, b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
299 int v = test_subvar(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
300 test_end(a, b, v, (-1), start); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
301 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
302 long end_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
303 System.out.println("End search non matching variable size substring in string (" + b.length() + " chars), time: " + (end_it - start_it)); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
304 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
305 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
306 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
307 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
308 public static void test_consub_indexof(TestCon tc, String b) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
309 System.out.println("Start search constant substring (" + tc.constr().length() + " chars)"); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
310 long start_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
311 int limit = tc.constr().length(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
312 while (b.length() > limit) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
313 b = b.substring(1); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
314 long start = test_init(tc.constr(), b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
315 int v = test_subcon(tc); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
316 test_end(tc.constr(), b, v, (b.length() - tc.constr().length()), start); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
317 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
318 long end_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
319 System.out.println("End search constant substring (" + tc.constr().length() + " chars), time: " + (end_it - start_it)); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
320 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
321 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
322 public static void test_conmis_indexof(TestCon tc, String b) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
323 System.out.println("Start search non matching constant substring (" + tc.constr().length() + " chars)"); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
324 long start_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
325 int limit = tc.constr().length(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
326 while (b.length() > limit) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
327 b = b.substring(1); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
328 long start = test_init(tc.constr(), b); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
329 int v = test_subcon(tc); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
330 test_end(tc.constr(), b, v, (-1), start); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
331 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
332 long end_it = System.currentTimeMillis(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
333 System.out.println("End search non matching constant substring (" + tc.constr().length() + " chars), time: " + (end_it - start_it)); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
334 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
335 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
336 public static int test_subcon(TestCon tc) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
337 int s = 0; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
338 int v = 0; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
339 for (int i = 0; i < ITERATIONS; i++) { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
340 v += tc.indexOf(strings[s]); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
341 s += 2; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
342 if (s >= strings.length) s = 0; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
343 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
344 return v; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
345 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
346 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
347 private interface TestCon { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
348 public String constr(); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
349 public int indexOf(String str); |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
350 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
351 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
352 // search constant substring (17 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
353 private final static class TestCon17 implements TestCon { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
354 private static final String constr = "1111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
355 public String constr() { return constr; } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
356 public int indexOf(String str) { return str.indexOf(constr); } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
357 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
358 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
359 // search constant substring (16 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
360 private final static class TestCon16 implements TestCon { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
361 private static final String constr = "111111111111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
362 public String constr() { return constr; } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
363 public int indexOf(String str) { return str.indexOf(constr); } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
364 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
365 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
366 // search constant substring (9 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
367 private final static class TestCon9 implements TestCon { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
368 private static final String constr = "11111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
369 public String constr() { return constr; } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
370 public int indexOf(String str) { return str.indexOf(constr); } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
371 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
372 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
373 // search constant substring (8 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
374 private final static class TestCon8 implements TestCon { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
375 private static final String constr = "1111xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
376 public String constr() { return constr; } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
377 public int indexOf(String str) { return str.indexOf(constr); } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
378 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
379 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
380 // search constant substring (4 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
381 private final static class TestCon4 implements TestCon { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
382 private static final String constr = "xx1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
383 public String constr() { return constr; } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
384 public int indexOf(String str) { return str.indexOf(constr); } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
385 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
386 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
387 // search constant substring (3 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
388 private final static class TestCon3 implements TestCon { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
389 private static final String constr = "x1x"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
390 public String constr() { return constr; } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
391 public int indexOf(String str) { return str.indexOf(constr); } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
392 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
393 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
394 // search constant substring (2 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
395 private final static class TestCon2 implements TestCon { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
396 private static final String constr = "1y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
397 public String constr() { return constr; } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
398 public int indexOf(String str) { return str.indexOf(constr); } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
399 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
400 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
401 |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
402 // search constant substring (1 chars). |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
403 private final static class TestCon1 implements TestCon { |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
404 private static final String constr = "y"; |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
405 public String constr() { return constr; } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
406 public int indexOf(String str) { return str.indexOf(constr); } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
407 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
408 } |
41d4973cf100
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
409 |