comparison src/share/vm/prims/methodComparator.cpp @ 2142:8012aa3ccede

4926272: methodOopDesc::method_from_bcp is unsafe Reviewed-by: coleenp, jrose, kvn, dcubed
author never
date Thu, 13 Jan 2011 22:15:41 -0800
parents f95d63e2154a
children 3582bf76420e
comparison
equal deleted inserted replaced
2130:34d64ad817f4 2142:8012aa3ccede
1 /* 1 /*
2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
192 break; 192 break;
193 } 193 }
194 194
195 case Bytecodes::_ldc : // fall through 195 case Bytecodes::_ldc : // fall through
196 case Bytecodes::_ldc_w : { 196 case Bytecodes::_ldc_w : {
197 Bytecode_loadconstant* ldc_old = Bytecode_loadconstant_at(_s_old->method(), _s_old->bci()); 197 Bytecode_loadconstant ldc_old(_s_old->method(), _s_old->bci());
198 Bytecode_loadconstant* ldc_new = Bytecode_loadconstant_at(_s_new->method(), _s_new->bci()); 198 Bytecode_loadconstant ldc_new(_s_new->method(), _s_new->bci());
199 int cpi_old = ldc_old->pool_index(); 199 int cpi_old = ldc_old.pool_index();
200 int cpi_new = ldc_new->pool_index(); 200 int cpi_new = ldc_new.pool_index();
201 if (!pool_constants_same(cpi_old, cpi_new)) 201 if (!pool_constants_same(cpi_old, cpi_new))
202 return false; 202 return false;
203 break; 203 break;
204 } 204 }
205 205
265 case Bytecodes::_ifgt : // fall through 265 case Bytecodes::_ifgt : // fall through
266 case Bytecodes::_ifle : // fall through 266 case Bytecodes::_ifle : // fall through
267 case Bytecodes::_ifnonnull : // fall through 267 case Bytecodes::_ifnonnull : // fall through
268 case Bytecodes::_ifnull : // fall through 268 case Bytecodes::_ifnull : // fall through
269 case Bytecodes::_jsr : { 269 case Bytecodes::_jsr : {
270 int old_ofs = _s_old->bytecode()->get_offset_s2(c_old); 270 int old_ofs = _s_old->bytecode().get_offset_s2(c_old);
271 int new_ofs = _s_new->bytecode()->get_offset_s2(c_new); 271 int new_ofs = _s_new->bytecode().get_offset_s2(c_new);
272 if (_switchable_test) { 272 if (_switchable_test) {
273 int old_dest = _s_old->bci() + old_ofs; 273 int old_dest = _s_old->bci() + old_ofs;
274 int new_dest = _s_new->bci() + new_ofs; 274 int new_dest = _s_new->bci() + new_ofs;
275 if (old_ofs < 0 && new_ofs < 0) { 275 if (old_ofs < 0 && new_ofs < 0) {
276 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest)) 276 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest))
302 } 302 }
303 break; 303 break;
304 304
305 case Bytecodes::_goto_w : // fall through 305 case Bytecodes::_goto_w : // fall through
306 case Bytecodes::_jsr_w : { 306 case Bytecodes::_jsr_w : {
307 int old_ofs = _s_old->bytecode()->get_offset_s4(c_old); 307 int old_ofs = _s_old->bytecode().get_offset_s4(c_old);
308 int new_ofs = _s_new->bytecode()->get_offset_s4(c_new); 308 int new_ofs = _s_new->bytecode().get_offset_s4(c_new);
309 if (_switchable_test) { 309 if (_switchable_test) {
310 int old_dest = _s_old->bci() + old_ofs; 310 int old_dest = _s_old->bci() + old_ofs;
311 int new_dest = _s_new->bci() + new_ofs; 311 int new_dest = _s_new->bci() + new_ofs;
312 if (old_ofs < 0 && new_ofs < 0) { 312 if (old_ofs < 0 && new_ofs < 0) {
313 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest)) 313 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest))