210 * in order to correctly free the result. |
210 * in order to correctly free the result. |
211 */ |
211 */ |
212 static char* generate_class_cast_message(JavaThread* thr, const char* name); |
212 static char* generate_class_cast_message(JavaThread* thr, const char* name); |
213 |
213 |
214 /** |
214 /** |
|
215 * Fill in the message for a WrongMethodTypeException |
|
216 * |
|
217 * @param thr the current thread |
|
218 * @param mtype (optional) expected method type (or argument class) |
|
219 * @param mhandle (optional) actual method handle (or argument) |
|
220 * @return the dynamically allocated exception message |
|
221 * |
|
222 * BCP for the frame on top of the stack must refer to an |
|
223 * 'invokevirtual' op for a method handle, or an 'invokedyamic' op. |
|
224 * The caller (or one of its callers) must use a ResourceMark |
|
225 * in order to correctly free the result. |
|
226 */ |
|
227 static char* generate_wrong_method_type_message(JavaThread* thr, |
|
228 oopDesc* mtype = NULL, |
|
229 oopDesc* mhandle = NULL); |
|
230 |
|
231 /** Return non-null if the mtype is a klass or Class, not a MethodType. */ |
|
232 static oop wrong_method_type_is_for_single_argument(JavaThread* thr, |
|
233 oopDesc* mtype); |
|
234 |
|
235 /** |
215 * Fill in the "X cannot be cast to a Y" message for ClassCastException |
236 * Fill in the "X cannot be cast to a Y" message for ClassCastException |
216 * |
237 * |
217 * @param name the name of the class of the object attempted to be cast |
238 * @param name the name of the class of the object attempted to be cast |
218 * @param klass the name of the target klass attempt |
239 * @param klass the name of the target klass attempt |
|
240 * @param gripe the specific kind of problem being reported |
219 * @return the dynamically allocated exception message (must be freed |
241 * @return the dynamically allocated exception message (must be freed |
220 * by the caller using a resource mark) |
242 * by the caller using a resource mark) |
221 * |
243 * |
222 * This version does not require access the frame, so it can be called |
244 * This version does not require access the frame, so it can be called |
223 * from interpreted code |
245 * from interpreted code |
224 * The caller (or one of it's callers) must use a ResourceMark |
246 * The caller (or one of it's callers) must use a ResourceMark |
225 * in order to correctly free the result. |
247 * in order to correctly free the result. |
226 */ |
248 */ |
227 static char* generate_class_cast_message(const char* name, const char* klass); |
249 static char* generate_class_cast_message(const char* name, const char* klass, |
|
250 const char* gripe = " cannot be cast to "); |
228 |
251 |
229 // Resolves a call site- may patch in the destination of the call into the |
252 // Resolves a call site- may patch in the destination of the call into the |
230 // compiled code. |
253 // compiled code. |
231 static methodHandle resolve_helper(JavaThread *thread, |
254 static methodHandle resolve_helper(JavaThread *thread, |
232 bool is_virtual, |
255 bool is_virtual, |