1.1 --- a/src/share/vm/c1/c1_IR.cpp Mon Jun 09 15:42:31 2014 -0700 1.2 +++ b/src/share/vm/c1/c1_IR.cpp Tue Apr 01 09:36:49 2014 +0200 1.3 @@ -226,8 +226,38 @@ 1.4 _oop_map->set_oop(name); 1.5 } 1.6 1.7 +// Mirror the stack size calculation in the deopt code 1.8 +// How much stack space would we need at this point in the program in 1.9 +// case of deoptimization? 1.10 +int CodeEmitInfo::interpreter_frame_size() const { 1.11 + ValueStack* state = _stack; 1.12 + int size = 0; 1.13 + int callee_parameters = 0; 1.14 + int callee_locals = 0; 1.15 + int extra_args = state->scope()->method()->max_stack() - state->stack_size(); 1.16 1.17 + while (state != NULL) { 1.18 + int locks = state->locks_size(); 1.19 + int temps = state->stack_size(); 1.20 + bool is_top_frame = (state == _stack); 1.21 + ciMethod* method = state->scope()->method(); 1.22 1.23 + int frame_size = BytesPerWord * Interpreter::size_activation(method->max_stack(), 1.24 + temps + callee_parameters, 1.25 + extra_args, 1.26 + locks, 1.27 + callee_parameters, 1.28 + callee_locals, 1.29 + is_top_frame); 1.30 + size += frame_size; 1.31 + 1.32 + callee_parameters = method->size_of_parameters(); 1.33 + callee_locals = method->max_locals(); 1.34 + extra_args = 0; 1.35 + state = state->caller_state(); 1.36 + } 1.37 + return size + Deoptimization::last_frame_adjust(0, callee_locals) * BytesPerWord; 1.38 +} 1.39 1.40 // Implementation of IR 1.41