Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/methodComparator.cpp @ 1574:1eb493f33423
6957080: MethodComparator needs stress testing
Summary: Add a stress-test flag for running MethodComparator over many inputs. Fix bugs that crop up.
Reviewed-by: kvn
author | jrose |
---|---|
date | Sat, 29 May 2010 19:22:32 -0700 |
parents | beb77f0d41b3 |
children | e9ff18c4ace7 |
comparison
equal
deleted
inserted
replaced
1573:beb77f0d41b3 | 1574:1eb493f33423 |
---|---|
161 break; | 161 break; |
162 } | 162 } |
163 | 163 |
164 case Bytecodes::_ldc : // fall through | 164 case Bytecodes::_ldc : // fall through |
165 case Bytecodes::_ldc_w : { | 165 case Bytecodes::_ldc_w : { |
166 u2 cpi_old, cpi_new; | 166 Bytecode_loadconstant* ldc_old = Bytecode_loadconstant_at(_s_old->method()(), _s_old->bcp()); |
167 if (c_old == Bytecodes::_ldc) { | 167 Bytecode_loadconstant* ldc_new = Bytecode_loadconstant_at(_s_new->method()(), _s_new->bcp()); |
168 cpi_old = _s_old->bcp()[1]; | 168 int cpi_old = ldc_old->index(); |
169 cpi_new = _s_new->bcp()[1]; | 169 int cpi_new = ldc_new->index(); |
170 } else { | |
171 cpi_old = _s_old->get_index_u2(); | |
172 cpi_new = _s_new->get_index_u2(); | |
173 } | |
174 constantTag tag_old = _old_cp->tag_at(cpi_old); | 170 constantTag tag_old = _old_cp->tag_at(cpi_old); |
175 constantTag tag_new = _new_cp->tag_at(cpi_new); | 171 constantTag tag_new = _new_cp->tag_at(cpi_new); |
176 if (tag_old.is_int() || tag_old.is_float()) { | 172 if (tag_old.is_int() || tag_old.is_float()) { |
177 if (tag_old.value() != tag_new.value()) | 173 if (tag_old.value() != tag_new.value()) |
178 return false; | 174 return false; |
179 if (tag_old.is_int()) { | 175 if (tag_old.is_int()) { |
180 if (_old_cp->int_at(cpi_old) != _new_cp->int_at(cpi_new)) | 176 if (_old_cp->int_at(cpi_old) != _new_cp->int_at(cpi_new)) |
181 return false; | 177 return false; |
182 } else { | 178 } else { |
183 if (_old_cp->float_at(cpi_old) != _new_cp->float_at(cpi_new)) | 179 // Use jint_cast to compare the bits rather than numerical values. |
180 // This makes a difference for NaN constants. | |
181 if (jint_cast(_old_cp->float_at(cpi_old)) != jint_cast(_new_cp->float_at(cpi_new))) | |
184 return false; | 182 return false; |
185 } | 183 } |
186 } else if (tag_old.is_string() || tag_old.is_unresolved_string()) { | 184 } else if (tag_old.is_string() || tag_old.is_unresolved_string()) { |
187 if (! (tag_new.is_unresolved_string() || tag_new.is_string())) | 185 if (! (tag_new.is_unresolved_string() || tag_new.is_string())) |
188 return false; | 186 return false; |
208 return false; | 206 return false; |
209 if (tag_old.is_long()) { | 207 if (tag_old.is_long()) { |
210 if (_old_cp->long_at(cpi_old) != _new_cp->long_at(cpi_new)) | 208 if (_old_cp->long_at(cpi_old) != _new_cp->long_at(cpi_new)) |
211 return false; | 209 return false; |
212 } else { | 210 } else { |
213 if (_old_cp->double_at(cpi_old) != _new_cp->double_at(cpi_new)) | 211 // Use jlong_cast to compare the bits rather than numerical values. |
212 // This makes a difference for NaN constants. | |
213 if (jlong_cast(_old_cp->double_at(cpi_old)) != jlong_cast(_new_cp->double_at(cpi_new))) | |
214 return false; | 214 return false; |
215 } | 215 } |
216 break; | 216 break; |
217 } | 217 } |
218 | 218 |
259 case Bytecodes::_ifgt : // fall through | 259 case Bytecodes::_ifgt : // fall through |
260 case Bytecodes::_ifle : // fall through | 260 case Bytecodes::_ifle : // fall through |
261 case Bytecodes::_ifnonnull : // fall through | 261 case Bytecodes::_ifnonnull : // fall through |
262 case Bytecodes::_ifnull : // fall through | 262 case Bytecodes::_ifnull : // fall through |
263 case Bytecodes::_jsr : { | 263 case Bytecodes::_jsr : { |
264 short old_ofs = (short) _s_old->get_index_u2(); | 264 int old_ofs = _s_old->bytecode()->get_offset_s2(c_old); |
265 short new_ofs = (short) _s_new->get_index_u2(); | 265 int new_ofs = _s_new->bytecode()->get_offset_s2(c_new); |
266 if (_switchable_test) { | 266 if (_switchable_test) { |
267 int old_dest = _s_old->bci() + old_ofs; | 267 int old_dest = _s_old->bci() + old_ofs; |
268 int new_dest = _s_new->bci() + new_ofs; | 268 int new_dest = _s_new->bci() + new_ofs; |
269 if (old_ofs < 0 && new_ofs < 0) { | 269 if (old_ofs < 0 && new_ofs < 0) { |
270 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest)) | 270 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest)) |
296 } | 296 } |
297 break; | 297 break; |
298 | 298 |
299 case Bytecodes::_goto_w : // fall through | 299 case Bytecodes::_goto_w : // fall through |
300 case Bytecodes::_jsr_w : { | 300 case Bytecodes::_jsr_w : { |
301 int old_ofs = (int) Bytes::get_Java_u4(_s_old->bcp() + 1); | 301 int old_ofs = _s_old->bytecode()->get_offset_s4(c_old); |
302 int new_ofs = (int) Bytes::get_Java_u4(_s_new->bcp() + 1); | 302 int new_ofs = _s_new->bytecode()->get_offset_s4(c_new); |
303 if (_switchable_test) { | 303 if (_switchable_test) { |
304 int old_dest = _s_old->bci() + old_ofs; | 304 int old_dest = _s_old->bci() + old_ofs; |
305 int new_dest = _s_new->bci() + new_ofs; | 305 int new_dest = _s_new->bci() + new_ofs; |
306 if (old_ofs < 0 && new_ofs < 0) { | 306 if (old_ofs < 0 && new_ofs < 0) { |
307 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest)) | 307 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest)) |