mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8194984: 9 Null pointer dereference defect groups related to ciMethodData::bci_to_data()
Reviewed-by: kvn
This commit is contained in:
parent
00b3f917ac
commit
b1723061be
9 changed files with 22 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
|
@ -2532,7 +2532,7 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
|
||||||
ciMethodData* md = method->method_data_or_null();
|
ciMethodData* md = method->method_data_or_null();
|
||||||
assert(md != NULL, "Sanity");
|
assert(md != NULL, "Sanity");
|
||||||
ciProfileData* data = md->bci_to_data(bci);
|
ciProfileData* data = md->bci_to_data(bci);
|
||||||
assert(data->is_CounterData(), "need CounterData for calls");
|
assert(data != NULL && data->is_CounterData(), "need CounterData for calls");
|
||||||
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
||||||
Register mdo = op->mdo()->as_register();
|
Register mdo = op->mdo()->as_register();
|
||||||
__ mov_metadata(mdo, md->constant_encoding());
|
__ mov_metadata(mdo, md->constant_encoding());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -3150,7 +3150,7 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
|
||||||
ciMethodData* md = method->method_data_or_null();
|
ciMethodData* md = method->method_data_or_null();
|
||||||
assert(md != NULL, "Sanity");
|
assert(md != NULL, "Sanity");
|
||||||
ciProfileData* data = md->bci_to_data(bci);
|
ciProfileData* data = md->bci_to_data(bci);
|
||||||
assert(data->is_CounterData(), "need CounterData for calls");
|
assert(data != NULL && data->is_CounterData(), "need CounterData for calls");
|
||||||
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
||||||
Register mdo = op->mdo()->as_register();
|
Register mdo = op->mdo()->as_register();
|
||||||
assert(op->tmp1()->is_register(), "tmp1 must be allocated");
|
assert(op->tmp1()->is_register(), "tmp1 must be allocated");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2017, SAP SE. All rights reserved.
|
* Copyright (c) 2012, 2017, SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
|
@ -2746,7 +2746,7 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
|
||||||
ciMethodData* md = method->method_data_or_null();
|
ciMethodData* md = method->method_data_or_null();
|
||||||
assert(md != NULL, "Sanity");
|
assert(md != NULL, "Sanity");
|
||||||
ciProfileData* data = md->bci_to_data(bci);
|
ciProfileData* data = md->bci_to_data(bci);
|
||||||
assert(data->is_CounterData(), "need CounterData for calls");
|
assert(data != NULL && data->is_CounterData(), "need CounterData for calls");
|
||||||
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
||||||
Register mdo = op->mdo()->as_register();
|
Register mdo = op->mdo()->as_register();
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2016, 2017, SAP SE. All rights reserved.
|
* Copyright (c) 2016, 2017, SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
|
@ -2715,7 +2715,7 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
|
||||||
ciMethodData* md = method->method_data_or_null();
|
ciMethodData* md = method->method_data_or_null();
|
||||||
assert(md != NULL, "Sanity");
|
assert(md != NULL, "Sanity");
|
||||||
ciProfileData* data = md->bci_to_data(bci);
|
ciProfileData* data = md->bci_to_data(bci);
|
||||||
assert(data->is_CounterData(), "need CounterData for calls");
|
assert(data != NULL && data->is_CounterData(), "need CounterData for calls");
|
||||||
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
||||||
Register mdo = op->mdo()->as_register();
|
Register mdo = op->mdo()->as_register();
|
||||||
assert(op->tmp1()->is_double_cpu(), "tmp1 must be allocated");
|
assert(op->tmp1()->is_double_cpu(), "tmp1 must be allocated");
|
||||||
|
|
|
@ -2761,7 +2761,7 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
|
||||||
ciMethodData* md = method->method_data_or_null();
|
ciMethodData* md = method->method_data_or_null();
|
||||||
assert(md != NULL, "Sanity");
|
assert(md != NULL, "Sanity");
|
||||||
ciProfileData* data = md->bci_to_data(bci);
|
ciProfileData* data = md->bci_to_data(bci);
|
||||||
assert(data->is_CounterData(), "need CounterData for calls");
|
assert(data != NULL && data->is_CounterData(), "need CounterData for calls");
|
||||||
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
||||||
Register mdo = op->mdo()->as_register();
|
Register mdo = op->mdo()->as_register();
|
||||||
assert(op->tmp1()->is_double_cpu(), "tmp1 must be allocated");
|
assert(op->tmp1()->is_double_cpu(), "tmp1 must be allocated");
|
||||||
|
|
|
@ -3504,7 +3504,7 @@ void LIR_Assembler::emit_profile_call(LIR_OpProfileCall* op) {
|
||||||
ciMethodData* md = method->method_data_or_null();
|
ciMethodData* md = method->method_data_or_null();
|
||||||
assert(md != NULL, "Sanity");
|
assert(md != NULL, "Sanity");
|
||||||
ciProfileData* data = md->bci_to_data(bci);
|
ciProfileData* data = md->bci_to_data(bci);
|
||||||
assert(data->is_CounterData(), "need CounterData for calls");
|
assert(data != NULL && data->is_CounterData(), "need CounterData for calls");
|
||||||
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
assert(op->mdo()->is_single_cpu(), "mdo must be allocated");
|
||||||
Register mdo = op->mdo()->as_register();
|
Register mdo = op->mdo()->as_register();
|
||||||
__ mov_metadata(mdo, md->constant_encoding());
|
__ mov_metadata(mdo, md->constant_encoding());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -1556,8 +1556,6 @@ void GraphBuilder::method_return(Value x, bool ignore_return) {
|
||||||
}
|
}
|
||||||
if (profile_return() && x->type()->is_object_kind()) {
|
if (profile_return() && x->type()->is_object_kind()) {
|
||||||
ciMethod* caller = state()->scope()->method();
|
ciMethod* caller = state()->scope()->method();
|
||||||
ciMethodData* md = caller->method_data_or_null();
|
|
||||||
ciProfileData* data = md->bci_to_data(invoke_bci);
|
|
||||||
profile_return_type(x, method(), caller, invoke_bci);
|
profile_return_type(x, method(), caller, invoke_bci);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -2264,7 +2264,7 @@ void Parse::do_one_bytecode() {
|
||||||
ciMethodData* methodData = method()->method_data();
|
ciMethodData* methodData = method()->method_data();
|
||||||
if (!methodData->is_mature()) break;
|
if (!methodData->is_mature()) break;
|
||||||
ciProfileData* data = methodData->bci_to_data(bci());
|
ciProfileData* data = methodData->bci_to_data(bci());
|
||||||
assert( data->is_JumpData(), "" );
|
assert(data != NULL && data->is_JumpData(), "need JumpData for taken branch");
|
||||||
int taken = ((ciJumpData*)data)->taken();
|
int taken = ((ciJumpData*)data)->taken();
|
||||||
taken = method()->scale_count(taken);
|
taken = method()->scale_count(taken);
|
||||||
target_block->set_count(taken);
|
target_block->set_count(taken);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -459,7 +459,7 @@ void Parse::profile_taken_branch(int target_bci, bool force_update) {
|
||||||
ciMethodData* md = method()->method_data();
|
ciMethodData* md = method()->method_data();
|
||||||
assert(md != NULL, "expected valid ciMethodData");
|
assert(md != NULL, "expected valid ciMethodData");
|
||||||
ciProfileData* data = md->bci_to_data(cur_bci);
|
ciProfileData* data = md->bci_to_data(cur_bci);
|
||||||
assert(data->is_JumpData(), "need JumpData for taken branch");
|
assert(data != NULL && data->is_JumpData(), "need JumpData for taken branch");
|
||||||
increment_md_counter_at(md, data, JumpData::taken_offset());
|
increment_md_counter_at(md, data, JumpData::taken_offset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,6 +470,7 @@ void Parse::profile_taken_branch(int target_bci, bool force_update) {
|
||||||
ciMethodData* md = method()->method_data();
|
ciMethodData* md = method()->method_data();
|
||||||
if (osr_site) {
|
if (osr_site) {
|
||||||
ciProfileData* data = md->bci_to_data(cur_bci);
|
ciProfileData* data = md->bci_to_data(cur_bci);
|
||||||
|
assert(data != NULL && data->is_JumpData(), "need JumpData for taken branch");
|
||||||
int limit = (CompileThreshold
|
int limit = (CompileThreshold
|
||||||
* (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100;
|
* (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100;
|
||||||
test_for_osr_md_counter_at(md, data, JumpData::taken_offset(), limit);
|
test_for_osr_md_counter_at(md, data, JumpData::taken_offset(), limit);
|
||||||
|
@ -495,7 +496,7 @@ void Parse::profile_not_taken_branch(bool force_update) {
|
||||||
ciMethodData* md = method()->method_data();
|
ciMethodData* md = method()->method_data();
|
||||||
assert(md != NULL, "expected valid ciMethodData");
|
assert(md != NULL, "expected valid ciMethodData");
|
||||||
ciProfileData* data = md->bci_to_data(bci());
|
ciProfileData* data = md->bci_to_data(bci());
|
||||||
assert(data->is_BranchData(), "need BranchData for not taken branch");
|
assert(data != NULL && data->is_BranchData(), "need BranchData for not taken branch");
|
||||||
increment_md_counter_at(md, data, BranchData::not_taken_offset());
|
increment_md_counter_at(md, data, BranchData::not_taken_offset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +527,7 @@ void Parse::profile_generic_call() {
|
||||||
ciMethodData* md = method()->method_data();
|
ciMethodData* md = method()->method_data();
|
||||||
assert(md != NULL, "expected valid ciMethodData");
|
assert(md != NULL, "expected valid ciMethodData");
|
||||||
ciProfileData* data = md->bci_to_data(bci());
|
ciProfileData* data = md->bci_to_data(bci());
|
||||||
assert(data->is_CounterData(), "need CounterData for not taken branch");
|
assert(data != NULL && data->is_CounterData(), "need CounterData for not taken branch");
|
||||||
increment_md_counter_at(md, data, CounterData::count_offset());
|
increment_md_counter_at(md, data, CounterData::count_offset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +538,7 @@ void Parse::profile_receiver_type(Node* receiver) {
|
||||||
ciMethodData* md = method()->method_data();
|
ciMethodData* md = method()->method_data();
|
||||||
assert(md != NULL, "expected valid ciMethodData");
|
assert(md != NULL, "expected valid ciMethodData");
|
||||||
ciProfileData* data = md->bci_to_data(bci());
|
ciProfileData* data = md->bci_to_data(bci());
|
||||||
assert(data->is_ReceiverTypeData(), "need ReceiverTypeData here");
|
assert(data != NULL && data->is_ReceiverTypeData(), "need ReceiverTypeData here");
|
||||||
|
|
||||||
// Skip if we aren't tracking receivers
|
// Skip if we aren't tracking receivers
|
||||||
if (TypeProfileWidth < 1) {
|
if (TypeProfileWidth < 1) {
|
||||||
|
@ -568,7 +569,7 @@ void Parse::profile_ret(int target_bci) {
|
||||||
ciMethodData* md = method()->method_data();
|
ciMethodData* md = method()->method_data();
|
||||||
assert(md != NULL, "expected valid ciMethodData");
|
assert(md != NULL, "expected valid ciMethodData");
|
||||||
ciProfileData* data = md->bci_to_data(bci());
|
ciProfileData* data = md->bci_to_data(bci());
|
||||||
assert(data->is_RetData(), "need RetData for ret");
|
assert(data != NULL && data->is_RetData(), "need RetData for ret");
|
||||||
ciRetData* ret_data = (ciRetData*)data->as_RetData();
|
ciRetData* ret_data = (ciRetData*)data->as_RetData();
|
||||||
|
|
||||||
// Look for the target_bci is already in the table
|
// Look for the target_bci is already in the table
|
||||||
|
@ -601,7 +602,7 @@ void Parse::profile_null_checkcast() {
|
||||||
ciMethodData* md = method()->method_data();
|
ciMethodData* md = method()->method_data();
|
||||||
assert(md != NULL, "expected valid ciMethodData");
|
assert(md != NULL, "expected valid ciMethodData");
|
||||||
ciProfileData* data = md->bci_to_data(bci());
|
ciProfileData* data = md->bci_to_data(bci());
|
||||||
assert(data->is_BitData(), "need BitData for checkcast");
|
assert(data != NULL && data->is_BitData(), "need BitData for checkcast");
|
||||||
set_md_flag_at(md, data, BitData::null_seen_byte_constant());
|
set_md_flag_at(md, data, BitData::null_seen_byte_constant());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,7 +614,7 @@ void Parse::profile_switch_case(int table_index) {
|
||||||
assert(md != NULL, "expected valid ciMethodData");
|
assert(md != NULL, "expected valid ciMethodData");
|
||||||
|
|
||||||
ciProfileData* data = md->bci_to_data(bci());
|
ciProfileData* data = md->bci_to_data(bci());
|
||||||
assert(data->is_MultiBranchData(), "need MultiBranchData for switch case");
|
assert(data != NULL && data->is_MultiBranchData(), "need MultiBranchData for switch case");
|
||||||
if (table_index >= 0) {
|
if (table_index >= 0) {
|
||||||
increment_md_counter_at(md, data, MultiBranchData::case_count_offset(table_index));
|
increment_md_counter_at(md, data, MultiBranchData::case_count_offset(table_index));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue