src/cpu/x86/vm/cppInterpreter_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/cpu/x86/vm/cppInterpreter_x86.cpp

src/cpu/x86/vm/cppInterpreter_x86.cpp

Print this page
rev 6132 : 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
Summary: make compiled code bang the stack by the worst case size of the interpreter frame at deoptimization points.
Reviewed-by:
rev 6133 : [mq]: newstackbang-reviews

*** 2340,2398 **** to_fill->_self_link = to_fill; assert(stack >= to_fill->_stack_limit && stack < to_fill->_stack_base, "Stack top out of range"); } ! int AbstractInterpreter::layout_activation(Method* method, ! int tempcount, // ! int popframe_extra_args, int moncount, - int caller_actual_parameters, int callee_param_count, int callee_locals, - frame* caller, - frame* interpreter_frame, bool is_top_frame, ! bool is_bottom_frame) { assert(popframe_extra_args == 0, "FIX ME"); - // NOTE this code must exactly mimic what InterpreterGenerator::generate_compute_interpreter_state() - // does as far as allocating an interpreter frame. - // If interpreter_frame!=NULL, set up the method, locals, and monitors. - // The frame interpreter_frame, if not NULL, is guaranteed to be the right size, - // as determined by a previous call to this method. - // It is also guaranteed to be walkable even though it is in a skeletal state // NOTE: return size is in words not bytes - // NOTE: tempcount is the current size of the java expression stack. For top most - // frames we will allocate a full sized expression stack and not the curback - // version that non-top frames have. // Calculate the amount our frame will be adjust by the callee. For top frame // this is zero. // NOTE: ia64 seems to do this wrong (or at least backwards) in that it // calculates the extra locals based on itself. Not what the callee does // to it. So it ignores last_frame_adjust value. Seems suspicious as far // as getting sender_sp correct. ! int extra_locals_size = (callee_locals - callee_param_count) * BytesPerWord; ! int monitor_size = sizeof(BasicObjectLock) * moncount; ! ! // First calculate the frame size without any java expression stack ! int short_frame_size = size_activation_helper(extra_locals_size, ! monitor_size); ! // Now with full size expression stack ! int full_frame_size = short_frame_size + method->max_stack() * BytesPerWord; ! // and now with only live portion of the expression stack ! short_frame_size = short_frame_size + tempcount * BytesPerWord; ! // the size the activation is right now. Only top frame is full size ! int frame_size = (is_top_frame ? full_frame_size : short_frame_size); - if (interpreter_frame != NULL) { #ifdef ASSERT assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable"); #endif // MUCHO HACK --- 2340,2428 ---- to_fill->_self_link = to_fill; assert(stack >= to_fill->_stack_limit && stack < to_fill->_stack_base, "Stack top out of range"); } ! ! static int frame_size_helper(int max_stack, ! int tempcount, int moncount, int callee_param_count, int callee_locals, bool is_top_frame, ! int& monitor_size, ! int& full_frame_size) { ! int extra_locals_size = (callee_locals - callee_param_count) * BytesPerWord; ! monitor_size = sizeof(BasicObjectLock) * moncount; ! ! // First calculate the frame size without any java expression stack ! int short_frame_size = size_activation_helper(extra_locals_size, ! monitor_size); ! ! // Now with full size expression stack ! full_frame_size = short_frame_size + max_stack * BytesPerWord; ! ! // and now with only live portion of the expression stack ! short_frame_size = short_frame_size + tempcount * BytesPerWord; ! ! // the size the activation is right now. Only top frame is full size ! int frame_size = (is_top_frame ? full_frame_size : short_frame_size); ! return frame_size; ! } + int AbstractInterpreter::size_activation(int max_stack, + int tempcount, + int popframe_extra_args, + int moncount, + int callee_param_count, + int callee_locals, + bool is_top_frame) { assert(popframe_extra_args == 0, "FIX ME"); // NOTE: return size is in words not bytes // Calculate the amount our frame will be adjust by the callee. For top frame // this is zero. // NOTE: ia64 seems to do this wrong (or at least backwards) in that it // calculates the extra locals based on itself. Not what the callee does // to it. So it ignores last_frame_adjust value. Seems suspicious as far // as getting sender_sp correct. ! int unused_monitor_size = 0; ! int unused_full_frame_size = 0; ! return frame_size_helper(max_stack, tempcount, moncount, callee_param_count, callee_locals, ! is_top_frame, unused_monitor_size, unused_full_frame_size)/BytesPerWord; ! } ! void AbstractInterpreter::layout_activation(Method* method, ! int tempcount, // ! int popframe_extra_args, ! int moncount, ! int caller_actual_parameters, ! int callee_param_count, ! int callee_locals, ! frame* caller, ! frame* interpreter_frame, ! bool is_top_frame, ! bool is_bottom_frame) { ! assert(popframe_extra_args == 0, "FIX ME"); ! // NOTE this code must exactly mimic what InterpreterGenerator::generate_compute_interpreter_state() ! // does as far as allocating an interpreter frame. ! // Set up the method, locals, and monitors. ! // The frame interpreter_frame is guaranteed to be the right size, ! // as determined by a previous call to the size_activation() method. ! // It is also guaranteed to be walkable even though it is in a skeletal state ! // NOTE: tempcount is the current size of the java expression stack. For top most ! // frames we will allocate a full sized expression stack and not the curback ! // version that non-top frames have. ! int monitor_size = 0; ! int full_frame_size = 0; ! int frame_size = frame_size_helper(method->max_stack(), tempcount, moncount, callee_param_count, callee_locals, ! is_top_frame, monitor_size, full_frame_size); #ifdef ASSERT assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable"); #endif // MUCHO HACK
*** 2451,2462 **** monitor_base, frame_bottom, is_top_frame); // BytecodeInterpreter::pd_layout_interpreterState(cur_state, interpreter_return_address, interpreter_frame->fp()); - } - return frame_size/BytesPerWord; } bool AbstractInterpreter::can_be_compiled(methodHandle m) { switch (method_kind(m)) { case Interpreter::java_lang_math_sin : // fall thru --- 2481,2490 ----
src/cpu/x86/vm/cppInterpreter_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File