1 /*
2 * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
235
236 case Bytecodes::_goto_w : // fall through
237 case Bytecodes::_jsr_w : {
238 int old_ofs = _s_old->bytecode().get_offset_s4(c_old);
239 int new_ofs = _s_new->bytecode().get_offset_s4(c_new);
240 if (old_ofs != new_ofs)
241 return false;
242 break;
243 }
244
245 case Bytecodes::_lookupswitch : // fall through
246 case Bytecodes::_tableswitch : {
247 int len_old = _s_old->instruction_size();
248 int len_new = _s_new->instruction_size();
249 if (len_old != len_new)
250 return false;
251 if (memcmp(_s_old->bcp(), _s_new->bcp(), len_old) != 0)
252 return false;
253 break;
254 }
255 }
256
257 return true;
258 }
259
260 bool MethodComparator::pool_constants_same(int cpi_old, int cpi_new) {
261 constantTag tag_old = _old_cp->tag_at(cpi_old);
262 constantTag tag_new = _new_cp->tag_at(cpi_new);
263 if (tag_old.is_int() || tag_old.is_float()) {
264 if (tag_old.value() != tag_new.value())
265 return false;
266 if (tag_old.is_int()) {
267 if (_old_cp->int_at(cpi_old) != _new_cp->int_at(cpi_new))
268 return false;
269 } else {
270 // Use jint_cast to compare the bits rather than numerical values.
271 // This makes a difference for NaN constants.
272 if (jint_cast(_old_cp->float_at(cpi_old)) != jint_cast(_new_cp->float_at(cpi_new)))
273 return false;
274 }
|
1 /*
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
235
236 case Bytecodes::_goto_w : // fall through
237 case Bytecodes::_jsr_w : {
238 int old_ofs = _s_old->bytecode().get_offset_s4(c_old);
239 int new_ofs = _s_new->bytecode().get_offset_s4(c_new);
240 if (old_ofs != new_ofs)
241 return false;
242 break;
243 }
244
245 case Bytecodes::_lookupswitch : // fall through
246 case Bytecodes::_tableswitch : {
247 int len_old = _s_old->instruction_size();
248 int len_new = _s_new->instruction_size();
249 if (len_old != len_new)
250 return false;
251 if (memcmp(_s_old->bcp(), _s_new->bcp(), len_old) != 0)
252 return false;
253 break;
254 }
255
256 default:
257 break;
258 }
259
260 return true;
261 }
262
263 bool MethodComparator::pool_constants_same(int cpi_old, int cpi_new) {
264 constantTag tag_old = _old_cp->tag_at(cpi_old);
265 constantTag tag_new = _new_cp->tag_at(cpi_new);
266 if (tag_old.is_int() || tag_old.is_float()) {
267 if (tag_old.value() != tag_new.value())
268 return false;
269 if (tag_old.is_int()) {
270 if (_old_cp->int_at(cpi_old) != _new_cp->int_at(cpi_new))
271 return false;
272 } else {
273 // Use jint_cast to compare the bits rather than numerical values.
274 // This makes a difference for NaN constants.
275 if (jint_cast(_old_cp->float_at(cpi_old)) != jint_cast(_new_cp->float_at(cpi_new)))
276 return false;
277 }
|