comparison src/cpu/sparc/vm/templateInterpreter_sparc.cpp @ 3369:3d2ab563047a

7043461: VM crashes in void LinkResolver::runtime_resolve_virtual_method Reviewed-by: kvn, coleenp
author never
date Thu, 12 May 2011 10:29:02 -0700
parents 3cfb240033d1
children f7d55ea6ee56
comparison
equal deleted inserted replaced
3365:3cfb240033d1 3369:3d2ab563047a
1621 1621
1622 int AbstractInterpreter::layout_activation(methodOop method, 1622 int AbstractInterpreter::layout_activation(methodOop method,
1623 int tempcount, 1623 int tempcount,
1624 int popframe_extra_args, 1624 int popframe_extra_args,
1625 int moncount, 1625 int moncount,
1626 int caller_actual_parameters,
1626 int callee_param_count, 1627 int callee_param_count,
1627 int callee_local_count, 1628 int callee_local_count,
1628 frame* caller, 1629 frame* caller,
1629 frame* interpreter_frame, 1630 frame* interpreter_frame,
1630 bool is_top_frame) { 1631 bool is_top_frame) {
1696 intptr_t* esp = monitors - 1 - 1697 intptr_t* esp = monitors - 1 -
1697 (tempcount * Interpreter::stackElementWords) - 1698 (tempcount * Interpreter::stackElementWords) -
1698 popframe_extra_args; 1699 popframe_extra_args;
1699 1700
1700 int local_words = method->max_locals() * Interpreter::stackElementWords; 1701 int local_words = method->max_locals() * Interpreter::stackElementWords;
1702 NEEDS_CLEANUP;
1701 intptr_t* locals; 1703 intptr_t* locals;
1702 if (caller->is_compiled_frame()) { 1704 if (caller->is_interpreted_frame()) {
1703 // Compiled frames do not allocate a varargs area so place them 1705 // Can force the locals area to end up properly overlapping the top of the expression stack.
1704 // next to the register save area. 1706 intptr_t* Lesp_ptr = caller->interpreter_frame_tos_address() - 1;
1705 locals = fp + frame::register_save_words + local_words - 1; 1707 // Note that this computation means we replace size_of_parameters() values from the caller
1706 // Caller wants his own SP back 1708 // interpreter frame's expression stack with our argument locals
1707 int caller_frame_size = caller->cb()->frame_size(); 1709 int parm_words = caller_actual_parameters * Interpreter::stackElementWords;
1708 *interpreter_frame->register_addr(I5_savedSP) = (intptr_t)(caller->fp() - caller_frame_size) - STACK_BIAS; 1710 locals = Lesp_ptr + parm_words;
1711 int delta = local_words - parm_words;
1712 int computed_sp_adjustment = (delta > 0) ? round_to(delta, WordsPerLong) : 0;
1713 *interpreter_frame->register_addr(I5_savedSP) = (intptr_t) (fp + computed_sp_adjustment) - STACK_BIAS;
1709 } else { 1714 } else {
1710 assert(caller->is_interpreted_frame() || caller->is_entry_frame(), "only possible cases"); 1715 assert(caller->is_compiled_frame() || caller->is_entry_frame(), "only possible cases");
1711 // The entry and interpreter frames are laid out like normal C 1716 // Don't have Lesp available; lay out locals block in the caller
1712 // frames so place the locals adjacent to the varargs area. 1717 // adjacent to the register window save area.
1713 locals = fp + frame::memory_parameter_word_sp_offset + local_words - 1; 1718 //
1714 if (caller->is_interpreted_frame()) { 1719 // Compiled frames do not allocate a varargs area which is why this if
1715 int parm_words = method->size_of_parameters() * Interpreter::stackElementWords; 1720 // statement is needed.
1716 int delta = local_words - parm_words; 1721 //
1717 int computed_sp_adjustment = (delta > 0) ? round_to(delta, WordsPerLong) : 0; 1722 if (caller->is_compiled_frame()) {
1718 *interpreter_frame->register_addr(I5_savedSP) = (intptr_t) (fp + computed_sp_adjustment) - STACK_BIAS; 1723 locals = fp + frame::register_save_words + local_words - 1;
1724 } else {
1725 locals = fp + frame::memory_parameter_word_sp_offset + local_words - 1;
1726 }
1727 if (!caller->is_entry_frame()) {
1728 // Caller wants his own SP back
1729 int caller_frame_size = caller->cb()->frame_size();
1730 *interpreter_frame->register_addr(I5_savedSP) = (intptr_t)(caller->fp() - caller_frame_size) - STACK_BIAS;
1719 } 1731 }
1720 } 1732 }
1721 if (TraceDeoptimization) { 1733 if (TraceDeoptimization) {
1722 if (caller->is_entry_frame()) { 1734 if (caller->is_entry_frame()) {
1723 // make sure I5_savedSP and the entry frames notion of saved SP 1735 // make sure I5_savedSP and the entry frames notion of saved SP