comparison src/share/vm/runtime/frame.cpp @ 1204:18a389214829

6921352: JSR 292 needs its own deopt handler Summary: We need to introduce a new MH deopt handler so we can easily determine if the deopt happened at a MH call site or not. Reviewed-by: never, jrose
author twisti
date Mon, 01 Feb 2010 19:29:46 +0100
parents 24128c2ffa87
children e3a4305c6bc3
comparison
equal deleted inserted replaced
1203:844a9d73ec22 1204:18a389214829
1 /* 1 /*
2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
105 // hardware would want to see in the native frame. The only user (at this point) 105 // hardware would want to see in the native frame. The only user (at this point)
106 // is deoptimization. It likely no one else should ever use it. 106 // is deoptimization. It likely no one else should ever use it.
107 107
108 address frame::raw_pc() const { 108 address frame::raw_pc() const {
109 if (is_deoptimized_frame()) { 109 if (is_deoptimized_frame()) {
110 return ((nmethod*) cb())->deopt_handler_begin() - pc_return_offset; 110 nmethod* nm = cb()->as_nmethod_or_null();
111 if (nm->is_method_handle_return(pc()))
112 return nm->deopt_mh_handler_begin() - pc_return_offset;
113 else
114 return nm->deopt_handler_begin() - pc_return_offset;
111 } else { 115 } else {
112 return (pc() - pc_return_offset); 116 return (pc() - pc_return_offset);
113 } 117 }
114 } 118 }
115 119
267 } 271 }
268 } 272 }
269 } // NeedsDeoptSuspend 273 } // NeedsDeoptSuspend
270 274
271 275
272 address deopt = nm->deopt_handler_begin(); 276 // If the call site is a MethodHandle call site use the MH deopt
277 // handler.
278 address deopt = nm->is_method_handle_return(pc()) ?
279 nm->deopt_mh_handler_begin() :
280 nm->deopt_handler_begin();
281
273 // Save the original pc before we patch in the new one 282 // Save the original pc before we patch in the new one
274 nm->set_original_pc(this, pc()); 283 nm->set_original_pc(this, pc());
275 patch_pc(thread, deopt); 284 patch_pc(thread, deopt);
285
276 #ifdef ASSERT 286 #ifdef ASSERT
277 { 287 {
278 RegisterMap map(thread, false); 288 RegisterMap map(thread, false);
279 frame check = thread->last_frame(); 289 frame check = thread->last_frame();
280 while (id() != check.id()) { 290 while (id() != check.id()) {