comparison src/share/vm/c1/c1_LIRGenerator.cpp @ 2007:5ddfcf4b079e

7003554: (tiered) assert(is_null_object() || handle() != NULL) failed: cannot embed null pointer Summary: C1 with profiling doesn't check whether the MDO has been really allocated, which can silently fail if the perm gen is full. The solution is to check if the allocation failed and bailout out of inlining or compilation. Reviewed-by: kvn, never
author iveresov
date Thu, 02 Dec 2010 17:21:12 -0800
parents ac637b7220d1
children 06f017f7daa7 037c727f35fb df307487d610
comparison
equal deleted inserted replaced
2006:bbefa3ca1543 2007:5ddfcf4b079e
834 834
835 void LIRGenerator::profile_branch(If* if_instr, If::Condition cond) { 835 void LIRGenerator::profile_branch(If* if_instr, If::Condition cond) {
836 if (if_instr->should_profile()) { 836 if (if_instr->should_profile()) {
837 ciMethod* method = if_instr->profiled_method(); 837 ciMethod* method = if_instr->profiled_method();
838 assert(method != NULL, "method should be set if branch is profiled"); 838 assert(method != NULL, "method should be set if branch is profiled");
839 ciMethodData* md = method->method_data(); 839 ciMethodData* md = method->method_data_or_null();
840 if (md == NULL) { 840 assert(md != NULL, "Sanity");
841 bailout("out of memory building methodDataOop");
842 return;
843 }
844 ciProfileData* data = md->bci_to_data(if_instr->profiled_bci()); 841 ciProfileData* data = md->bci_to_data(if_instr->profiled_bci());
845 assert(data != NULL, "must have profiling data"); 842 assert(data != NULL, "must have profiling data");
846 assert(data->is_BranchData(), "need BranchData for two-way branches"); 843 assert(data->is_BranchData(), "need BranchData for two-way branches");
847 int taken_count_offset = md->byte_offset_of_slot(data, BranchData::taken_offset()); 844 int taken_count_offset = md->byte_offset_of_slot(data, BranchData::taken_offset());
848 int not_taken_count_offset = md->byte_offset_of_slot(data, BranchData::not_taken_offset()); 845 int not_taken_count_offset = md->byte_offset_of_slot(data, BranchData::not_taken_offset());
2217 2214
2218 // Gotos can be folded Ifs, handle this case. 2215 // Gotos can be folded Ifs, handle this case.
2219 if (x->should_profile()) { 2216 if (x->should_profile()) {
2220 ciMethod* method = x->profiled_method(); 2217 ciMethod* method = x->profiled_method();
2221 assert(method != NULL, "method should be set if branch is profiled"); 2218 assert(method != NULL, "method should be set if branch is profiled");
2222 ciMethodData* md = method->method_data(); 2219 ciMethodData* md = method->method_data_or_null();
2223 if (md == NULL) { 2220 assert(md != NULL, "Sanity");
2224 bailout("out of memory building methodDataOop");
2225 return;
2226 }
2227 ciProfileData* data = md->bci_to_data(x->profiled_bci()); 2221 ciProfileData* data = md->bci_to_data(x->profiled_bci());
2228 assert(data != NULL, "must have profiling data"); 2222 assert(data != NULL, "must have profiling data");
2229 int offset; 2223 int offset;
2230 if (x->direction() == Goto::taken) { 2224 if (x->direction() == Goto::taken) {
2231 assert(data->is_BranchData(), "need BranchData for two-way branches"); 2225 assert(data->is_BranchData(), "need BranchData for two-way branches");
2721 __ oop2reg(method->constant_encoding(), counter_holder); 2715 __ oop2reg(method->constant_encoding(), counter_holder);
2722 meth = counter_holder; 2716 meth = counter_holder;
2723 } else if (level == CompLevel_full_profile) { 2717 } else if (level == CompLevel_full_profile) {
2724 offset = in_bytes(backedge ? methodDataOopDesc::backedge_counter_offset() : 2718 offset = in_bytes(backedge ? methodDataOopDesc::backedge_counter_offset() :
2725 methodDataOopDesc::invocation_counter_offset()); 2719 methodDataOopDesc::invocation_counter_offset());
2726 __ oop2reg(method->method_data()->constant_encoding(), counter_holder); 2720 ciMethodData* md = method->method_data_or_null();
2721 assert(md != NULL, "Sanity");
2722 __ oop2reg(md->constant_encoding(), counter_holder);
2727 meth = new_register(T_OBJECT); 2723 meth = new_register(T_OBJECT);
2728 __ oop2reg(method->constant_encoding(), meth); 2724 __ oop2reg(method->constant_encoding(), meth);
2729 } else { 2725 } else {
2730 ShouldNotReachHere(); 2726 ShouldNotReachHere();
2731 } 2727 }