1696 intptr_t* esp = monitors - 1 - |
1696 intptr_t* esp = monitors - 1 - |
1697 (tempcount * Interpreter::stackElementWords) - |
1697 (tempcount * Interpreter::stackElementWords) - |
1698 popframe_extra_args; |
1698 popframe_extra_args; |
1699 |
1699 |
1700 int local_words = method->max_locals() * Interpreter::stackElementWords; |
1700 int local_words = method->max_locals() * Interpreter::stackElementWords; |
1701 int parm_words = method->size_of_parameters() * Interpreter::stackElementWords; |
|
1702 NEEDS_CLEANUP; |
|
1703 intptr_t* locals; |
1701 intptr_t* locals; |
1704 if (caller->is_interpreted_frame()) { |
1702 if (caller->is_compiled_frame()) { |
1705 // Can force the locals area to end up properly overlapping the top of the expression stack. |
1703 // Compiled frames do not allocate a varargs area so place them |
1706 intptr_t* Lesp_ptr = caller->interpreter_frame_tos_address() - 1; |
1704 // next to the register save area. |
1707 // Note that this computation means we replace size_of_parameters() values from the caller |
1705 locals = fp + frame::register_save_words + local_words - 1; |
1708 // interpreter frame's expression stack with our argument locals |
1706 // Caller wants his own SP back |
1709 locals = Lesp_ptr + parm_words; |
1707 int caller_frame_size = caller->cb()->frame_size(); |
1710 int delta = local_words - parm_words; |
1708 *interpreter_frame->register_addr(I5_savedSP) = (intptr_t)(caller->fp() - caller_frame_size) - STACK_BIAS; |
1711 int computed_sp_adjustment = (delta > 0) ? round_to(delta, WordsPerLong) : 0; |
|
1712 *interpreter_frame->register_addr(I5_savedSP) = (intptr_t) (fp + computed_sp_adjustment) - STACK_BIAS; |
|
1713 } else { |
1709 } else { |
1714 assert(caller->is_compiled_frame() || caller->is_entry_frame(), "only possible cases"); |
1710 assert(caller->is_interpreted_frame() || caller->is_entry_frame(), "only possible cases"); |
1715 // Don't have Lesp available; lay out locals block in the caller |
1711 // The entry and interpreter frames are laid out like normal C |
1716 // adjacent to the register window save area. |
1712 // frames so place the locals adjacent to the varargs area. |
1717 // |
1713 locals = fp + frame::memory_parameter_word_sp_offset + local_words - 1; |
1718 // Compiled frames do not allocate a varargs area which is why this if |
1714 if (caller->is_interpreted_frame()) { |
1719 // statement is needed. |
1715 *interpreter_frame->register_addr(I5_savedSP) = (intptr_t) (fp + rounded_cls) - STACK_BIAS; |
1720 // |
|
1721 if (caller->is_compiled_frame()) { |
|
1722 locals = fp + frame::register_save_words + local_words - 1; |
|
1723 } else { |
|
1724 locals = fp + frame::memory_parameter_word_sp_offset + local_words - 1; |
|
1725 } |
|
1726 if (!caller->is_entry_frame()) { |
|
1727 // Caller wants his own SP back |
|
1728 int caller_frame_size = caller->cb()->frame_size(); |
|
1729 *interpreter_frame->register_addr(I5_savedSP) = (intptr_t)(caller->fp() - caller_frame_size) - STACK_BIAS; |
|
1730 } |
1716 } |
1731 } |
1717 } |
1732 if (TraceDeoptimization) { |
1718 if (TraceDeoptimization) { |
1733 if (caller->is_entry_frame()) { |
1719 if (caller->is_entry_frame()) { |
1734 // make sure I5_savedSP and the entry frames notion of saved SP |
1720 // make sure I5_savedSP and the entry frames notion of saved SP |