1.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp Mon Aug 20 09:58:58 2012 -0700 1.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp Tue Aug 21 10:48:50 2012 -0700 1.3 @@ -1646,10 +1646,6 @@ 1.4 1.5 1.6 void GraphBuilder::invoke(Bytecodes::Code code) { 1.7 - const bool has_receiver = 1.8 - code == Bytecodes::_invokespecial || 1.9 - code == Bytecodes::_invokevirtual || 1.10 - code == Bytecodes::_invokeinterface; 1.11 const bool is_invokedynamic = (code == Bytecodes::_invokedynamic); 1.12 1.13 bool will_link; 1.14 @@ -1690,8 +1686,12 @@ 1.15 // convert them directly to an invokespecial or invokestatic. 1.16 if (target->is_loaded() && !target->is_abstract() && target->can_be_statically_bound()) { 1.17 switch (bc_raw) { 1.18 - case Bytecodes::_invokevirtual: code = Bytecodes::_invokespecial; break; 1.19 - case Bytecodes::_invokehandle: code = Bytecodes::_invokestatic; break; 1.20 + case Bytecodes::_invokevirtual: 1.21 + code = Bytecodes::_invokespecial; 1.22 + break; 1.23 + case Bytecodes::_invokehandle: 1.24 + code = target->is_static() ? Bytecodes::_invokestatic : Bytecodes::_invokespecial; 1.25 + break; 1.26 } 1.27 } 1.28 1.29 @@ -1878,11 +1878,13 @@ 1.30 // inlining not successful => standard invoke 1.31 bool is_loaded = target->is_loaded(); 1.32 ValueType* result_type = as_ValueType(target->return_type()); 1.33 - 1.34 - // We require the debug info to be the "state before" because 1.35 - // invokedynamics may deoptimize. 1.36 - ValueStack* state_before = is_invokedynamic ? copy_state_before() : copy_state_exhandling(); 1.37 - 1.38 + ValueStack* state_before = copy_state_exhandling(); 1.39 + 1.40 + // The bytecode (code) might change in this method so we are checking this very late. 1.41 + const bool has_receiver = 1.42 + code == Bytecodes::_invokespecial || 1.43 + code == Bytecodes::_invokevirtual || 1.44 + code == Bytecodes::_invokeinterface; 1.45 Values* args = state()->pop_arguments(target->arg_size_no_receiver()); 1.46 Value recv = has_receiver ? apop() : NULL; 1.47 int vtable_index = methodOopDesc::invalid_vtable_index;