< prev index next >

src/share/vm/prims/jvmtiRedefineClasses.cpp

Print this page
rev 4134 : 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
Summary: Change constMethodOop::_exception_table to optionally inlined u2 table.
Reviewed-by: bdelsart, coleenp, kamg


2479     // table to use new constant indices as needed.
2480     int cext_length = method->checked_exceptions_length();
2481     if (cext_length > 0) {
2482       CheckedExceptionElement * cext_table =
2483         method->checked_exceptions_start();
2484       for (int j = 0; j < cext_length; j++) {
2485         int cur_index = cext_table[j].class_cp_index;
2486         int new_index = find_new_index(cur_index);
2487         if (new_index != 0) {
2488           RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2489             ("cext-class_cp_index change: %d to %d", cur_index, new_index));
2490           cext_table[j].class_cp_index = (u2)new_index;
2491         }
2492       } // end for each checked exception table entry
2493     } // end if there are checked exception table entries
2494 
2495     // Update each catch type index in the method's exception table
2496     // to use new constant pool indices as needed. The exception table
2497     // holds quadruple entries of the form:
2498     //   (beg_bci, end_bci, handler_bci, klass_index)
2499     const int beg_bci_offset     = 0;
2500     const int end_bci_offset     = 1;
2501     const int handler_bci_offset = 2;
2502     const int klass_index_offset = 3;
2503     const int entry_size         = 4;
2504 
2505     typeArrayHandle ex_table (THREAD, method->exception_table());
2506     int ext_length = ex_table->length();
2507     assert(ext_length % entry_size == 0, "exception table format has changed");
2508 
2509     for (int j = 0; j < ext_length; j += entry_size) {
2510       int cur_index = ex_table->int_at(j + klass_index_offset);
2511       int new_index = find_new_index(cur_index);
2512       if (new_index != 0) {
2513         RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2514           ("ext-klass_index change: %d to %d", cur_index, new_index));
2515         ex_table->int_at_put(j + klass_index_offset, new_index);
2516       }
2517     } // end for each exception table entry
2518 
2519     // Update constant pool indices in the method's local variable
2520     // table to use new constant indices as needed. The local variable
2521     // table hold sextuple entries of the form:
2522     // (start_pc, length, name_index, descriptor_index, signature_index, slot)
2523     int lvt_length = method->localvariable_table_length();
2524     if (lvt_length > 0) {
2525       LocalVariableTableElement * lv_table =
2526         method->localvariable_table_start();
2527       for (int j = 0; j < lvt_length; j++) {
2528         int cur_index = lv_table[j].name_cp_index;
2529         int new_index = find_new_index(cur_index);
2530         if (new_index != 0) {
2531           RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2532             ("lvt-name_cp_index change: %d to %d", cur_index, new_index));
2533           lv_table[j].name_cp_index = (u2)new_index;
2534         }
2535         cur_index = lv_table[j].descriptor_cp_index;




2479     // table to use new constant indices as needed.
2480     int cext_length = method->checked_exceptions_length();
2481     if (cext_length > 0) {
2482       CheckedExceptionElement * cext_table =
2483         method->checked_exceptions_start();
2484       for (int j = 0; j < cext_length; j++) {
2485         int cur_index = cext_table[j].class_cp_index;
2486         int new_index = find_new_index(cur_index);
2487         if (new_index != 0) {
2488           RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2489             ("cext-class_cp_index change: %d to %d", cur_index, new_index));
2490           cext_table[j].class_cp_index = (u2)new_index;
2491         }
2492       } // end for each checked exception table entry
2493     } // end if there are checked exception table entries
2494 
2495     // Update each catch type index in the method's exception table
2496     // to use new constant pool indices as needed. The exception table
2497     // holds quadruple entries of the form:
2498     //   (beg_bci, end_bci, handler_bci, klass_index)





2499 
2500     ExceptionTable ex_table(method());
2501     int ext_length = ex_table.length();

2502 
2503     for (int j = 0; j < ext_length; j ++) {
2504       int cur_index = ex_table.catch_type_index(j);
2505       int new_index = find_new_index(cur_index);
2506       if (new_index != 0) {
2507         RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2508           ("ext-klass_index change: %d to %d", cur_index, new_index));
2509         ex_table.set_catch_type_index(j, new_index);
2510       }
2511     } // end for each exception table entry
2512 
2513     // Update constant pool indices in the method's local variable
2514     // table to use new constant indices as needed. The local variable
2515     // table hold sextuple entries of the form:
2516     // (start_pc, length, name_index, descriptor_index, signature_index, slot)
2517     int lvt_length = method->localvariable_table_length();
2518     if (lvt_length > 0) {
2519       LocalVariableTableElement * lv_table =
2520         method->localvariable_table_start();
2521       for (int j = 0; j < lvt_length; j++) {
2522         int cur_index = lv_table[j].name_cp_index;
2523         int new_index = find_new_index(cur_index);
2524         if (new_index != 0) {
2525           RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2526             ("lvt-name_cp_index change: %d to %d", cur_index, new_index));
2527           lv_table[j].name_cp_index = (u2)new_index;
2528         }
2529         cur_index = lv_table[j].descriptor_cp_index;


< prev index next >