1 /*
2 * Copyright (c) 1997, 2010, 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 *
375 change_jump(bci, bci + 1 + oldPad + 4*(2 + 2*k + 1), false, break_bci, delta);
376 }
377 /* Special next-bci calculation here... */
378 bci += 1 + oldPad + (2 + (npairs*2))*4;
379 continue;
380 }
381 default:
382 ShouldNotReachHere();
383 }
384 }
385 default:
386 break;
387 }
388 bci += rc_instr_len(bci);
389 }
390 }
391
392 // The width of instruction at "pc" is changing by "delta". Adjust the
393 // exception table, if any, of "rc->mb".
394 void Relocator::adjust_exception_table(int bci, int delta) {
395 typeArrayOop table = method()->exception_table();
396 for (int index = 0; index < table->length(); index +=4) {
397 if (table->int_at(index) > bci) {
398 table->int_at_put(index+0, table->int_at(index+0) + delta);
399 table->int_at_put(index+1, table->int_at(index+1) + delta);
400 } else if (bci < table->int_at(index+1)) {
401 table->int_at_put(index+1, table->int_at(index+1) + delta);
402 }
403 if (table->int_at(index+2) > bci)
404 table->int_at_put(index+2, table->int_at(index+2) + delta);
405 }
406 }
407
408
409 // The width of instruction at "bci" is changing by "delta". Adjust the line number table.
410 void Relocator::adjust_line_no_table(int bci, int delta) {
411 if (method()->has_linenumber_table()) {
412 CompressedLineNumberReadStream reader(method()->compressed_linenumber_table());
413 CompressedLineNumberWriteStream writer(64); // plenty big for most line number tables
414 while (reader.read_pair()) {
415 int adjustment = (reader.bci() > bci) ? delta : 0;
416 writer.write_pair(reader.bci() + adjustment, reader.line());
417 }
418 writer.write_terminator();
419 set_compressed_line_number_table(writer.buffer());
420 set_compressed_line_number_table_size(writer.position());
421 }
422 }
423
424
|
1 /*
2 * Copyright (c) 1997, 2012, 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 *
375 change_jump(bci, bci + 1 + oldPad + 4*(2 + 2*k + 1), false, break_bci, delta);
376 }
377 /* Special next-bci calculation here... */
378 bci += 1 + oldPad + (2 + (npairs*2))*4;
379 continue;
380 }
381 default:
382 ShouldNotReachHere();
383 }
384 }
385 default:
386 break;
387 }
388 bci += rc_instr_len(bci);
389 }
390 }
391
392 // The width of instruction at "pc" is changing by "delta". Adjust the
393 // exception table, if any, of "rc->mb".
394 void Relocator::adjust_exception_table(int bci, int delta) {
395 ExceptionTable table(_method());
396 for (int index = 0; index < table.length(); index ++) {
397 if (table.start_pc(index) > bci) {
398 table.set_start_pc(index, table.start_pc(index) + delta);
399 table.set_end_pc(index, table.end_pc(index) + delta);
400 } else if (bci < table.end_pc(index)) {
401 table.set_end_pc(index, table.end_pc(index) + delta);
402 }
403 if (table.handler_pc(index) > bci)
404 table.set_handler_pc(index, table.handler_pc(index) + delta);
405 }
406 }
407
408
409 // The width of instruction at "bci" is changing by "delta". Adjust the line number table.
410 void Relocator::adjust_line_no_table(int bci, int delta) {
411 if (method()->has_linenumber_table()) {
412 CompressedLineNumberReadStream reader(method()->compressed_linenumber_table());
413 CompressedLineNumberWriteStream writer(64); // plenty big for most line number tables
414 while (reader.read_pair()) {
415 int adjustment = (reader.bci() > bci) ? delta : 0;
416 writer.write_pair(reader.bci() + adjustment, reader.line());
417 }
418 writer.write_terminator();
419 set_compressed_line_number_table(writer.buffer());
420 set_compressed_line_number_table_size(writer.position());
421 }
422 }
423
424
|