runtime_sparc.cpp revision 727
/*
* Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
#include "incls/_precompiled.incl"
#include "incls/_runtime_sparc.cpp.incl"
//------------------------------ generate_exception_blob ---------------------------
// creates exception blob at the end
// Using exception blob, this code is jumped from a compiled method.
// (see emit_exception_handler in sparc.ad file)
//
// Given an exception pc at a call we call into the runtime for the
// handler in this method. This handler might merely restore state
// (i.e. callee save registers) unwind the frame and jump to the
// exception handler for the nmethod if there is no Java level handler
// for the nmethod.
//
// This code is entered with a jmp.
//
// Arguments:
// O0: exception oop
// O1: exception pc
//
// Results:
// O0: exception oop
// O1: exception pc in caller or ???
// destination: exception handler of caller
//
// Note: the exception pc MUST be at a call (precise debug information)
//
void OptoRuntime::generate_exception_blob() {
// allocate space for code
// setup code generation tools
// Measured 8/7/03 at 256 in 32bit debug build (no VerifyThread)
// Measured 8/7/03 at 528 in 32bit debug build (VerifyThread)
Label L;
__ verify_thread();
// This call does all the hard work. It checks if an exception catch
// exists in the method.
// If so, it returns the handler address.
// If the nmethod has been deoptimized and it had a handler the handler
// address is the deopt blob unpack_with_exception entry.
//
// If no handler exists it prepares for stack-unwinding, restoring the callee-save
// registers of the frame being removed.
//
__ save_frame(0);
// This call can block at exit and nmethod can be deoptimized at that
// point. If the nmethod had a catch point we would jump to the
// now deoptimized catch point and fall thru the vanilla deopt
// path and lose the exception
// Sure would be simpler if this call didn't block!
// Set an oopmap for the call site. This oopmap will only be used if we
// are unwinding the stack. Hence, all locations will be dead.
// Callee-saved registers will be the same as the frame above (i.e.,
// handle_exception_stub), since they were restored when we got the
// exception.
// G3_scratch contains handler address
// Since this may be the deopt blob we must set O7 to look like we returned
// from the original pc that threw the exception
assert(Assembler::is_simm13(in_bytes(JavaThread::exception_oop_offset())), "exception offset overflows simm13, following ld instruction cannot be in delay slot");
#ifdef ASSERT
#endif
// Clear the exception oop so GC no longer processes it as a root.
// -------------
// make sure all code is generated
}