< prev index next >
src/share/vm/oops/methodOop.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
rev 4135 : 7181632: nsk classLoad001_14 failure and CompileTheWorld crash after 7178145.
Summary: Need to copy the inlined exception table to the new constMethodOop during method rewriting.
Reviewed-by: coleenp, dholmes
*** 109,137 ****
return buf;
}
int methodOopDesc::fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS) {
// exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
- const int beg_bci_offset = 0;
- const int end_bci_offset = 1;
- const int handler_bci_offset = 2;
- const int klass_index_offset = 3;
- const int entry_size = 4;
// access exception table
! typeArrayHandle table (THREAD, constMethod()->exception_table());
! int length = table->length();
! assert(length % entry_size == 0, "exception table format has changed");
// iterate through all entries sequentially
constantPoolHandle pool(THREAD, constants());
! for (int i = 0; i < length; i += entry_size) {
! int beg_bci = table->int_at(i + beg_bci_offset);
! int end_bci = table->int_at(i + end_bci_offset);
assert(beg_bci <= end_bci, "inconsistent exception table");
if (beg_bci <= throw_bci && throw_bci < end_bci) {
// exception handler bci range covers throw_bci => investigate further
! int handler_bci = table->int_at(i + handler_bci_offset);
! int klass_index = table->int_at(i + klass_index_offset);
if (klass_index == 0) {
return handler_bci;
} else if (ex_klass.is_null()) {
return handler_bci;
} else {
--- 109,133 ----
return buf;
}
int methodOopDesc::fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS) {
// exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
// access exception table
! ExceptionTable table(this);
! int length = table.length();
// iterate through all entries sequentially
constantPoolHandle pool(THREAD, constants());
! for (int i = 0; i < length; i ++) {
! //reacquire the table in case a GC happened
! ExceptionTable table(this);
! int beg_bci = table.start_pc(i);
! int end_bci = table.end_pc(i);
assert(beg_bci <= end_bci, "inconsistent exception table");
if (beg_bci <= throw_bci && throw_bci < end_bci) {
// exception handler bci range covers throw_bci => investigate further
! int handler_bci = table.handler_pc(i);
! int klass_index = table.catch_type_index(i);
if (klass_index == 0) {
return handler_bci;
} else if (ex_klass.is_null()) {
return handler_bci;
} else {
*** 976,986 ****
cp->pseudo_string_at_put(_imcp_method_type_value, method_type());
methodHandle m;
{
int flags_bits = (JVM_MH_INVOKE_BITS | JVM_ACC_PUBLIC | JVM_ACC_FINAL);
methodOop m_oop = oopFactory::new_method(0, accessFlags_from(flags_bits),
! 0, 0, 0, IsSafeConc, CHECK_(empty));
m = methodHandle(THREAD, m_oop);
}
m->set_constants(cp());
m->set_name_index(_imcp_invoke_name);
m->set_signature_index(_imcp_invoke_signature);
--- 972,982 ----
cp->pseudo_string_at_put(_imcp_method_type_value, method_type());
methodHandle m;
{
int flags_bits = (JVM_MH_INVOKE_BITS | JVM_ACC_PUBLIC | JVM_ACC_FINAL);
methodOop m_oop = oopFactory::new_method(0, accessFlags_from(flags_bits),
! 0, 0, 0, 0, IsSafeConc, CHECK_(empty));
m = methodHandle(THREAD, m_oop);
}
m->set_constants(cp());
m->set_name_index(_imcp_invoke_name);
m->set_signature_index(_imcp_invoke_signature);
*** 990,1000 ****
#ifdef CC_INTERP
ResultTypeFinder rtf(signature);
m->set_result_index(rtf.type());
#endif
m->compute_size_of_parameters(THREAD);
- m->set_exception_table(Universe::the_empty_int_array());
m->init_intrinsic_id();
assert(m->intrinsic_id() == vmIntrinsics::_invokeExact ||
m->intrinsic_id() == vmIntrinsics::_invokeGeneric, "must be an invoker");
// Finally, set up its entry points.
--- 986,995 ----
*** 1034,1050 ****
--- 1029,1047 ----
assert(!m->is_native(), "cannot rewrite native methods");
// Allocate new methodOop
AccessFlags flags = m->access_flags();
int checked_exceptions_len = m->checked_exceptions_length();
int localvariable_len = m->localvariable_table_length();
+ int exception_table_len = m->exception_table_length();
// Allocate newm_oop with the is_conc_safe parameter set
// to IsUnsafeConc to indicate that newm_oop is not yet
// safe for concurrent processing by a GC.
methodOop newm_oop = oopFactory::new_method(new_code_length,
flags,
new_compressed_linenumber_size,
localvariable_len,
+ exception_table_len,
checked_exceptions_len,
IsUnsafeConc,
CHECK_(methodHandle()));
methodHandle newm (THREAD, newm_oop);
NOT_PRODUCT(int nmsz = newm->is_parsable() ? newm->size() : -1;)
*** 1083,1092 ****
--- 1080,1090 ----
newm->constMethod()->set_code_size(new_code_length);
newm->constMethod()->set_constMethod_size(new_const_method_size);
newm->set_method_size(new_method_size);
assert(newm->code_size() == new_code_length, "check");
assert(newm->checked_exceptions_length() == checked_exceptions_len, "check");
+ assert(newm->exception_table_length() == exception_table_len, "check");
assert(newm->localvariable_table_length() == localvariable_len, "check");
// Copy new byte codes
memcpy(newm->code_base(), new_code, new_code_length);
// Copy line number table
if (new_compressed_linenumber_size > 0) {
*** 1098,1107 ****
--- 1096,1111 ----
if (checked_exceptions_len > 0) {
memcpy(newm->checked_exceptions_start(),
m->checked_exceptions_start(),
checked_exceptions_len * sizeof(CheckedExceptionElement));
}
+ // Copy exception table
+ if (exception_table_len > 0) {
+ memcpy(newm->exception_table_start(),
+ m->exception_table_start(),
+ exception_table_len * sizeof(ExceptionTableElement));
+ }
// Copy local variable number table
if (localvariable_len > 0) {
memcpy(newm->localvariable_table_start(),
m->localvariable_table_start(),
localvariable_len * sizeof(LocalVariableTableElement));
< prev index next >