Mercurial > hg > shark > hotspot
changeset 1537:6fd1ffad34e2
(indent the block)
author | Gary Benson <gbenson@redhat.com> |
---|---|
date | Tue, 18 May 2010 15:39:15 +0100 |
parents | 79c5422649e4 |
children | 48889816f448 |
files | src/share/vm/shark/sharkTopLevelBlock.cpp |
diffstat | 1 files changed, 62 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/shark/sharkTopLevelBlock.cpp Tue May 18 15:38:54 2010 +0100 +++ b/src/share/vm/shark/sharkTopLevelBlock.cpp Tue May 18 15:39:15 2010 +0100 @@ -452,71 +452,71 @@ } if (handlers->length() != 0) { - // Clear the stack and push the exception onto it. - // We do this now to protect it across the VM call - // we may be about to make. - while (xstack_depth()) - pop(); - push(SharkValue::create_jobject(exception, true)); - - int *indexes = NEW_RESOURCE_ARRAY(int, num_exceptions()); - bool has_catch_all = false; - - ciExceptionHandlerStream eh_iter(target(), bci()); - for (int i = 0; i < num_exceptions(); i++, eh_iter.next()) { - ciExceptionHandler* handler = eh_iter.handler(); - - if (handler->is_catch_all()) { - assert(i == num_exceptions() - 1, "catch-all should be last"); - has_catch_all = true; + // Clear the stack and push the exception onto it. + // We do this now to protect it across the VM call + // we may be about to make. + while (xstack_depth()) + pop(); + push(SharkValue::create_jobject(exception, true)); + + int *indexes = NEW_RESOURCE_ARRAY(int, num_exceptions()); + bool has_catch_all = false; + + ciExceptionHandlerStream eh_iter(target(), bci()); + for (int i = 0; i < num_exceptions(); i++, eh_iter.next()) { + ciExceptionHandler* handler = eh_iter.handler(); + + if (handler->is_catch_all()) { + assert(i == num_exceptions() - 1, "catch-all should be last"); + has_catch_all = true; + } + else { + indexes[i] = handler->catch_klass_index(); + } } - else { - indexes[i] = handler->catch_klass_index(); + + int num_options = num_exceptions(); + if (has_catch_all) + num_options--; + + // Drop into the runtime if there are non-catch-all options + if (num_options > 0) { + Value *index = call_vm( + builder()->find_exception_handler(), + builder()->CreateInlineData( + indexes, + num_options * sizeof(int), + PointerType::getUnqual(SharkType::jint_type())), + LLVMValue::jint_constant(num_options), + EX_CHECK_NO_CATCH); + + // Jump to the exception handler, if found + BasicBlock *no_handler = function()->CreateBlock("no_handler"); + SwitchInst *switchinst = builder()->CreateSwitch( + index, no_handler, num_options); + + for (int i = 0; i < num_options; i++) { + SharkTopLevelBlock* handler = this->exception(i); + + switchinst->addCase( + LLVMValue::jint_constant(i), + handler->entry_block()); + + handler->add_incoming(current_state()); + } + + builder()->SetInsertPoint(no_handler); + } + + // No specific handler exists, but maybe there's a catch-all + if (has_catch_all) { + SharkTopLevelBlock* handler = this->exception(num_options); + + builder()->CreateBr(handler->entry_block()); + handler->add_incoming(current_state()); + return; } } - - int num_options = num_exceptions(); - if (has_catch_all) - num_options--; - - // Drop into the runtime if there are non-catch-all options - if (num_options > 0) { - Value *index = call_vm( - builder()->find_exception_handler(), - builder()->CreateInlineData( - indexes, - num_options * sizeof(int), - PointerType::getUnqual(SharkType::jint_type())), - LLVMValue::jint_constant(num_options), - EX_CHECK_NO_CATCH); - - // Jump to the exception handler, if found - BasicBlock *no_handler = function()->CreateBlock("no_handler"); - SwitchInst *switchinst = builder()->CreateSwitch( - index, no_handler, num_options); - - for (int i = 0; i < num_options; i++) { - SharkTopLevelBlock* handler = this->exception(i); - - switchinst->addCase( - LLVMValue::jint_constant(i), - handler->entry_block()); - - handler->add_incoming(current_state()); - } - - builder()->SetInsertPoint(no_handler); - } - - // No specific handler exists, but maybe there's a catch-all - if (has_catch_all) { - SharkTopLevelBlock* handler = this->exception(num_options); - - builder()->CreateBr(handler->entry_block()); - handler->add_incoming(current_state()); - return; - } - } } // No exception handler was found; unwind and return