103 } 104 105 address TemplateInterpreterGenerator::generate_ClassCastException_handler() { 106 address entry = __ pc(); 107 108 // object is at TOS 109 __ pop(c_rarg1); 110 111 // expression stack must be empty before entering the VM if an 112 // exception happened 113 __ empty_expression_stack(); 114 115 __ call_VM(noreg, 116 CAST_FROM_FN_PTR(address, 117 InterpreterRuntime:: 118 throw_ClassCastException), 119 c_rarg1); 120 return entry; 121 } 122 123 // Arguments are: required type at TOS+8, failing object (or NULL) at TOS+4. 124 address TemplateInterpreterGenerator::generate_WrongMethodType_handler() { 125 address entry = __ pc(); 126 127 __ pop(c_rarg2); // failing object is at TOS 128 __ pop(c_rarg1); // required type is at TOS+8 129 130 __ verify_oop(c_rarg1); 131 __ verify_oop(c_rarg2); 132 133 // Various method handle types use interpreter registers as temps. 134 __ restore_bcp(); 135 __ restore_locals(); 136 137 // Expression stack must be empty before entering the VM for an exception. 138 __ empty_expression_stack(); 139 140 __ call_VM(noreg, 141 CAST_FROM_FN_PTR(address, 142 InterpreterRuntime::throw_WrongMethodTypeException), 143 // pass required type, failing object (or NULL) 144 c_rarg1, c_rarg2); 145 return entry; 146 } 147 148 address TemplateInterpreterGenerator::generate_exception_handler_common( 149 const char* name, const char* message, bool pass_oop) { 150 assert(!pass_oop || message == NULL, "either oop or message but not both"); 151 address entry = __ pc(); 152 if (pass_oop) { 153 // object is at TOS 154 __ pop(c_rarg2); 155 } 156 // expression stack must be empty before entering the VM if an 157 // exception happened 158 __ empty_expression_stack(); 159 // setup parameters 160 __ lea(c_rarg1, ExternalAddress((address)name)); 161 if (pass_oop) { 162 __ call_VM(rax, CAST_FROM_FN_PTR(address, 163 InterpreterRuntime:: 164 create_klass_exception), 165 c_rarg1, c_rarg2); 166 } else { 167 // kind of lame ExternalAddress can't take NULL because | 103 } 104 105 address TemplateInterpreterGenerator::generate_ClassCastException_handler() { 106 address entry = __ pc(); 107 108 // object is at TOS 109 __ pop(c_rarg1); 110 111 // expression stack must be empty before entering the VM if an 112 // exception happened 113 __ empty_expression_stack(); 114 115 __ call_VM(noreg, 116 CAST_FROM_FN_PTR(address, 117 InterpreterRuntime:: 118 throw_ClassCastException), 119 c_rarg1); 120 return entry; 121 } 122 123 address TemplateInterpreterGenerator::generate_exception_handler_common( 124 const char* name, const char* message, bool pass_oop) { 125 assert(!pass_oop || message == NULL, "either oop or message but not both"); 126 address entry = __ pc(); 127 if (pass_oop) { 128 // object is at TOS 129 __ pop(c_rarg2); 130 } 131 // expression stack must be empty before entering the VM if an 132 // exception happened 133 __ empty_expression_stack(); 134 // setup parameters 135 __ lea(c_rarg1, ExternalAddress((address)name)); 136 if (pass_oop) { 137 __ call_VM(rax, CAST_FROM_FN_PTR(address, 138 InterpreterRuntime:: 139 create_klass_exception), 140 c_rarg1, c_rarg2); 141 } else { 142 // kind of lame ExternalAddress can't take NULL because |