345 // create exception 346 sprintf(message, "%d", index); 347 THROW_MSG(s, message); 348 IRT_END 349 350 IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException( 351 JavaThread* thread, oopDesc* obj)) 352 353 ResourceMark rm(thread); 354 char* message = SharedRuntime::generate_class_cast_message( 355 thread, Klass::cast(obj->klass())->external_name()); 356 357 if (ProfileTraps) { 358 note_trap(thread, Deoptimization::Reason_class_check, CHECK); 359 } 360 361 // create exception 362 THROW_MSG(vmSymbols::java_lang_ClassCastException(), message); 363 IRT_END 364 365 // required can be either a MethodType, or a Class (for a single argument) 366 // actual (if not null) can be either a MethodHandle, or an arbitrary value (for a single argument) 367 IRT_ENTRY(void, InterpreterRuntime::throw_WrongMethodTypeException(JavaThread* thread, 368 oopDesc* required, 369 oopDesc* actual)) { 370 ResourceMark rm(thread); 371 char* message = SharedRuntime::generate_wrong_method_type_message(thread, required, actual); 372 373 if (ProfileTraps) { 374 note_trap(thread, Deoptimization::Reason_constraint, CHECK); 375 } 376 377 // create exception 378 THROW_MSG(vmSymbols::java_lang_invoke_WrongMethodTypeException(), message); 379 } 380 IRT_END 381 382 383 384 // exception_handler_for_exception(...) returns the continuation address, 385 // the exception oop (via TLS) and sets the bci/bcp for the continuation. 386 // The exception oop is returned to make sure it is preserved over GC (it 387 // is only on the stack if the exception was thrown explicitly via athrow). 388 // During this operation, the expression stack contains the values for the 389 // bci where the exception happened. If the exception was propagated back 390 // from a call, the expression stack contains the values for the bci at the 391 // invoke w/o arguments (i.e., as if one were inside the call). 392 IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThread* thread, oopDesc* exception)) 393 394 Handle h_exception(thread, exception); 395 methodHandle h_method (thread, method(thread)); 396 constantPoolHandle h_constants(thread, h_method->constants()); 397 typeArrayHandle h_extable (thread, h_method->exception_table()); 398 bool should_repeat; 399 int handler_bci; 400 int current_bci = bci(thread); 401 402 // Need to do this check first since when _do_not_unlock_if_synchronized 403 // is set, we don't want to trigger any classloading which may make calls | 345 // create exception 346 sprintf(message, "%d", index); 347 THROW_MSG(s, message); 348 IRT_END 349 350 IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException( 351 JavaThread* thread, oopDesc* obj)) 352 353 ResourceMark rm(thread); 354 char* message = SharedRuntime::generate_class_cast_message( 355 thread, Klass::cast(obj->klass())->external_name()); 356 357 if (ProfileTraps) { 358 note_trap(thread, Deoptimization::Reason_class_check, CHECK); 359 } 360 361 // create exception 362 THROW_MSG(vmSymbols::java_lang_ClassCastException(), message); 363 IRT_END 364 365 // exception_handler_for_exception(...) returns the continuation address, 366 // the exception oop (via TLS) and sets the bci/bcp for the continuation. 367 // The exception oop is returned to make sure it is preserved over GC (it 368 // is only on the stack if the exception was thrown explicitly via athrow). 369 // During this operation, the expression stack contains the values for the 370 // bci where the exception happened. If the exception was propagated back 371 // from a call, the expression stack contains the values for the bci at the 372 // invoke w/o arguments (i.e., as if one were inside the call). 373 IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThread* thread, oopDesc* exception)) 374 375 Handle h_exception(thread, exception); 376 methodHandle h_method (thread, method(thread)); 377 constantPoolHandle h_constants(thread, h_method->constants()); 378 typeArrayHandle h_extable (thread, h_method->exception_table()); 379 bool should_repeat; 380 int handler_bci; 381 int current_bci = bci(thread); 382 383 // Need to do this check first since when _do_not_unlock_if_synchronized 384 // is set, we don't want to trigger any classloading which may make calls |