author | serb |
Fri, 18 Apr 2014 20:10:39 +0400 | |
changeset 24521 | 97047c850d31 |
parent 8494 | 4258c78226d9 |
permissions | -rw-r--r-- |
8494
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
1 |
/* |
4258c78226d9
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. |
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
4 |
* |
4258c78226d9
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 |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
8 |
* |
4258c78226d9
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 |
4258c78226d9
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 |
4258c78226d9
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 |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
13 |
* accompanied this code). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
14 |
* |
4258c78226d9
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 |
4258c78226d9
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, |
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
18 |
* |
4258c78226d9
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 |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
21 |
* questions. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
22 |
* |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
23 |
*/ |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
24 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
25 |
/** |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
26 |
* @test |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
27 |
* @bug 6942326 |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
29 |
* |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
31 |
* |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
32 |
*/ |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
33 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
34 |
public class Test { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
35 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
36 |
static String[] strings = new String[1024]; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
37 |
private static final int ITERATIONS = 100000; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
38 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
39 |
public static void main(String[] args) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
40 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
41 |
long start_total = System.currentTimeMillis(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
42 |
|
4258c78226d9
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). |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
45 |
String b = "1111111111111xx1111111111111xx11y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
46 |
test_varsub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
47 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
49 |
a = " 1111111111111xx1111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
50 |
b = "1111111111111xx1111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
51 |
test_varsub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
52 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
54 |
a = " 1111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
55 |
b = "1111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
56 |
test_varsub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
57 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
59 |
a = " 111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
60 |
b = "111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
61 |
test_varsub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
62 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
64 |
a = " 1111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
65 |
b = "1111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
66 |
test_varsub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
67 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
69 |
a = " 111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
70 |
b = "111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
71 |
test_varsub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
72 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
73 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
74 |
|
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
76 |
a = "1111111111111xx1x"; |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
78 |
test_varstr_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
79 |
|
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
81 |
a = "111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
82 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
83 |
test_varstr_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
84 |
|
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
86 |
a = "11111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
87 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
88 |
test_varstr_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
89 |
|
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
91 |
a = "1111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
92 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
93 |
test_varstr_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
94 |
|
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
96 |
a = "xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
97 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
98 |
test_varstr_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
99 |
|
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
101 |
a = "x1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
102 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
103 |
test_varstr_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
104 |
|
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
106 |
a = "1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
107 |
b = " 1111111111111xx1111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
108 |
test_varstr_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
109 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
110 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
111 |
|
4258c78226d9
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). |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
114 |
b = "1111111111111xx1111111111111xx11y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
115 |
test_missub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
116 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
118 |
a = " 1111111111111xx1111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
119 |
b = "1111111111111xx1111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
120 |
test_missub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
121 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
123 |
a = " 1111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
124 |
b = "1111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
125 |
test_missub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
126 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
128 |
a = " 111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
129 |
b = "111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
130 |
test_missub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
131 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
133 |
a = " 1111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
134 |
b = "1111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
135 |
test_missub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
136 |
|
4258c78226d9
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). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
138 |
a = " 111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
139 |
b = "111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
140 |
test_missub_indexof(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
141 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
142 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
143 |
|
4258c78226d9
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. |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
145 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
146 |
// search constant substring (17 chars). |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
148 |
TestCon tc = new TestCon17(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
149 |
test_consub_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
150 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
151 |
// search constant substring (16 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
152 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
153 |
tc = new TestCon16(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
154 |
test_consub_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
155 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
156 |
// search constant substring (9 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
157 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
158 |
tc = new TestCon9(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
159 |
test_consub_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
160 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
161 |
// search constant substring (8 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
162 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
163 |
tc = new TestCon8(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
164 |
test_consub_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
165 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
166 |
// search constant substring (4 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
167 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
168 |
tc = new TestCon4(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
169 |
test_consub_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
170 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
171 |
// search constant substring (3 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
172 |
b = " 1111111111111xx1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
173 |
tc = new TestCon3(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
174 |
test_consub_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
175 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
176 |
// search constant substring (2 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
177 |
b = " 1111111111111xx1111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
178 |
tc = new TestCon2(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
179 |
test_consub_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
180 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
181 |
// search constant substring (1 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
182 |
b = " 1111111111111xx1111111111111xx1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
183 |
tc = new TestCon1(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
184 |
test_consub_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
185 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
186 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
187 |
// search non matching constant substring (17 chars). |
4258c78226d9
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 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
189 |
tc = new TestCon17(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
190 |
test_conmis_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
191 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
192 |
// search non matching constant substring (16 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
193 |
b = " 1111111111111xx1111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
194 |
tc = new TestCon16(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
195 |
test_conmis_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
196 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
197 |
// search non matching constant substring (9 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
198 |
b = " 1111111111111xx1111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
199 |
tc = new TestCon9(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
200 |
test_conmis_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
201 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
202 |
// search non matching constant substring (8 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
203 |
b = " 1111111111111xx1111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
204 |
tc = new TestCon8(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
205 |
test_conmis_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
206 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
207 |
// search non matching constant substring (4 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
208 |
b = " 1111111111111xx1111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
209 |
tc = new TestCon4(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
210 |
test_conmis_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
211 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
212 |
// search non matching constant substring (3 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
213 |
b = " 1111111111111xx1111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
214 |
tc = new TestCon3(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
215 |
test_conmis_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
216 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
217 |
// search non matching constant substring (2 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
218 |
b = " 1111111111111xx1111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
219 |
tc = new TestCon2(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
220 |
test_conmis_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
221 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
222 |
// search non matching constant substring (1 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
223 |
b = " 1111111111111xx1111111111111xx1z"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
224 |
tc = new TestCon1(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
225 |
test_conmis_indexof(tc, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
226 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
227 |
long end_total = System.currentTimeMillis(); |
4258c78226d9
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)); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
229 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
230 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
231 |
|
4258c78226d9
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) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
233 |
for (int i = 0; i < 512; i++) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
234 |
strings[i * 2] = new String(b.toCharArray()); |
4258c78226d9
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()); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
236 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
237 |
System.out.print(a.length() + " " + b.length() + " "); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
238 |
return System.currentTimeMillis(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
239 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
240 |
|
4258c78226d9
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) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
242 |
long end = System.currentTimeMillis(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
243 |
int res = (v/ITERATIONS); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
244 |
System.out.print(" " + res); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
245 |
System.out.println(" time:" + (end - start)); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
246 |
if (res != expected) { |
4258c78226d9
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); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
248 |
System.out.println("\"" + b + "\".indexOf(\"" + a + "\")"); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
249 |
System.exit(97); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
250 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
251 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
252 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
253 |
public static int test_subvar() { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
254 |
int s = 0; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
255 |
int v = 0; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
256 |
for (int i = 0; i < ITERATIONS; i++) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
257 |
v += strings[s].indexOf(strings[s + 1]); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
258 |
s += 2; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
259 |
if (s >= strings.length) s = 0; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
260 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
261 |
return v; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
262 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
263 |
|
4258c78226d9
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) { |
4258c78226d9
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)"); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
266 |
long start_it = System.currentTimeMillis(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
267 |
int limit = 1; // last a.length() == 1 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
268 |
while (a.length() > limit) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
269 |
a = a.substring(1); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
270 |
long start = test_init(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
271 |
int v = test_subvar(); |
4258c78226d9
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); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
273 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
274 |
long end_it = System.currentTimeMillis(); |
4258c78226d9
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)); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
276 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
277 |
|
4258c78226d9
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) { |
4258c78226d9
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"); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
280 |
long start_it = System.currentTimeMillis(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
281 |
int limit = a.length(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
282 |
while (b.length() > limit) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
283 |
b = b.substring(1); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
284 |
long start = test_init(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
285 |
int v = test_subvar(); |
4258c78226d9
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); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
287 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
288 |
long end_it = System.currentTimeMillis(); |
4258c78226d9
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)); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
290 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
291 |
|
4258c78226d9
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) { |
4258c78226d9
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)"); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
294 |
long start_it = System.currentTimeMillis(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
295 |
int limit = 1; // last a.length() == 1 |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
296 |
while (a.length() > limit) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
297 |
a = a.substring(1); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
298 |
long start = test_init(a, b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
299 |
int v = test_subvar(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
300 |
test_end(a, b, v, (-1), start); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
301 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
302 |
long end_it = System.currentTimeMillis(); |
4258c78226d9
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)); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
304 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
305 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
306 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
307 |
|
4258c78226d9
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) { |
4258c78226d9
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)"); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
310 |
long start_it = System.currentTimeMillis(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
311 |
int limit = tc.constr().length(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
312 |
while (b.length() > limit) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
313 |
b = b.substring(1); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
314 |
long start = test_init(tc.constr(), b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
315 |
int v = test_subcon(tc); |
4258c78226d9
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); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
317 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
318 |
long end_it = System.currentTimeMillis(); |
4258c78226d9
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)); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
320 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
321 |
|
4258c78226d9
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) { |
4258c78226d9
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)"); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
324 |
long start_it = System.currentTimeMillis(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
325 |
int limit = tc.constr().length(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
326 |
while (b.length() > limit) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
327 |
b = b.substring(1); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
328 |
long start = test_init(tc.constr(), b); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
329 |
int v = test_subcon(tc); |
4258c78226d9
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); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
331 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
332 |
long end_it = System.currentTimeMillis(); |
4258c78226d9
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)); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
334 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
335 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
336 |
public static int test_subcon(TestCon tc) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
337 |
int s = 0; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
338 |
int v = 0; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
339 |
for (int i = 0; i < ITERATIONS; i++) { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
340 |
v += tc.indexOf(strings[s]); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
341 |
s += 2; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
342 |
if (s >= strings.length) s = 0; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
343 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
344 |
return v; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
345 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
346 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
347 |
private interface TestCon { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
348 |
public String constr(); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
349 |
public int indexOf(String str); |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
350 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
351 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
352 |
// search constant substring (17 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
353 |
private final static class TestCon17 implements TestCon { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
354 |
private static final String constr = "1111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
355 |
public String constr() { return constr; } |
4258c78226d9
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); } |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
357 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
358 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
359 |
// search constant substring (16 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
360 |
private final static class TestCon16 implements TestCon { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
361 |
private static final String constr = "111111111111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
362 |
public String constr() { return constr; } |
4258c78226d9
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); } |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
364 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
365 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
366 |
// search constant substring (9 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
367 |
private final static class TestCon9 implements TestCon { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
368 |
private static final String constr = "11111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
369 |
public String constr() { return constr; } |
4258c78226d9
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); } |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
371 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
372 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
373 |
// search constant substring (8 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
374 |
private final static class TestCon8 implements TestCon { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
375 |
private static final String constr = "1111xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
376 |
public String constr() { return constr; } |
4258c78226d9
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); } |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
378 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
379 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
380 |
// search constant substring (4 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
381 |
private final static class TestCon4 implements TestCon { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
382 |
private static final String constr = "xx1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
383 |
public String constr() { return constr; } |
4258c78226d9
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); } |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
385 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
386 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
387 |
// search constant substring (3 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
388 |
private final static class TestCon3 implements TestCon { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
389 |
private static final String constr = "x1x"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
390 |
public String constr() { return constr; } |
4258c78226d9
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); } |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
392 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
393 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
394 |
// search constant substring (2 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
395 |
private final static class TestCon2 implements TestCon { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
396 |
private static final String constr = "1y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
397 |
public String constr() { return constr; } |
4258c78226d9
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); } |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
399 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
400 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
401 |
|
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
402 |
// search constant substring (1 chars). |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
403 |
private final static class TestCon1 implements TestCon { |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
404 |
private static final String constr = "y"; |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
405 |
public String constr() { return constr; } |
4258c78226d9
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); } |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
407 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
408 |
} |
4258c78226d9
6942326: x86 code in string_indexof() could read beyond reserved heap space
kvn
parents:
diff
changeset
|
409 |