comparison src/share/vm/runtime/frame.cpp @ 1201:24128c2ffa87

6921339: backout 6917766 Reviewed-by: mr
author twisti
date Fri, 29 Jan 2010 08:33:24 -0800
parents ba263cfb7611
children 18a389214829
comparison
equal deleted inserted replaced
1200:ba263cfb7611 1201:24128c2ffa87
1 /* 1 /*
2 * Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1997-2009 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 nmethod* nm = cb()->as_nmethod_or_null(); 110 return ((nmethod*) cb())->deopt_handler_begin() - pc_return_offset;
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;
115 } else { 111 } else {
116 return (pc() - pc_return_offset); 112 return (pc() - pc_return_offset);
117 } 113 }
118 } 114 }
119 115
271 } 267 }
272 } 268 }
273 } // NeedsDeoptSuspend 269 } // NeedsDeoptSuspend
274 270
275 271
276 // If the call site is a MethodHandle call site use the MH deopt 272 address deopt = nm->deopt_handler_begin();
277 // handler.
278 address deopt = nm->is_method_handle_return(pc()) ?
279 nm->deopt_mh_handler_begin() :
280 nm->deopt_handler_begin();
281
282 // Save the original pc before we patch in the new one 273 // Save the original pc before we patch in the new one
283 nm->set_original_pc(this, pc()); 274 nm->set_original_pc(this, pc());
284 patch_pc(thread, deopt); 275 patch_pc(thread, deopt);
285
286 #ifdef ASSERT 276 #ifdef ASSERT
287 { 277 {
288 RegisterMap map(thread, false); 278 RegisterMap map(thread, false);
289 frame check = thread->last_frame(); 279 frame check = thread->last_frame();
290 while (id() != check.id()) { 280 while (id() != check.id()) {
308 while (result.is_runtime_frame()) { 298 while (result.is_runtime_frame()) {
309 result = result.sender(map); 299 result = result.sender(map);
310 } 300 }
311 return result; 301 return result;
312 } 302 }
313
314
315 //------------------------------------------------------------------------------
316 // frame::verify_deopt_original_pc
317 //
318 // Verifies the calculated original PC of a deoptimization PC for the
319 // given unextended SP. The unextended SP might also be the saved SP
320 // for MethodHandle call sites.
321 #if ASSERT
322 void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp, bool is_method_handle_return) {
323 frame fr;
324
325 // This is ugly but it's better than to change {get,set}_original_pc
326 // to take an SP value as argument. And it's only a debugging
327 // method anyway.
328 fr._unextended_sp = unextended_sp;
329
330 address original_pc = nm->get_original_pc(&fr);
331 assert(nm->code_contains(original_pc), "original PC must be in nmethod");
332 assert(nm->is_method_handle_return(original_pc) == is_method_handle_return, "must be");
333 }
334 #endif
335
336 303
337 // Note: called by profiler - NOT for current thread 304 // Note: called by profiler - NOT for current thread
338 frame frame::profile_find_Java_sender_frame(JavaThread *thread) { 305 frame frame::profile_find_Java_sender_frame(JavaThread *thread) {
339 // If we don't recognize this frame, walk back up the stack until we do 306 // If we don't recognize this frame, walk back up the stack until we do
340 RegisterMap map(thread, false); 307 RegisterMap map(thread, false);