This commit is contained in:
Dean Long 2013-01-09 21:18:52 -05:00
commit f1bd82ba8f
6 changed files with 18 additions and 12 deletions

View file

@ -2259,7 +2259,7 @@ class LIR_OpVisitState: public StackObj {
typedef enum { inputMode, firstMode = inputMode, tempMode, outputMode, numModes, invalidMode = -1 } OprMode; typedef enum { inputMode, firstMode = inputMode, tempMode, outputMode, numModes, invalidMode = -1 } OprMode;
enum { enum {
maxNumberOfOperands = 16, maxNumberOfOperands = 20,
maxNumberOfInfos = 4 maxNumberOfInfos = 4
}; };

View file

@ -417,7 +417,7 @@ IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
// exception handler lookup // exception handler lookup
KlassHandle h_klass(THREAD, h_exception->klass()); KlassHandle h_klass(THREAD, h_exception->klass());
handler_bci = h_method->fast_exception_handler_bci_for(h_klass, current_bci, THREAD); handler_bci = Method::fast_exception_handler_bci_for(h_method, h_klass, current_bci, THREAD);
if (HAS_PENDING_EXCEPTION) { if (HAS_PENDING_EXCEPTION) {
// We threw an exception while trying to find the exception handler. // We threw an exception while trying to find the exception handler.
// Transfer the new exception to the exception handle which will // Transfer the new exception to the exception handle which will

View file

@ -194,16 +194,16 @@ char* Method::name_and_sig_as_C_string(Klass* klass, Symbol* method_name, Symbol
return buf; return buf;
} }
int Method::fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS) { int Method::fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS) {
// exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index) // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
// access exception table // access exception table
ExceptionTable table(this); ExceptionTable table(mh());
int length = table.length(); int length = table.length();
// iterate through all entries sequentially // iterate through all entries sequentially
constantPoolHandle pool(THREAD, constants()); constantPoolHandle pool(THREAD, mh->constants());
for (int i = 0; i < length; i ++) { for (int i = 0; i < length; i ++) {
//reacquire the table in case a GC happened //reacquire the table in case a GC happened
ExceptionTable table(this); ExceptionTable table(mh());
int beg_bci = table.start_pc(i); int beg_bci = table.start_pc(i);
int end_bci = table.end_pc(i); int end_bci = table.end_pc(i);
assert(beg_bci <= end_bci, "inconsistent exception table"); assert(beg_bci <= end_bci, "inconsistent exception table");

View file

@ -351,7 +351,7 @@ class Method : public Metadata {
// exception handler which caused the exception to be thrown, which // exception handler which caused the exception to be thrown, which
// is needed for proper retries. See, for example, // is needed for proper retries. See, for example,
// InterpreterRuntime::exception_handler_for_exception. // InterpreterRuntime::exception_handler_for_exception.
int fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS); static int fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS);
// method data access // method data access
MethodData* method_data() const { MethodData* method_data() const {

View file

@ -1305,15 +1305,21 @@ void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, addre
vframeStream st(thread); vframeStream st(thread);
assert(!st.at_end(), "cannot be at end"); assert(!st.at_end(), "cannot be at end");
Method* current_method = NULL; Method* current_method = NULL;
// A GC may occur during the Method::fast_exception_handler_bci_for()
// call below if it needs to load the constraint class. Using a
// methodHandle to keep the 'current_method' from being deallocated
// if GC happens.
methodHandle current_mh = methodHandle(thread, current_method);
int current_bci = -1; int current_bci = -1;
do { do {
current_method = st.method(); current_method = st.method();
current_mh = methodHandle(thread, current_method);
current_bci = st.bci(); current_bci = st.bci();
do { do {
should_repeat = false; should_repeat = false;
KlassHandle eh_klass(thread, exception_handle()->klass()); KlassHandle eh_klass(thread, exception_handle()->klass());
current_bci = current_method->fast_exception_handler_bci_for( current_bci = Method::fast_exception_handler_bci_for(
eh_klass, current_bci, THREAD); current_mh, eh_klass, current_bci, THREAD);
if (HAS_PENDING_EXCEPTION) { if (HAS_PENDING_EXCEPTION) {
exception_handle = Handle(thread, PENDING_EXCEPTION); exception_handle = Handle(thread, PENDING_EXCEPTION);
CLEAR_PENDING_EXCEPTION; CLEAR_PENDING_EXCEPTION;
@ -1328,8 +1334,7 @@ void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, addre
catch_jmethodID = 0; catch_jmethodID = 0;
current_bci = 0; current_bci = 0;
} else { } else {
catch_jmethodID = jem.to_jmethodID( catch_jmethodID = jem.to_jmethodID(current_mh);
methodHandle(thread, current_method));
} }
JvmtiJavaThreadEventTransition jet(thread); JvmtiJavaThreadEventTransition jet(thread);

View file

@ -643,7 +643,8 @@ address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc,
bool skip_scope_increment = false; bool skip_scope_increment = false;
// exception handler lookup // exception handler lookup
KlassHandle ek (THREAD, exception->klass()); KlassHandle ek (THREAD, exception->klass());
handler_bci = sd->method()->fast_exception_handler_bci_for(ek, bci, THREAD); methodHandle mh(THREAD, sd->method());
handler_bci = Method::fast_exception_handler_bci_for(mh, ek, bci, THREAD);
if (HAS_PENDING_EXCEPTION) { if (HAS_PENDING_EXCEPTION) {
recursive_exception = true; recursive_exception = true;
// We threw an exception while trying to find the exception handler. // We threw an exception while trying to find the exception handler.