1 /*
2 * Copyright (c) 2003, 2011, 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 *
2461 // table to use new constant indices as needed.
2462 int cext_length = method->checked_exceptions_length();
2463 if (cext_length > 0) {
2464 CheckedExceptionElement * cext_table =
2465 method->checked_exceptions_start();
2466 for (int j = 0; j < cext_length; j++) {
2467 int cur_index = cext_table[j].class_cp_index;
2468 int new_index = find_new_index(cur_index);
2469 if (new_index != 0) {
2470 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2471 ("cext-class_cp_index change: %d to %d", cur_index, new_index));
2472 cext_table[j].class_cp_index = (u2)new_index;
2473 }
2474 } // end for each checked exception table entry
2475 } // end if there are checked exception table entries
2476
2477 // Update each catch type index in the method's exception table
2478 // to use new constant pool indices as needed. The exception table
2479 // holds quadruple entries of the form:
2480 // (beg_bci, end_bci, handler_bci, klass_index)
2481 const int beg_bci_offset = 0;
2482 const int end_bci_offset = 1;
2483 const int handler_bci_offset = 2;
2484 const int klass_index_offset = 3;
2485 const int entry_size = 4;
2486
2487 typeArrayHandle ex_table (THREAD, method->exception_table());
2488 int ext_length = ex_table->length();
2489 assert(ext_length % entry_size == 0, "exception table format has changed");
2490
2491 for (int j = 0; j < ext_length; j += entry_size) {
2492 int cur_index = ex_table->int_at(j + klass_index_offset);
2493 int new_index = find_new_index(cur_index);
2494 if (new_index != 0) {
2495 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2496 ("ext-klass_index change: %d to %d", cur_index, new_index));
2497 ex_table->int_at_put(j + klass_index_offset, new_index);
2498 }
2499 } // end for each exception table entry
2500
2501 // Update constant pool indices in the method's local variable
2502 // table to use new constant indices as needed. The local variable
2503 // table hold sextuple entries of the form:
2504 // (start_pc, length, name_index, descriptor_index, signature_index, slot)
2505 int lvt_length = method->localvariable_table_length();
2506 if (lvt_length > 0) {
2507 LocalVariableTableElement * lv_table =
2508 method->localvariable_table_start();
2509 for (int j = 0; j < lvt_length; j++) {
2510 int cur_index = lv_table[j].name_cp_index;
2511 int new_index = find_new_index(cur_index);
2512 if (new_index != 0) {
2513 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2514 ("lvt-name_cp_index change: %d to %d", cur_index, new_index));
2515 lv_table[j].name_cp_index = (u2)new_index;
2516 }
2517 cur_index = lv_table[j].descriptor_cp_index;
|
1 /*
2 * Copyright (c) 2003, 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 *
2461 // table to use new constant indices as needed.
2462 int cext_length = method->checked_exceptions_length();
2463 if (cext_length > 0) {
2464 CheckedExceptionElement * cext_table =
2465 method->checked_exceptions_start();
2466 for (int j = 0; j < cext_length; j++) {
2467 int cur_index = cext_table[j].class_cp_index;
2468 int new_index = find_new_index(cur_index);
2469 if (new_index != 0) {
2470 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2471 ("cext-class_cp_index change: %d to %d", cur_index, new_index));
2472 cext_table[j].class_cp_index = (u2)new_index;
2473 }
2474 } // end for each checked exception table entry
2475 } // end if there are checked exception table entries
2476
2477 // Update each catch type index in the method's exception table
2478 // to use new constant pool indices as needed. The exception table
2479 // holds quadruple entries of the form:
2480 // (beg_bci, end_bci, handler_bci, klass_index)
2481
2482 ExceptionTable ex_table(method());
2483 int ext_length = ex_table.length();
2484
2485 for (int j = 0; j < ext_length; j ++) {
2486 int cur_index = ex_table.catch_type_index(j);
2487 int new_index = find_new_index(cur_index);
2488 if (new_index != 0) {
2489 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2490 ("ext-klass_index change: %d to %d", cur_index, new_index));
2491 ex_table.set_catch_type_index(j, new_index);
2492 }
2493 } // end for each exception table entry
2494
2495 // Update constant pool indices in the method's local variable
2496 // table to use new constant indices as needed. The local variable
2497 // table hold sextuple entries of the form:
2498 // (start_pc, length, name_index, descriptor_index, signature_index, slot)
2499 int lvt_length = method->localvariable_table_length();
2500 if (lvt_length > 0) {
2501 LocalVariableTableElement * lv_table =
2502 method->localvariable_table_start();
2503 for (int j = 0; j < lvt_length; j++) {
2504 int cur_index = lv_table[j].name_cp_index;
2505 int new_index = find_new_index(cur_index);
2506 if (new_index != 0) {
2507 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2508 ("lvt-name_cp_index change: %d to %d", cur_index, new_index));
2509 lv_table[j].name_cp_index = (u2)new_index;
2510 }
2511 cur_index = lv_table[j].descriptor_cp_index;
|