comparison src/share/vm/opto/graphKit.cpp @ 1252:f516d5d7a019

6910605: C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used Summary: Set the reexecute bit for runtime calls _new_array_Java when they used for _multianewarray bytecode. Reviewed-by: never
author kvn
date Mon, 08 Feb 2010 12:20:09 -0800
parents 7b0e9cba0307
children 7b4415a18c8a
comparison
equal deleted inserted replaced
1251:576e77447e3c 1252:f516d5d7a019
1 /* 1 /*
2 * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
750 750
751 #endif //ASSERT 751 #endif //ASSERT
752 752
753 // Helper function for enforcing certain bytecodes to reexecute if 753 // Helper function for enforcing certain bytecodes to reexecute if
754 // deoptimization happens 754 // deoptimization happens
755 static bool should_reexecute_implied_by_bytecode(JVMState *jvms) { 755 static bool should_reexecute_implied_by_bytecode(JVMState *jvms, bool is_anewarray) {
756 ciMethod* cur_method = jvms->method(); 756 ciMethod* cur_method = jvms->method();
757 int cur_bci = jvms->bci(); 757 int cur_bci = jvms->bci();
758 if (cur_method != NULL && cur_bci != InvocationEntryBci) { 758 if (cur_method != NULL && cur_bci != InvocationEntryBci) {
759 Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci); 759 Bytecodes::Code code = cur_method->java_code_at_bci(cur_bci);
760 return Interpreter::bytecode_should_reexecute(code); 760 return Interpreter::bytecode_should_reexecute(code) ||
761 is_anewarray && code == Bytecodes::_multianewarray;
762 // Reexecute _multianewarray bytecode which was replaced with
763 // sequence of [a]newarray. See Parse::do_multianewarray().
764 //
765 // Note: interpreter should not have it set since this optimization
766 // is limited by dimensions and guarded by flag so in some cases
767 // multianewarray() runtime calls will be generated and
768 // the bytecode should not be reexecutes (stack will not be reset).
761 } else 769 } else
762 return false; 770 return false;
763 } 771 }
764 772
765 // Helper function for adding JVMState and debug information to node 773 // Helper function for adding JVMState and debug information to node
806 call->set_jvms(out_jvms); // Start jvms list for call node 814 call->set_jvms(out_jvms); // Start jvms list for call node
807 815
808 // For a known set of bytecodes, the interpreter should reexecute them if 816 // For a known set of bytecodes, the interpreter should reexecute them if
809 // deoptimization happens. We set the reexecute state for them here 817 // deoptimization happens. We set the reexecute state for them here
810 if (out_jvms->is_reexecute_undefined() && //don't change if already specified 818 if (out_jvms->is_reexecute_undefined() && //don't change if already specified
811 should_reexecute_implied_by_bytecode(out_jvms)) { 819 should_reexecute_implied_by_bytecode(out_jvms, call->is_AllocateArray())) {
812 out_jvms->set_should_reexecute(true); //NOTE: youngest_jvms not changed 820 out_jvms->set_should_reexecute(true); //NOTE: youngest_jvms not changed
813 } 821 }
814 822
815 // Presize the call: 823 // Presize the call:
816 debug_only(uint non_debug_edges = call->req()); 824 debug_only(uint non_debug_edges = call->req());