--- old/src/cpu/sparc/vm/cppInterpreter_sparc.cpp 2013-03-29 19:14:21.193438344 +0100 +++ new/src/cpu/sparc/vm/cppInterpreter_sparc.cpp 2013-03-29 19:14:21.047279025 +0100 @@ -1059,7 +1059,6 @@ const int slop_factor = 2*wordSize; const int fixed_size = ((sizeof(BytecodeInterpreter) + slop_factor) >> LogBytesPerWord) + // what is the slop factor? - //6815692//Method::extra_stack_words() + // extra push slots for MH adapters frame::memory_parameter_word_sp_offset + // register save area + param window (native ? frame::interpreter_frame_extra_outgoing_argument_words : 0); // JNI, class @@ -2078,9 +2077,7 @@ const int fixed_size = sizeof(BytecodeInterpreter)/wordSize + // interpreter state object frame::memory_parameter_word_sp_offset; // register save area + param window - const int extra_stack = 0; //6815692//Method::extra_stack_entries(); return (round_to(max_stack + - extra_stack + slop_factor + fixed_size + monitor_size + @@ -2167,8 +2164,7 @@ // Need +1 here because stack_base points to the word just above the first expr stack entry // and stack_limit is supposed to point to the word just below the last expr stack entry. // See generate_compute_interpreter_state. - int extra_stack = 0; //6815692//Method::extra_stack_entries(); - to_fill->_stack_limit = stack_base - (method->max_stack() + 1 + extra_stack); + to_fill->_stack_limit = stack_base - (method->max_stack() + 1); to_fill->_monitor_base = (BasicObjectLock*) monitor_base; // sparc specific --- old/src/cpu/sparc/vm/templateInterpreter_sparc.cpp 2013-03-29 19:14:22.532049332 +0100 +++ new/src/cpu/sparc/vm/templateInterpreter_sparc.cpp 2013-03-29 19:14:22.363674057 +0100 @@ -499,7 +499,6 @@ const int extra_space = rounded_vm_local_words + // frame local scratch space - //6815692//Method::extra_stack_words() + // extra push slots for MH adapters frame::memory_parameter_word_sp_offset + // register save area (native_call ? frame::interpreter_frame_extra_outgoing_argument_words : 0); @@ -1550,7 +1549,6 @@ round_to(callee_extra_locals * Interpreter::stackElementWords, WordsPerLong); const int max_stack_words = max_stack * Interpreter::stackElementWords; return (round_to((max_stack_words - //6815692//+ Method::extra_stack_words() + rounded_vm_local_words + frame::memory_parameter_word_sp_offset), WordsPerLong) // already rounded --- old/src/cpu/x86/vm/cppInterpreter_x86.cpp 2013-03-29 19:14:23.928926867 +0100 +++ new/src/cpu/x86/vm/cppInterpreter_x86.cpp 2013-03-29 19:14:23.752147200 +0100 @@ -539,12 +539,11 @@ // compute full expression stack limit - const int extra_stack = 0; //6815692//Method::extra_stack_words(); __ movptr(rdx, Address(rbx, Method::const_offset())); __ load_unsigned_short(rdx, Address(rdx, ConstMethod::max_stack_offset())); // get size of expression stack in words __ negptr(rdx); // so we can subtract in next step // Allocate expression stack - __ lea(rsp, Address(rsp, rdx, Address::times_ptr, -extra_stack)); + __ lea(rsp, Address(rsp, rdx, Address::times_ptr)); __ movptr(STATE(_stack_limit), rsp); } @@ -684,10 +683,9 @@ // Always give one monitor to allow us to start interp if sync method. // Any additional monitors need a check when moving the expression stack const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; - const int extra_stack = 0; //6815692//Method::extra_stack_entries(); __ movptr(rax, Address(rbx, Method::const_offset())); __ load_unsigned_short(rax, Address(rax, ConstMethod::max_stack_offset())); // get size of expression stack in words - __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), extra_stack + one_monitor)); + __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), one_monitor)); __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size)); #ifdef ASSERT @@ -2277,8 +2275,7 @@ const int overhead_size = sizeof(BytecodeInterpreter)/wordSize + ( frame::sender_sp_offset - frame::link_offset) + 2; - const int extra_stack = 0; //6815692//Method::extra_stack_entries(); - const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) * + const int method_stack = (method->max_locals() + method->max_stack()) * Interpreter::stackElementWords; return overhead_size + method_stack + stub_code; } @@ -2343,8 +2340,7 @@ // Need +1 here because stack_base points to the word just above the first expr stack entry // and stack_limit is supposed to point to the word just below the last expr stack entry. // See generate_compute_interpreter_state. - int extra_stack = 0; //6815692//Method::extra_stack_entries(); - to_fill->_stack_limit = stack_base - (method->max_stack() + extra_stack + 1); + to_fill->_stack_limit = stack_base - (method->max_stack() + 1); to_fill->_monitor_base = (BasicObjectLock*) monitor_base; to_fill->_self_link = to_fill; @@ -2392,8 +2388,7 @@ monitor_size); // Now with full size expression stack - int extra_stack = 0; //6815692//Method::extra_stack_entries(); - int full_frame_size = short_frame_size + (method->max_stack() + extra_stack) * BytesPerWord; + 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; --- old/src/cpu/x86/vm/templateInterpreter_x86_32.cpp 2013-03-29 19:14:25.283016042 +0100 +++ new/src/cpu/x86/vm/templateInterpreter_x86_32.cpp 2013-03-29 19:14:25.115414359 +0100 @@ -1568,8 +1568,7 @@ // be sure to change this if you add/subtract anything to/from the overhead area const int overhead_size = -frame::interpreter_frame_initial_sp_offset; - const int extra_stack = Method::extra_stack_entries(); - const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) * + const int method_stack = (method->max_locals() + method->max_stack()) * Interpreter::stackElementWords; return overhead_size + method_stack + stub_code; } --- old/src/cpu/x86/vm/templateInterpreter_x86_64.cpp 2013-03-29 19:14:26.636257008 +0100 +++ new/src/cpu/x86/vm/templateInterpreter_x86_64.cpp 2013-03-29 19:14:26.452457497 +0100 @@ -1584,8 +1584,7 @@ -(frame::interpreter_frame_initial_sp_offset) + entry_size; const int stub_code = frame::entry_frame_after_call_words; - const int extra_stack = Method::extra_stack_entries(); - const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) * + const int method_stack = (method->max_locals() + method->max_stack()) * Interpreter::stackElementWords; return (overhead_size + method_stack + stub_code); } --- old/src/share/vm/oops/method.cpp 2013-03-29 19:14:28.038678054 +0100 +++ new/src/share/vm/oops/method.cpp 2013-03-29 19:14:27.854556370 +0100 @@ -392,13 +392,6 @@ // => nothing to do (keep this method around for future use) } - -int Method::extra_stack_words() { - // not an inline function, to avoid a header dependency on Interpreter - return extra_stack_entries() * Interpreter::stackElementSize; -} - - void Method::compute_size_of_parameters(Thread *thread) { ArgumentSizeComputer asc(signature()); set_size_of_parameters(asc.size() + (is_static() ? 0 : 1)); --- old/src/share/vm/oops/method.hpp 2013-03-29 19:14:29.338356358 +0100 +++ new/src/share/vm/oops/method.hpp 2013-03-29 19:14:29.154992820 +0100 @@ -154,6 +154,12 @@ // Constructor Method(ConstMethod* xconst, AccessFlags access_flags, int size); + + // this operates only on invoke methods: + // presize interpreter frames for extra interpreter stack entries, if needed + // Account for the extra appendix argument for invokehandle/invokedynamic + static int extra_stack_entries() { return EnableInvokeDynamic ? 1 : 0; } + public: static Method* allocate(ClassLoaderData* loader_data, @@ -274,9 +280,9 @@ // max stack // return original max stack size for method verification - int verifier_max_stack() const { return constMethod()->max_stack(); } - int max_stack() const { return constMethod()->max_stack() + extra_stack_entries(); } - void set_max_stack(int size) { constMethod()->set_max_stack(size); } + int verifier_max_stack() const { return constMethod()->max_stack() - extra_stack_entries(); } + int max_stack() const { return constMethod()->max_stack(); } + void set_max_stack(int size) { constMethod()->set_max_stack(size + extra_stack_entries()); } // max locals int max_locals() const { return constMethod()->max_locals(); } @@ -630,13 +636,6 @@ Symbol* signature, //anything at all TRAPS); static Klass* check_non_bcp_klass(Klass* klass); - // these operate only on invoke methods: - // presize interpreter frames for extra interpreter stack entries, if needed - // method handles want to be able to push a few extra values (e.g., a bound receiver), and - // invokedynamic sometimes needs to push a bootstrap method, call site, and arglist, - // all without checking for a stack overflow - static int extra_stack_entries() { return EnableInvokeDynamic ? 2 : 0; } - static int extra_stack_words(); // = extra_stack_entries() * Interpreter::stackElementSize() // RedefineClasses() support: bool is_old() const { return access_flags().is_old(); } --- old/src/share/vm/opto/matcher.cpp 2013-03-29 19:14:30.706440958 +0100 +++ new/src/share/vm/opto/matcher.cpp 2013-03-29 19:14:30.528360689 +0100 @@ -1282,16 +1282,6 @@ mcall->_argsize = out_arg_limit_per_call - begin_out_arg_area; } - if (is_method_handle_invoke) { - // Kill some extra stack space in case method handles want to do - // a little in-place argument insertion. - // FIXME: Is this still necessary? - int regs_per_word = NOT_LP64(1) LP64_ONLY(2); // %%% make a global const! - out_arg_limit_per_call += Method::extra_stack_entries() * regs_per_word; - // Do not update mcall->_argsize because (a) the extra space is not - // pushed as arguments and (b) _argsize is dead (not used anywhere). - } - // Compute the max stack slot killed by any call. These will not be // available for debug info, and will be used to adjust FIRST_STACK_mask // after all call sites have been visited.