778 |
778 |
779 #endif //ASSERT |
779 #endif //ASSERT |
780 |
780 |
781 // Helper function for enforcing certain bytecodes to reexecute if |
781 // Helper function for enforcing certain bytecodes to reexecute if |
782 // deoptimization happens |
782 // deoptimization happens |
783 static bool should_reexecute_implied_by_bytecode(JVMState *jvms) { |
783 static bool should_reexecute_implied_by_bytecode(JVMState *jvms, bool is_anewarray) { |
784 ciMethod* cur_method = jvms->method(); |
784 ciMethod* cur_method = jvms->method(); |
785 int cur_bci = jvms->bci(); |
785 int cur_bci = jvms->bci(); |
786 if (cur_method != NULL && cur_bci != InvocationEntryBci) { |
786 if (cur_method != NULL && cur_bci != InvocationEntryBci) { |
787 Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci); |
787 Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci); |
788 return Interpreter::bytecode_should_reexecute(code); |
788 return Interpreter::bytecode_should_reexecute(code) || |
|
789 is_anewarray && code == Bytecodes::_multianewarray; |
|
790 // Reexecute _multianewarray bytecode which was replaced with |
|
791 // sequence of [a]newarray. See Parse::do_multianewarray(). |
|
792 // |
|
793 // Note: interpreter should not have it set since this optimization |
|
794 // is limited by dimensions and guarded by flag so in some cases |
|
795 // multianewarray() runtime calls will be generated and |
|
796 // the bytecode should not be reexecutes (stack will not be reset). |
789 } else |
797 } else |
790 return false; |
798 return false; |
791 } |
799 } |
792 |
800 |
793 // Helper function for adding JVMState and debug information to node |
801 // Helper function for adding JVMState and debug information to node |
834 call->set_jvms(out_jvms); // Start jvms list for call node |
842 call->set_jvms(out_jvms); // Start jvms list for call node |
835 |
843 |
836 // For a known set of bytecodes, the interpreter should reexecute them if |
844 // For a known set of bytecodes, the interpreter should reexecute them if |
837 // deoptimization happens. We set the reexecute state for them here |
845 // deoptimization happens. We set the reexecute state for them here |
838 if (out_jvms->is_reexecute_undefined() && //don't change if already specified |
846 if (out_jvms->is_reexecute_undefined() && //don't change if already specified |
839 should_reexecute_implied_by_bytecode(out_jvms)) { |
847 should_reexecute_implied_by_bytecode(out_jvms, call->is_AllocateArray())) { |
840 out_jvms->set_should_reexecute(true); //NOTE: youngest_jvms not changed |
848 out_jvms->set_should_reexecute(true); //NOTE: youngest_jvms not changed |
841 } |
849 } |
842 |
850 |
843 // Presize the call: |
851 // Presize the call: |
844 debug_only(uint non_debug_edges = call->req()); |
852 debug_only(uint non_debug_edges = call->req()); |