/*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "opto/addnode.hpp"
#include "opto/callnode.hpp"
#include "opto/cfgnode.hpp"
#include "opto/compile.hpp"
#include "opto/connode.hpp"
#include "opto/locknode.hpp"
#include "opto/memnode.hpp"
#include "opto/mulnode.hpp"
#include "opto/phaseX.hpp"
#include "opto/rootnode.hpp"
#include "opto/runtime.hpp"
//--------------------gen_stub-------------------------------
const char *name,
int is_fancy_jump,
bool pass_tls,
bool return_pc) {
// The procedure start
// Make a map, with JVM state
// %%% SynchronizationEntryBCI is redundant; use InvocationEntryBci in interfaces
{
}
// Make up the parameters
uint i;
for( i = 0; i < parm_cnt; i++ )
// GraphKit requires memory to be a MergeMemNode:
// Get base of thread-local storage area
#endif /* defined(SPARC) || defined(IA64) */
// Drop in the last_Java_sp. last_Java_fp is not touched.
// Always do this after the other "last_Java_frame" fields are set since
// as soon as last_Java_sp != NULL the has_last_Java_frame is true and
// users will look at the other fields.
//
#ifndef IA64
#endif
// Set _thread_in_native
// The order of stores into TLS is critical! Setting _thread_in_native MUST
// be last, because a GC is allowed at any time after setting it and the GC
// will require last_Java_pc and last_Java_sp.
//-----------------------------
// Compute signature for C call. Varies from the Java signature!
// The C routines gets the base of thread-local storage passed in as an
// extra argument. Not all calls need it, but its cheap to add here.
// Also pass in the caller's PC, if asked for.
if( return_pc )
// The C routine we are about to call cannot return an oop; it can block on
// exit and a GC will trash the oop while it sits in C-land. Instead, we
// return the oop through TLS for runtime calls.
// Also, C routines returning integer subword values leave the high
// order bits dirty; these must be cleaned up by explicit sign extension.
const Type* retval = (jrange->cnt() == TypeFunc::Parms) ? Type::TOP : jrange->field_at(TypeFunc::Parms);
// Make a private copy of jrange->fields();
// Fixup oop returns
if( retval_ptr ) {
// Fancy-jumps return address; others return void
// "Fatten" byte, char & short return types to 'int' to show that
// the native C code can return values with junk high order bits.
// We'll sign-extend it below later.
}
// Final C signature
//-----------------------------
// Make the call node
//-----------------------------
// Fix-up the debug info for the call
// Set fixed predefined input arguments
cnt = 0;
// A little too aggressive on the parm copy; return address is not an input
for( ; i<parm_cnt; i++ ) // Regular input arguments
if( return_pc ) // Return PC, if asked for
//-----------------------------
// Now set up the return results
// C-land is allowed to return sub-word values. Convert to integer type.
}
}
//-----------------------------
// Clear last_Java_sp
#ifdef IA64
#endif
#ifdef IA64
#endif // def IA64
// Clear last_Java_pc and (optionally)_flags
#endif /* defined(SPARC) || defined(IA64) */
#ifdef IA64
Node* adr_last_Java_fp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_fp_offset()));
#endif
// For is-fancy-jump, the C-return value is also the branch target
// Runtime call returning oop in TLS? Fetch it out
if( pass_tls ) {
// clear thread-local-storage(tls)
}
//-----------------------------
// check exception
i_o(),
frameptr(),
returnadr(),
exc_target, null());
C->init_start(start);
//-----------------------------
// If this is a normal subroutine return, issue the return and be done.
switch( is_fancy_jump ) {
case 0: // Make a return instruction
// Return to caller, free any space for return address
i_o(),
frameptr(),
returnadr());
break;
case 1: // This is a fancy tail-call jump. Jump to computed address.
// Jump to new callee; leave old return address alone.
i_o(),
frameptr(),
returnadr(),
break;
case 2: // Pop return address & jump
// Throw away old return address; jump to new computed address
//assert(C_function == CAST_FROM_FN_PTR(address, OptoRuntime::rethrow_C), "fancy_jump==2 only for rethrow");
i_o(),
frameptr(),
break;
default:
}
}