frame.cpp revision 1426
3261N/A * Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. 2362N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A#
include "incls/_precompiled.incl" 0N/A // for whichever bits are set, pull in the corresponding map->_location 0N/A// This returns the pc that if you were in the debugger you'd see. Not 0N/A// the idealized value in the frame object. This undoes the magic conversion 0N/A// that happens for deoptimized frames. In addition it makes the value the 0N/A// hardware would want to see in the native frame. The only user (at this point) 0N/A// is deoptimization. It likely no one else should ever use it. 0N/A// Change the pc in a frame object. This does not change the actual pc in 0N/A// actual frame. To do that use patch_pc. 0N/A // Unsafe to use the is_deoptimzed tester after changing pc 0N/A // If at the return point, then the frame has already been popped, and 0N/A // only the return needs to be executed. Don't deoptimize here. 0N/A// Schedule deoptimization of an nmethod activation with this frame. 0N/A // Store the original pc before an patch (or request to self-deopt) 0N/A // in the published location of the frame. 0N/A // This is a fix for register window patching race 0N/A // we could see the frame again and ask for it to be deoptimized since 0N/A // it might move for a long time. That is harmless and we just ignore it. 0N/A // We are at a safepoint so the target thread can only be 0N/A // blocked - no problem 0N/A // blocked_trans - no problem (i.e. could have woken up from blocked 0N/A // during a safepoint). 0N/A // native - register window pc patching race 0N/A // native_trans - momentary state 0N/A // We could just wait out a thread in native_trans to block. 0N/A // Then we'd have all the issues that the safepoint code has as to 0N/A // whether to spin or block. It isn't worth it. Just treat it like 0N/A // native and be done with it. 0N/A // Since we are at a safepoint the target thread will stop itself 0N/A // before it can return to java as long as we remain at the safepoint. 0N/A // Therefore we can put an additional request for the thread to stop 0N/A // no matter what no (like a suspend). This will cause the thread 0N/A // to notice it needs to do the deopt on its own once it leaves native. 0N/A // The only reason we must do this is because on machine with register 0N/A // windows we have a race with patching the return address and the 0N/A // window coming live as the thread returns to the Java code (but still 0N/A // in native mode) and then blocks. It is only this top most frame 0N/A // that is at risk. So in truth we could add an additional check to 0N/A // see if this frame is one that is at risk. 0N/A }
// NeedsDeoptSuspend 0N/A // If the call site is a MethodHandle call site use the MH deopt 0N/A // Save the original pc before we patch in the new one 0N/A// Note: called by profiler - NOT for current thread 0N/A// If we don't recognize this frame, walk back up the stack until we do 0N/A // Find the first Java frame on the stack starting with input frame 0N/A // top frame is compiled frame or deoptimized frame 0N/A// Interpreter frames 0N/A // The bcx was just converted from bci to bcp. 0N/A // Convert the mdx in parallel. 0N/A int mdi =
mdx -
1;
// We distinguish valid mdi from zero by adding one. 0N/A // The bcx was just converted from bcp to bci. 0N/A // Convert the mdx in parallel. 0N/A // Always allow the mdp to be cleared. 0N/A// // This verification needs to be checked before being enabled 0N/A// interpreter_frame_verify_monitor(current); 0N/A// Interpreter locals and expression stack locations. 0N/A // Number of elements on the interpreter expression stack 0N/A // Callers should span by stackElementWords 0N/A// (frame::interpreter_frame_sender_sp accessor is in frame_<arch>.cpp) 0N/A // locks for synchronization 0N/A// Return whether the frame is in the VM or os indicating a Hotspot problem. 0N/A// Otherwise, it's likely a bug in the native library that the Java code calls, 0N/A// hopefully indicating where to submit bugs. 0N/A // skip directory names 0N/A // function name - os::dll_address_to_function_name() may return confusing 0N/A // names if pc is within jvm.dll or libjvm.so, because JVM only has 0N/A // JVM_xxxx and a few other symbols in the dynamic symbol table. Do this 0N/A // only for native libraries. 0N/A// frame::print_on_error() is called by fatal error handler. Notice that we may 0N/A// crash inside this function if stack frame is corrupted. The fatal error 0N/A// handler can catch and handle the crash. Here we assume the frame is valid. 0N/A// First letter indicates type of the frame: 0N/A// J: Java frame (compiled) 0N/A// j: Java frame (interpreted) 0N/A// V: VM frame (C/C++) 0N/A// v: Other frames running VM generated code (e.g. stubs, adapters, etc.) 0N/A// We don't need detailed frame type as that in frame::print_name(). "C" 0N/A// suggests the problem is in user lib; everything else is likely a VM bug. 0N/A The interpreter_frame_expression_stack_at method in the case of SPARC needs the 0N/A max_stack value of the method in order to compute the expression stack address. 0N/A It uses the methodOop in order to get the max_stack value but during GC this 0N/A methodOop value saved on the frame is changed by reverse_and_push and hence cannot 0N/A be used. So we save the max_stack value in the FrameClosure object and pass it 0N/A down to the interpreter_frame_expression_stack_at method 0N/A // In case of exceptions, the expression stack is invalid and the esp will be reset to express 0N/A // this condition. Therefore, we call f only if addr is 'inside' the stack (i.e., addr >= esp for Intel). 0N/A int _offset;
// TOS-relative offset, decremented with each argument 0N/A // compute size of arguments 0N/A "args cannot be on stack anymore");
0N/A // initialize InterpretedArgumentOopFinder 0N/A// Entry frame has following form (n arguments) 0N/A// sp -> | last arg | 0N/A// (sp+n)->| first arg| 0N/A// visits and GC's all the arguments in entry frame 0N/A // Handle the monitor elements in the activation 0N/A // process fixed part 0N/A // Hmm what about the mdp? 0N/A // Interpreter frame in the midst of a call have a methodOop within the 0N/A#
endif /* CC_INTERP */ 0N/A#
endif /* CC_INTERP */ 0N/A // Process a callee's arguments if we are at a call site 0N/A // (i.e., if we are at an invoke bytecode) 0N/A // This is used sometimes for calling into the VM, not for another 0N/A // interpreted or compiled frame. 0N/A // we are at a call site & the expression stack is not empty 0N/A // => process callee's arguments 0N/A // Note: The expression stack can be empty if an exception 0N/A // cases we empty the expression stack completely be- 0N/A // fore handling the exception (the exception handling 0N/A // code in the interpreter calls a blocking runtime 0N/A // routine which can cause this code to be executed). 0N/A // (was bug gri 7/27/98) 0N/A // process locals & expression stack 0N/A // Preserve potential arguments for a callee. We handle this by dispatching 0N/A // on the codeblob. For c2i, we do 0N/A // In cases where perm gen is collected, GC will want to mark 0N/A // oops referenced from nmethods active on thread stacks so as to 0N/A // prevent them from being collected. However, this visit should be 0N/A // restricted to certain phases of the collection only. The 0N/A // closure decides how it wants nmethods to be traced. 0N/A int _offset;
// the current offset, incremented with each argument 0N/A // Extract low order register number from register array. 0N/A // In LP64-land, the high-order bits are valid but unhelpful. 0N/A // initialize CompiledArgumentOopFinder 0N/A// Get receiver out of callers frame, i.e. find parameter 0 in callers 0N/A// frame. Consult ADLC for where parameter 0 is to be found. Then 0N/A// check local reg_map for it being a callee-save register or argument 0N/A// register, both of which are saved in the local frame. If not found 0N/A// there, it must be an in-stack argument of the caller. 0N/A // First consult the ADLC on where it puts parameter 0 for this signature. 0N/A // If it is passed in a register, it got spilled in the stub frame. 0N/A "should not call this otherwise");
0N/A "should not call this otherwise");
0N/A // must collect argument oops, as nobody else is doing it 0N/A // Traverse the Handle Block saved in the entry frame 0N/A // simulate GC crash here to dump java thread in error report 0N/A // set bcx to bci to become methodOop position independent during GC 0N/A // set bcx back to bcp for interpreter 0N/A // call processor specific epilog function 0N/A // Need cast because on _LP64 the conversion to oop is ambiguous. Constant 0N/A // can be either long or int. 0N/A tty->
print_cr(
"--------------------------------------------------------------------------------");
0N/A // could be is_runtime_frame 0N/A // so remove error: ShouldNotReachHere(); 0N/A // get current interpreter 'pc' 0N/A // process dynamic part 0N/A#
endif // ENABLE_ZAP_DEAD_LOCALS 0N/A // for now make sure receiver type is correct 0N/A // fetch the receiver 0N/A // make sure we have the right receiver type 0N/A // verify that the value is in the right part of the frame 0N/A//----------------------------------------------------------------------------------- 0N/A// StackFrameStream implementation