8252049: Native memory leak in ciMethodData ctor

Reviewed-by: kbarrett, coleenp
This commit is contained in:
Vladimir Ivanov 2020-12-08 17:02:09 +00:00
parent fab6158c19
commit 044616bd71
8 changed files with 132 additions and 110 deletions

View file

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "ci/ciMethodData.hpp"
#include "classfile/systemDictionary.hpp"
#include "compiler/compilationPolicy.hpp"
#include "compiler/compilerOracle.hpp"
@ -656,7 +657,7 @@ MethodData* MethodData::allocate(ClassLoaderData* loader_data, const methodHandl
int size = MethodData::compute_allocation_size_in_words(method);
return new (loader_data, size, MetaspaceObj::MethodDataType, THREAD)
MethodData(method, size, THREAD);
MethodData(method);
}
int MethodData::bytecode_cell_count(Bytecodes::Code code) {
@ -1202,11 +1203,11 @@ void MethodData::post_initialize(BytecodeStream* stream) {
}
// Initialize the MethodData* corresponding to a given method.
MethodData::MethodData(const methodHandle& method, int size, TRAPS)
: _extra_data_lock(Mutex::leaf, "MDO extra data lock"),
MethodData::MethodData(const methodHandle& method)
: _method(method()),
_extra_data_lock(Mutex::leaf, "MDO extra data lock"),
_compiler_counters(method()),
_parameters_type_data_di(parameters_uninitialized) {
// Set the method back-pointer.
_method = method();
initialize();
}
@ -1216,7 +1217,6 @@ void MethodData::initialize() {
ResourceMark rm(thread);
init();
set_creation_mileage(mileage_of(method()));
// Go through the bytecodes and allocate and initialize the
// corresponding data cells.
@ -1318,14 +1318,8 @@ void MethodData::init() {
}
#endif
// Initialize flags and trap history.
_nof_decompiles = 0;
_nof_overflow_recompiles = 0;
_nof_overflow_traps = 0;
// Initialize escape flags.
clear_escape_info();
assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align");
Copy::zero_to_words((HeapWord*) &_trap_hist,
sizeof(_trap_hist) / sizeof(HeapWord));
}
// Get a measure of how much mileage the method has on it.