378 // if the last instruction is a call (typically to do a throw which 379 // is coming at the end after block reordering) the return address 380 // must still point into the code area in order to avoid assertion 381 // failures when searching for the corresponding bci => add a nop 382 // (was bug 5/14/1999 - gri) 383 __ nop(); 384 385 // generate code for exception handler 386 ciMethod* method = compilation()->method(); 387 388 address handler_base = __ start_a_stub(exception_handler_size); 389 390 if (handler_base == NULL) { 391 // not enough space left for the handler 392 bailout("exception handler overflow"); 393 return -1; 394 } 395 396 int offset = code_offset(); 397 398 __ call(Runtime1::entry_for(Runtime1::handle_exception_id), relocInfo::runtime_call_type); 399 __ delayed()->nop(); 400 debug_only(__ stop("should have gone to the caller");) 401 assert(code_offset() - offset <= exception_handler_size, "overflow"); 402 __ end_a_stub(); 403 404 return offset; 405 } 406 407 408 // Emit the code to remove the frame from the stack in the exception 409 // unwind path. 410 int LIR_Assembler::emit_unwind_handler() { 411 #ifndef PRODUCT 412 if (CommentedAssembly) { 413 _masm->block_comment("Unwind handler"); 414 } 415 #endif 416 417 int offset = code_offset(); 418 419 // Fetch the exception from TLS and clear out exception related thread state 420 __ ld_ptr(G2_thread, in_bytes(JavaThread::exception_oop_offset()), O0); | 378 // if the last instruction is a call (typically to do a throw which 379 // is coming at the end after block reordering) the return address 380 // must still point into the code area in order to avoid assertion 381 // failures when searching for the corresponding bci => add a nop 382 // (was bug 5/14/1999 - gri) 383 __ nop(); 384 385 // generate code for exception handler 386 ciMethod* method = compilation()->method(); 387 388 address handler_base = __ start_a_stub(exception_handler_size); 389 390 if (handler_base == NULL) { 391 // not enough space left for the handler 392 bailout("exception handler overflow"); 393 return -1; 394 } 395 396 int offset = code_offset(); 397 398 __ call(Runtime1::entry_for(Runtime1::handle_exception_from_callee_id), relocInfo::runtime_call_type); 399 __ delayed()->nop(); 400 __ should_not_reach_here(); 401 assert(code_offset() - offset <= exception_handler_size, "overflow"); 402 __ end_a_stub(); 403 404 return offset; 405 } 406 407 408 // Emit the code to remove the frame from the stack in the exception 409 // unwind path. 410 int LIR_Assembler::emit_unwind_handler() { 411 #ifndef PRODUCT 412 if (CommentedAssembly) { 413 _masm->block_comment("Unwind handler"); 414 } 415 #endif 416 417 int offset = code_offset(); 418 419 // Fetch the exception from TLS and clear out exception related thread state 420 __ ld_ptr(G2_thread, in_bytes(JavaThread::exception_oop_offset()), O0); |