Mercurial > hg > truffle
comparison src/share/vm/runtime/sharedRuntime.cpp @ 1368:93767e6a2dfd
6941529: SharedRuntime::raw_exception_handler_for_return_address must reset thread MethodHandle flag
Summary: During testing a bug was hit when an exception returned to the interpreter and the SP was wrong.
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Thu, 08 Apr 2010 10:55:40 +0200 |
parents | 9eba43136cb5 |
children | 9f5b60a14736 |
comparison
equal
deleted
inserted
replaced
1367:9e321dcfa5b7 | 1368:93767e6a2dfd |
---|---|
257 // previous frame depending on the return address. | 257 // previous frame depending on the return address. |
258 | 258 |
259 address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thread, address return_address) { | 259 address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thread, address return_address) { |
260 assert(frame::verify_return_pc(return_address), "must be a return pc"); | 260 assert(frame::verify_return_pc(return_address), "must be a return pc"); |
261 | 261 |
262 // Reset MethodHandle flag. | |
263 thread->set_is_method_handle_return(false); | |
264 | |
262 // the fastest case first | 265 // the fastest case first |
263 CodeBlob* blob = CodeCache::find_blob(return_address); | 266 CodeBlob* blob = CodeCache::find_blob(return_address); |
264 if (blob != NULL && blob->is_nmethod()) { | 267 if (blob != NULL && blob->is_nmethod()) { |
265 nmethod* code = (nmethod*)blob; | 268 nmethod* code = (nmethod*)blob; |
266 assert(code != NULL, "nmethod must be present"); | 269 assert(code != NULL, "nmethod must be present"); |
267 // Check if the return address is a MethodHandle call site. | 270 // Check if the return address is a MethodHandle call site. |
268 thread->set_is_method_handle_exception(code->is_method_handle_return(return_address)); | 271 thread->set_is_method_handle_return(code->is_method_handle_return(return_address)); |
269 // native nmethods don't have exception handlers | 272 // native nmethods don't have exception handlers |
270 assert(!code->is_native_method(), "no exception handler"); | 273 assert(!code->is_native_method(), "no exception handler"); |
271 assert(code->header_begin() != code->exception_begin(), "no exception handler"); | 274 assert(code->header_begin() != code->exception_begin(), "no exception handler"); |
272 if (code->is_deopt_pc(return_address)) { | 275 if (code->is_deopt_pc(return_address)) { |
273 return SharedRuntime::deopt_blob()->unpack_with_exception(); | 276 return SharedRuntime::deopt_blob()->unpack_with_exception(); |
290 CodeBlob* blob = CodeCache::find_blob(return_address); | 293 CodeBlob* blob = CodeCache::find_blob(return_address); |
291 if (blob->is_nmethod()) { | 294 if (blob->is_nmethod()) { |
292 nmethod* code = (nmethod*)blob; | 295 nmethod* code = (nmethod*)blob; |
293 assert(code != NULL, "nmethod must be present"); | 296 assert(code != NULL, "nmethod must be present"); |
294 // Check if the return address is a MethodHandle call site. | 297 // Check if the return address is a MethodHandle call site. |
295 thread->set_is_method_handle_exception(code->is_method_handle_return(return_address)); | 298 thread->set_is_method_handle_return(code->is_method_handle_return(return_address)); |
296 assert(code->header_begin() != code->exception_begin(), "no exception handler"); | 299 assert(code->header_begin() != code->exception_begin(), "no exception handler"); |
297 return code->exception_begin(); | 300 return code->exception_begin(); |
298 } | 301 } |
299 if (blob->is_runtime_stub()) { | 302 if (blob->is_runtime_stub()) { |
300 ShouldNotReachHere(); // callers are responsible for skipping runtime stub frames | 303 ShouldNotReachHere(); // callers are responsible for skipping runtime stub frames |