duke@435: /* xdono@631: * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * duke@435: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: * CA 95054 USA or visit www.sun.com if you need additional information or duke@435: * have any questions. duke@435: * duke@435: */ duke@435: duke@435: # include "incls/_precompiled.incl" duke@435: # include "incls/_frame_x86.cpp.incl" duke@435: duke@435: #ifdef ASSERT duke@435: void RegisterMap::check_location_valid() { duke@435: } duke@435: #endif duke@435: duke@435: duke@435: // Profiling/safepoint support duke@435: duke@435: bool frame::safe_for_sender(JavaThread *thread) { duke@435: address sp = (address)_sp; duke@435: address fp = (address)_fp; duke@435: address unextended_sp = (address)_unextended_sp; sgoldman@542: // sp must be within the stack sgoldman@542: bool sp_safe = (sp <= thread->stack_base()) && sgoldman@542: (sp >= thread->stack_base() - thread->stack_size()); sgoldman@542: sgoldman@542: if (!sp_safe) { sgoldman@542: return false; sgoldman@542: } sgoldman@542: sgoldman@542: // unextended sp must be within the stack and above or equal sp sgoldman@542: bool unextended_sp_safe = (unextended_sp <= thread->stack_base()) && sgoldman@542: (unextended_sp >= sp); sgoldman@542: sgoldman@542: if (!unextended_sp_safe) { sgoldman@542: return false; sgoldman@542: } sgoldman@542: sgoldman@542: // an fp must be within the stack and above (but not equal) sp sgoldman@542: bool fp_safe = (fp <= thread->stack_base()) && (fp > sp); sgoldman@542: sgoldman@542: // We know sp/unextended_sp are safe only fp is questionable here sgoldman@542: sgoldman@542: // If the current frame is known to the code cache then we can attempt to sgoldman@542: // to construct the sender and do some validation of it. This goes a long way sgoldman@542: // toward eliminating issues when we get in frame construction code sgoldman@542: sgoldman@542: if (_cb != NULL ) { sgoldman@542: sgoldman@542: // First check if frame is complete and tester is reliable duke@435: // Unfortunately we can only check frame complete for runtime stubs and nmethod duke@435: // other generic buffer blobs are more problematic so we just assume they are duke@435: // ok. adapter blobs never have a frame complete and are never ok. sgoldman@542: sgoldman@542: if (!_cb->is_frame_complete_at(_pc)) { duke@435: if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) { duke@435: return false; duke@435: } duke@435: } sgoldman@542: // Entry frame checks sgoldman@542: if (is_entry_frame()) { sgoldman@542: // an entry frame must have a valid fp. sgoldman@542: sgoldman@542: if (!fp_safe) return false; sgoldman@542: sgoldman@542: // Validate the JavaCallWrapper an entry frame must have sgoldman@542: sgoldman@542: address jcw = (address)entry_frame_call_wrapper(); sgoldman@542: sgoldman@542: bool jcw_safe = (jcw <= thread->stack_base()) && ( jcw > fp); sgoldman@542: sgoldman@542: return jcw_safe; sgoldman@542: sgoldman@542: } sgoldman@542: sgoldman@542: intptr_t* sender_sp = NULL; sgoldman@542: address sender_pc = NULL; sgoldman@542: sgoldman@542: if (is_interpreted_frame()) { sgoldman@542: // fp must be safe sgoldman@542: if (!fp_safe) { sgoldman@542: return false; sgoldman@542: } sgoldman@542: sgoldman@542: sender_pc = (address) this->fp()[return_addr_offset]; sgoldman@542: sender_sp = (intptr_t*) addr_at(sender_sp_offset); sgoldman@542: sgoldman@542: } else { sgoldman@542: // must be some sort of compiled/runtime frame sgoldman@542: // fp does not have to be safe (although it could be check for c1?) sgoldman@542: sgoldman@542: sender_sp = _unextended_sp + _cb->frame_size(); sgoldman@542: // On Intel the return_address is always the word on the stack sgoldman@542: sender_pc = (address) *(sender_sp-1); sgoldman@542: } sgoldman@542: sgoldman@542: // We must always be able to find a recognizable pc sgoldman@542: CodeBlob* sender_blob = CodeCache::find_blob_unsafe(sender_pc); sgoldman@542: if (sender_pc == NULL || sender_blob == NULL) { sgoldman@542: return false; sgoldman@542: } sgoldman@542: sgoldman@542: sgoldman@542: // If the potential sender is the interpreter then we can do some more checking sgoldman@542: if (Interpreter::contains(sender_pc)) { sgoldman@542: sgoldman@542: // ebp is always saved in a recognizable place in any code we generate. However sgoldman@542: // only if the sender is interpreted/call_stub (c1 too?) are we certain that the saved ebp sgoldman@542: // is really a frame pointer. sgoldman@542: sgoldman@542: intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset); sgoldman@542: bool saved_fp_safe = ((address)saved_fp <= thread->stack_base()) && (saved_fp > sender_sp); sgoldman@542: sgoldman@542: if (!saved_fp_safe) { sgoldman@542: return false; sgoldman@542: } sgoldman@542: sgoldman@542: // construct the potential sender sgoldman@542: sgoldman@542: frame sender(sender_sp, saved_fp, sender_pc); sgoldman@542: sgoldman@542: return sender.is_interpreted_frame_valid(thread); sgoldman@542: sgoldman@542: } sgoldman@542: sgoldman@542: // Could just be some random pointer within the codeBlob sgoldman@542: sgoldman@542: if (!sender_blob->instructions_contains(sender_pc)) return false; sgoldman@542: sgoldman@542: // We should never be able to see an adapter if the current frame is something from code cache sgoldman@542: sgoldman@542: if ( sender_blob->is_adapter_blob()) { sgoldman@542: return false; sgoldman@542: } sgoldman@542: sgoldman@542: // Could be the call_stub sgoldman@542: sgoldman@542: if (StubRoutines::returns_to_call_stub(sender_pc)) { sgoldman@542: intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset); sgoldman@542: bool saved_fp_safe = ((address)saved_fp <= thread->stack_base()) && (saved_fp > sender_sp); sgoldman@542: sgoldman@542: if (!saved_fp_safe) { sgoldman@542: return false; sgoldman@542: } sgoldman@542: sgoldman@542: // construct the potential sender sgoldman@542: sgoldman@542: frame sender(sender_sp, saved_fp, sender_pc); sgoldman@542: sgoldman@542: // Validate the JavaCallWrapper an entry frame must have sgoldman@542: address jcw = (address)sender.entry_frame_call_wrapper(); sgoldman@542: sgoldman@542: bool jcw_safe = (jcw <= thread->stack_base()) && ( jcw > (address)sender.fp()); sgoldman@542: sgoldman@542: return jcw_safe; sgoldman@542: } sgoldman@542: sgoldman@542: // If the frame size is 0 something is bad because every nmethod has a non-zero frame size sgoldman@542: // because the return address counts against the callee's frame. sgoldman@542: sgoldman@542: if (sender_blob->frame_size() == 0) { sgoldman@542: assert(!sender_blob->is_nmethod(), "should count return address at least"); sgoldman@542: return false; sgoldman@542: } sgoldman@542: sgoldman@542: // We should never be able to see anything here except an nmethod. If something in the sgoldman@542: // code cache (current frame) is called by an entity within the code cache that entity sgoldman@542: // should not be anything but the call stub (already covered), the interpreter (already covered) sgoldman@542: // or an nmethod. sgoldman@542: sgoldman@542: assert(sender_blob->is_nmethod(), "Impossible call chain"); sgoldman@542: sgoldman@542: // Could put some more validation for the potential non-interpreted sender sgoldman@542: // frame we'd create by calling sender if I could think of any. Wait for next crash in forte... sgoldman@542: sgoldman@542: // One idea is seeing if the sender_pc we have is one that we'd expect to call to current cb sgoldman@542: sgoldman@542: // We've validated the potential sender that would be created duke@435: return true; duke@435: } sgoldman@542: sgoldman@542: // Must be native-compiled frame. Since sender will try and use fp to find sgoldman@542: // linkages it must be safe sgoldman@542: sgoldman@542: if (!fp_safe) { sgoldman@542: return false; duke@435: } sgoldman@542: sgoldman@542: // Will the pc we fetch be non-zero (which we'll find at the oldest frame) sgoldman@542: sgoldman@542: if ( (address) this->fp()[return_addr_offset] == NULL) return false; sgoldman@542: sgoldman@542: sgoldman@542: // could try and do some more potential verification of native frame if we could think of some... sgoldman@542: sgoldman@542: return true; sgoldman@542: duke@435: } duke@435: duke@435: duke@435: void frame::patch_pc(Thread* thread, address pc) { duke@435: if (TracePcPatching) { never@739: tty->print_cr("patch_pc at address" INTPTR_FORMAT " [" INTPTR_FORMAT " -> " INTPTR_FORMAT "] ", never@739: &((address *)sp())[-1], ((address *)sp())[-1], pc); duke@435: } duke@435: ((address *)sp())[-1] = pc; duke@435: _cb = CodeCache::find_blob(pc); duke@435: if (_cb != NULL && _cb->is_nmethod() && ((nmethod*)_cb)->is_deopt_pc(_pc)) { duke@435: address orig = (((nmethod*)_cb)->get_original_pc(this)); duke@435: assert(orig == _pc, "expected original to be stored before patching"); duke@435: _deopt_state = is_deoptimized; duke@435: // leave _pc as is duke@435: } else { duke@435: _deopt_state = not_deoptimized; duke@435: _pc = pc; duke@435: } duke@435: } duke@435: duke@435: bool frame::is_interpreted_frame() const { duke@435: return Interpreter::contains(pc()); duke@435: } duke@435: cfang@1228: int frame::frame_size(RegisterMap* map) const { cfang@1228: frame sender = this->sender(map); duke@435: return sender.sp() - sp(); duke@435: } duke@435: duke@435: intptr_t* frame::entry_frame_argument_at(int offset) const { duke@435: // convert offset to index to deal with tsi duke@435: int index = (Interpreter::expr_offset_in_bytes(offset)/wordSize); duke@435: // Entry frame's arguments are always in relation to unextended_sp() duke@435: return &unextended_sp()[index]; duke@435: } duke@435: duke@435: // sender_sp duke@435: #ifdef CC_INTERP duke@435: intptr_t* frame::interpreter_frame_sender_sp() const { duke@435: assert(is_interpreted_frame(), "interpreted frame expected"); duke@435: // QQQ why does this specialize method exist if frame::sender_sp() does same thing? duke@435: // seems odd and if we always know interpreted vs. non then sender_sp() is really duke@435: // doing too much work. duke@435: return get_interpreterState()->sender_sp(); duke@435: } duke@435: duke@435: // monitor elements duke@435: duke@435: BasicObjectLock* frame::interpreter_frame_monitor_begin() const { duke@435: return get_interpreterState()->monitor_base(); duke@435: } duke@435: duke@435: BasicObjectLock* frame::interpreter_frame_monitor_end() const { duke@435: return (BasicObjectLock*) get_interpreterState()->stack_base(); duke@435: } duke@435: duke@435: #else // CC_INTERP duke@435: duke@435: intptr_t* frame::interpreter_frame_sender_sp() const { duke@435: assert(is_interpreted_frame(), "interpreted frame expected"); duke@435: return (intptr_t*) at(interpreter_frame_sender_sp_offset); duke@435: } duke@435: duke@435: void frame::set_interpreter_frame_sender_sp(intptr_t* sender_sp) { duke@435: assert(is_interpreted_frame(), "interpreted frame expected"); duke@435: ptr_at_put(interpreter_frame_sender_sp_offset, (intptr_t) sender_sp); duke@435: } duke@435: duke@435: duke@435: // monitor elements duke@435: duke@435: BasicObjectLock* frame::interpreter_frame_monitor_begin() const { duke@435: return (BasicObjectLock*) addr_at(interpreter_frame_monitor_block_bottom_offset); duke@435: } duke@435: duke@435: BasicObjectLock* frame::interpreter_frame_monitor_end() const { duke@435: BasicObjectLock* result = (BasicObjectLock*) *addr_at(interpreter_frame_monitor_block_top_offset); duke@435: // make sure the pointer points inside the frame duke@435: assert((intptr_t) fp() > (intptr_t) result, "result must < than frame pointer"); duke@435: assert((intptr_t) sp() <= (intptr_t) result, "result must >= than stack pointer"); duke@435: return result; duke@435: } duke@435: duke@435: void frame::interpreter_frame_set_monitor_end(BasicObjectLock* value) { duke@435: *((BasicObjectLock**)addr_at(interpreter_frame_monitor_block_top_offset)) = value; duke@435: } duke@435: duke@435: // Used by template based interpreter deoptimization duke@435: void frame::interpreter_frame_set_last_sp(intptr_t* sp) { duke@435: *((intptr_t**)addr_at(interpreter_frame_last_sp_offset)) = sp; duke@435: } duke@435: #endif // CC_INTERP duke@435: duke@435: frame frame::sender_for_entry_frame(RegisterMap* map) const { duke@435: assert(map != NULL, "map must be set"); duke@435: // Java frame called from C; skip all C frames and return top C duke@435: // frame of that chunk as the sender duke@435: JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor(); duke@435: assert(!entry_frame_is_first(), "next Java fp must be non zero"); duke@435: assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack"); duke@435: map->clear(); duke@435: assert(map->include_argument_oops(), "should be set by clear"); duke@435: if (jfa->last_Java_pc() != NULL ) { duke@435: frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc()); duke@435: return fr; duke@435: } duke@435: frame fr(jfa->last_Java_sp(), jfa->last_Java_fp()); duke@435: return fr; duke@435: } duke@435: duke@435: frame frame::sender_for_interpreter_frame(RegisterMap* map) const { duke@435: // sp is the raw sp from the sender after adapter or interpreter extension duke@435: intptr_t* sp = (intptr_t*) addr_at(sender_sp_offset); duke@435: duke@435: // This is the sp before any possible extension (adapter/locals). duke@435: intptr_t* unextended_sp = interpreter_frame_sender_sp(); duke@435: duke@435: // The interpreter and compiler(s) always save EBP/RBP in a known duke@435: // location on entry. We must record where that location is duke@435: // so this if EBP/RBP was live on callout from c2 we can find duke@435: // the saved copy no matter what it called. duke@435: duke@435: // Since the interpreter always saves EBP/RBP if we record where it is then duke@435: // we don't have to always save EBP/RBP on entry and exit to c2 compiled duke@435: // code, on entry will be enough. duke@435: #ifdef COMPILER2 duke@435: if (map->update_map()) { duke@435: map->set_location(rbp->as_VMReg(), (address) addr_at(link_offset)); duke@435: #ifdef AMD64 duke@435: // this is weird "H" ought to be at a higher address however the duke@435: // oopMaps seems to have the "H" regs at the same address and the duke@435: // vanilla register. duke@435: // XXXX make this go away duke@435: if (true) { duke@435: map->set_location(rbp->as_VMReg()->next(), (address)addr_at(link_offset)); duke@435: } duke@435: #endif // AMD64 duke@435: } duke@435: #endif /* COMPILER2 */ duke@435: return frame(sp, unextended_sp, link(), sender_pc()); duke@435: } duke@435: duke@435: duke@435: //------------------------------sender_for_compiled_frame----------------------- duke@435: frame frame::sender_for_compiled_frame(RegisterMap* map) const { duke@435: assert(map != NULL, "map must be set"); duke@435: const bool c1_compiled = _cb->is_compiled_by_c1(); duke@435: duke@435: // frame owned by optimizing compiler duke@435: intptr_t* sender_sp = NULL; duke@435: duke@435: assert(_cb->frame_size() >= 0, "must have non-zero frame size"); duke@435: sender_sp = unextended_sp() + _cb->frame_size(); duke@435: duke@435: // On Intel the return_address is always the word on the stack duke@435: address sender_pc = (address) *(sender_sp-1); duke@435: duke@435: // This is the saved value of ebp which may or may not really be an fp. duke@435: // it is only an fp if the sender is an interpreter frame (or c1?) duke@435: duke@435: intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset); duke@435: duke@435: if (map->update_map()) { duke@435: // Tell GC to use argument oopmaps for some runtime stubs that need it. duke@435: // For C1, the runtime stub might not have oop maps, so set this flag duke@435: // outside of update_register_map. duke@435: map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread())); duke@435: if (_cb->oop_maps() != NULL) { duke@435: OopMapSet::update_register_map(this, map); duke@435: } duke@435: // Since the prolog does the save and restore of epb there is no oopmap duke@435: // for it so we must fill in its location as if there was an oopmap entry duke@435: // since if our caller was compiled code there could be live jvm state in it. duke@435: map->set_location(rbp->as_VMReg(), (address) (sender_sp - frame::sender_sp_offset)); duke@435: #ifdef AMD64 duke@435: // this is weird "H" ought to be at a higher address however the duke@435: // oopMaps seems to have the "H" regs at the same address and the duke@435: // vanilla register. duke@435: // XXXX make this go away duke@435: if (true) { duke@435: map->set_location(rbp->as_VMReg()->next(), (address) (sender_sp - frame::sender_sp_offset)); duke@435: } duke@435: #endif // AMD64 duke@435: } duke@435: duke@435: assert(sender_sp != sp(), "must have changed"); duke@435: return frame(sender_sp, saved_fp, sender_pc); duke@435: } duke@435: duke@435: frame frame::sender(RegisterMap* map) const { duke@435: // Default is we done have to follow them. The sender_for_xxx will duke@435: // update it accordingly duke@435: map->set_include_argument_oops(false); duke@435: duke@435: if (is_entry_frame()) return sender_for_entry_frame(map); duke@435: if (is_interpreted_frame()) return sender_for_interpreter_frame(map); duke@435: assert(_cb == CodeCache::find_blob(pc()),"Must be the same"); duke@435: duke@435: if (_cb != NULL) { duke@435: return sender_for_compiled_frame(map); duke@435: } duke@435: // Must be native-compiled frame, i.e. the marshaling code for native duke@435: // methods that exists in the core system. duke@435: return frame(sender_sp(), link(), sender_pc()); duke@435: } duke@435: duke@435: duke@435: bool frame::interpreter_frame_equals_unpacked_fp(intptr_t* fp) { duke@435: assert(is_interpreted_frame(), "must be interpreter frame"); duke@435: methodOop method = interpreter_frame_method(); duke@435: // When unpacking an optimized frame the frame pointer is duke@435: // adjusted with: duke@435: int diff = (method->max_locals() - method->size_of_parameters()) * duke@435: Interpreter::stackElementWords(); duke@435: return _fp == (fp - diff); duke@435: } duke@435: duke@435: void frame::pd_gc_epilog() { duke@435: // nothing done here now duke@435: } duke@435: sgoldman@542: bool frame::is_interpreted_frame_valid(JavaThread* thread) const { duke@435: // QQQ duke@435: #ifdef CC_INTERP duke@435: #else duke@435: assert(is_interpreted_frame(), "Not an interpreted frame"); duke@435: // These are reasonable sanity checks duke@435: if (fp() == 0 || (intptr_t(fp()) & (wordSize-1)) != 0) { duke@435: return false; duke@435: } duke@435: if (sp() == 0 || (intptr_t(sp()) & (wordSize-1)) != 0) { duke@435: return false; duke@435: } duke@435: if (fp() + interpreter_frame_initial_sp_offset < sp()) { duke@435: return false; duke@435: } duke@435: // These are hacks to keep us out of trouble. duke@435: // The problem with these is that they mask other problems duke@435: if (fp() <= sp()) { // this attempts to deal with unsigned comparison above duke@435: return false; duke@435: } sgoldman@542: sgoldman@542: // do some validation of frame elements sgoldman@542: sgoldman@542: // first the method sgoldman@542: sgoldman@542: methodOop m = *interpreter_frame_method_addr(); sgoldman@542: sgoldman@542: // validate the method we'd find in this potential sender sgoldman@542: if (!Universe::heap()->is_valid_method(m)) return false; sgoldman@542: sgoldman@542: // stack frames shouldn't be much larger than max_stack elements sgoldman@542: sgoldman@542: if (fp() - sp() > 1024 + m->max_stack()*Interpreter::stackElementSize()) { duke@435: return false; duke@435: } sgoldman@542: sgoldman@542: // validate bci/bcx sgoldman@542: sgoldman@542: intptr_t bcx = interpreter_frame_bcx(); sgoldman@542: if (m->validate_bci_from_bcx(bcx) < 0) { sgoldman@542: return false; sgoldman@542: } sgoldman@542: sgoldman@542: // validate constantPoolCacheOop sgoldman@542: sgoldman@542: constantPoolCacheOop cp = *interpreter_frame_cache_addr(); sgoldman@542: sgoldman@542: if (cp == NULL || sgoldman@542: !Space::is_aligned(cp) || sgoldman@542: !Universe::heap()->is_permanent((void*)cp)) return false; sgoldman@542: sgoldman@542: // validate locals sgoldman@542: sgoldman@542: address locals = (address) *interpreter_frame_locals_addr(); sgoldman@542: sgoldman@542: if (locals > thread->stack_base() || locals < (address) fp()) return false; sgoldman@542: sgoldman@542: // We'd have to be pretty unlucky to be mislead at this point sgoldman@542: duke@435: #endif // CC_INTERP duke@435: return true; duke@435: } duke@435: duke@435: BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) { duke@435: #ifdef CC_INTERP duke@435: // Needed for JVMTI. The result should always be in the interpreterState object duke@435: assert(false, "NYI"); duke@435: interpreterState istate = get_interpreterState(); duke@435: #endif // CC_INTERP duke@435: assert(is_interpreted_frame(), "interpreted frame expected"); duke@435: methodOop method = interpreter_frame_method(); duke@435: BasicType type = method->result_type(); duke@435: duke@435: intptr_t* tos_addr; duke@435: if (method->is_native()) { duke@435: // Prior to calling into the runtime to report the method_exit the possible duke@435: // return value is pushed to the native stack. If the result is a jfloat/jdouble duke@435: // then ST0 is saved before EAX/EDX. See the note in generate_native_result duke@435: tos_addr = (intptr_t*)sp(); duke@435: if (type == T_FLOAT || type == T_DOUBLE) { duke@435: // QQQ seems like this code is equivalent on the two platforms duke@435: #ifdef AMD64 duke@435: // This is times two because we do a push(ltos) after pushing XMM0 duke@435: // and that takes two interpreter stack slots. duke@435: tos_addr += 2 * Interpreter::stackElementWords(); duke@435: #else duke@435: tos_addr += 2; duke@435: #endif // AMD64 duke@435: } duke@435: } else { duke@435: tos_addr = (intptr_t*)interpreter_frame_tos_address(); duke@435: } duke@435: duke@435: switch (type) { duke@435: case T_OBJECT : duke@435: case T_ARRAY : { duke@435: oop obj; duke@435: if (method->is_native()) { duke@435: #ifdef CC_INTERP duke@435: obj = istate->_oop_temp; duke@435: #else duke@435: obj = (oop) at(interpreter_frame_oop_temp_offset); duke@435: #endif // CC_INTERP duke@435: } else { duke@435: oop* obj_p = (oop*)tos_addr; duke@435: obj = (obj_p == NULL) ? (oop)NULL : *obj_p; duke@435: } duke@435: assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check"); duke@435: *oop_result = obj; duke@435: break; duke@435: } duke@435: case T_BOOLEAN : value_result->z = *(jboolean*)tos_addr; break; duke@435: case T_BYTE : value_result->b = *(jbyte*)tos_addr; break; duke@435: case T_CHAR : value_result->c = *(jchar*)tos_addr; break; duke@435: case T_SHORT : value_result->s = *(jshort*)tos_addr; break; duke@435: case T_INT : value_result->i = *(jint*)tos_addr; break; duke@435: case T_LONG : value_result->j = *(jlong*)tos_addr; break; duke@435: case T_FLOAT : { duke@435: #ifdef AMD64 duke@435: value_result->f = *(jfloat*)tos_addr; duke@435: #else duke@435: if (method->is_native()) { duke@435: jdouble d = *(jdouble*)tos_addr; // Result was in ST0 so need to convert to jfloat duke@435: value_result->f = (jfloat)d; duke@435: } else { duke@435: value_result->f = *(jfloat*)tos_addr; duke@435: } duke@435: #endif // AMD64 duke@435: break; duke@435: } duke@435: case T_DOUBLE : value_result->d = *(jdouble*)tos_addr; break; duke@435: case T_VOID : /* Nothing to do */ break; duke@435: default : ShouldNotReachHere(); duke@435: } duke@435: duke@435: return type; duke@435: } duke@435: duke@435: duke@435: intptr_t* frame::interpreter_frame_tos_at(jint offset) const { duke@435: int index = (Interpreter::expr_offset_in_bytes(offset)/wordSize); duke@435: return &interpreter_frame_tos_address()[index]; duke@435: }