mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-06 08:28:27 +00:00
8300243: Replace NULL with nullptr in share/compiler/
Reviewed-by: thartmann, kvn
This commit is contained in:
parent
c205caead5
commit
fcbf9d052e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -311,11 +311,11 @@ void AbstractDisassembler::decode_range_abstract(address range_start, address ra
|
||||
address start, address end,
|
||||
outputStream* st,
|
||||
const int max_instr_size_in_bytes) {
|
||||
assert(st != NULL, "need an output stream (no default)!");
|
||||
assert(st != nullptr, "need an output stream (no default)!");
|
||||
int idx = 0;
|
||||
address pos = range_start;
|
||||
|
||||
while ((pos != NULL) && (pos < range_end)) {
|
||||
while ((pos != nullptr) && (pos < range_end)) {
|
||||
int instr_size_in_bytes = Assembler::instr_len(pos);
|
||||
|
||||
if (idx == 0) print_location(pos, start, end, st, false, false);
|
||||
@ -349,7 +349,7 @@ void AbstractDisassembler::decode_abstract(address start, address end, outputStr
|
||||
int idx = 0;
|
||||
address pos = start;
|
||||
|
||||
outputStream* st = (ost == NULL) ? tty : ost;
|
||||
outputStream* st = (ost == nullptr) ? tty : ost;
|
||||
|
||||
//---< Open the output (Marker for post-mortem disassembler) >---
|
||||
st->bol();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,7 +40,7 @@ void CompilationLog::log_compile(JavaThread* thread, CompileTask* task) {
|
||||
StringLogMessage lm;
|
||||
stringStream sstr(lm.buffer(), lm.size());
|
||||
// msg.time_stamp().update_to(tty->time_stamp().ticks());
|
||||
task->print(&sstr, NULL, true, false);
|
||||
task->print(&sstr, nullptr, true, false);
|
||||
log(thread, "%s", (const char*)lm);
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ void CompilationLog::log_nmethod(JavaThread* thread, nmethod* nm) {
|
||||
void CompilationLog::log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) {
|
||||
StringLogMessage lm;
|
||||
lm.print("%4d COMPILE SKIPPED: %s", task->compile_id(), reason);
|
||||
if (retry_message != NULL) {
|
||||
if (retry_message != nullptr) {
|
||||
lm.append(" (%s)", retry_message);
|
||||
}
|
||||
lm.print("\n");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -161,7 +161,7 @@ bool CompilationPolicy::is_compilation_enabled() {
|
||||
|
||||
CompileTask* CompilationPolicy::select_task_helper(CompileQueue* compile_queue) {
|
||||
// Remove unloaded methods from the queue
|
||||
for (CompileTask* task = compile_queue->first(); task != NULL; ) {
|
||||
for (CompileTask* task = compile_queue->first(); task != nullptr; ) {
|
||||
CompileTask* next = task->next();
|
||||
if (task->is_unloaded()) {
|
||||
compile_queue->remove_and_mark_stale(task);
|
||||
@ -177,7 +177,7 @@ CompileTask* CompilationPolicy::select_task_helper(CompileQueue* compile_queue)
|
||||
* to service non-compiler related compilations sooner and reduce the
|
||||
* chance of such compilations timing out.
|
||||
*/
|
||||
for (CompileTask* task = compile_queue->first(); task != NULL; task = task->next()) {
|
||||
for (CompileTask* task = compile_queue->first(); task != nullptr; task = task->next()) {
|
||||
if (task->is_blocking()) {
|
||||
return task;
|
||||
}
|
||||
@ -202,7 +202,7 @@ bool CompilationPolicy::force_comp_at_level_simple(const methodHandle& method) {
|
||||
#if INCLUDE_JVMCI
|
||||
if (UseJVMCICompiler) {
|
||||
AbstractCompiler* comp = CompileBroker::compiler(CompLevel_full_optimization);
|
||||
if (comp != NULL && comp->is_jvmci() && ((JVMCICompiler*) comp)->force_comp_at_level_simple(method)) {
|
||||
if (comp != nullptr && comp->is_jvmci() && ((JVMCICompiler*) comp)->force_comp_at_level_simple(method)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ bool CompilationPolicy::force_comp_at_level_simple(const methodHandle& method) {
|
||||
|
||||
CompLevel CompilationPolicy::comp_level(Method* method) {
|
||||
CompiledMethod *nm = method->code();
|
||||
if (nm != NULL && nm->is_in_use()) {
|
||||
if (nm != nullptr && nm->is_in_use()) {
|
||||
return (CompLevel)nm->comp_level();
|
||||
}
|
||||
return CompLevel_none;
|
||||
@ -329,7 +329,7 @@ void CompilationPolicy::print_counters(const char* prefix, const Method* m) {
|
||||
MethodData* mdh = m->method_data();
|
||||
int mdo_invocations = 0, mdo_backedges = 0;
|
||||
int mdo_invocations_start = 0, mdo_backedges_start = 0;
|
||||
if (mdh != NULL) {
|
||||
if (mdh != nullptr) {
|
||||
mdo_invocations = mdh->invocation_count();
|
||||
mdo_backedges = mdh->backedge_count();
|
||||
mdo_invocations_start = mdh->invocation_count_start();
|
||||
@ -606,12 +606,12 @@ CompLevel CompilationPolicy::initial_compile_level(const methodHandle& method) {
|
||||
// Set carry flags on the counters if necessary
|
||||
void CompilationPolicy::handle_counter_overflow(const methodHandle& method) {
|
||||
MethodCounters *mcs = method->method_counters();
|
||||
if (mcs != NULL) {
|
||||
if (mcs != nullptr) {
|
||||
mcs->invocation_counter()->set_carry_on_overflow();
|
||||
mcs->backedge_counter()->set_carry_on_overflow();
|
||||
}
|
||||
MethodData* mdo = method->method_data();
|
||||
if (mdo != NULL) {
|
||||
if (mdo != nullptr) {
|
||||
mdo->invocation_counter()->set_carry_on_overflow();
|
||||
mdo->backedge_counter()->set_carry_on_overflow();
|
||||
}
|
||||
@ -619,13 +619,13 @@ void CompilationPolicy::handle_counter_overflow(const methodHandle& method) {
|
||||
|
||||
// Called with the queue locked and with at least one element
|
||||
CompileTask* CompilationPolicy::select_task(CompileQueue* compile_queue) {
|
||||
CompileTask *max_blocking_task = NULL;
|
||||
CompileTask *max_task = NULL;
|
||||
Method* max_method = NULL;
|
||||
CompileTask *max_blocking_task = nullptr;
|
||||
CompileTask *max_task = nullptr;
|
||||
Method* max_method = nullptr;
|
||||
|
||||
jlong t = nanos_to_millis(os::javaTimeNanos());
|
||||
// Iterate through the queue and find a method with a maximum rate.
|
||||
for (CompileTask* task = compile_queue->first(); task != NULL;) {
|
||||
for (CompileTask* task = compile_queue->first(); task != nullptr;) {
|
||||
CompileTask* next_task = task->next();
|
||||
// If a method was unloaded or has been stale for some time, remove it from the queue.
|
||||
// Blocking tasks and tasks submitted from whitebox API don't become stale
|
||||
@ -646,14 +646,14 @@ CompileTask* CompilationPolicy::select_task(CompileQueue* compile_queue) {
|
||||
continue;
|
||||
}
|
||||
update_rate(t, mh);
|
||||
if (max_task == NULL || compare_methods(method, max_method)) {
|
||||
if (max_task == nullptr || compare_methods(method, max_method)) {
|
||||
// Select a method with the highest rate
|
||||
max_task = task;
|
||||
max_method = method;
|
||||
}
|
||||
|
||||
if (task->is_blocking()) {
|
||||
if (max_blocking_task == NULL || compare_methods(method, max_blocking_task->method())) {
|
||||
if (max_blocking_task == nullptr || compare_methods(method, max_blocking_task->method())) {
|
||||
max_blocking_task = task;
|
||||
}
|
||||
}
|
||||
@ -661,7 +661,7 @@ CompileTask* CompilationPolicy::select_task(CompileQueue* compile_queue) {
|
||||
task = next_task;
|
||||
}
|
||||
|
||||
if (max_blocking_task != NULL) {
|
||||
if (max_blocking_task != nullptr) {
|
||||
// In blocking compilation mode, the CompileBroker will make
|
||||
// compilations submitted by a JVMCI compiler thread non-blocking. These
|
||||
// compilations should be scheduled after all blocking compilations
|
||||
@ -673,8 +673,8 @@ CompileTask* CompilationPolicy::select_task(CompileQueue* compile_queue) {
|
||||
|
||||
methodHandle max_method_h(Thread::current(), max_method);
|
||||
|
||||
if (max_task != NULL && max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile &&
|
||||
max_method != NULL && is_method_profiled(max_method_h) && !Arguments::is_compiler_only()) {
|
||||
if (max_task != nullptr && max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile &&
|
||||
max_method != nullptr && is_method_profiled(max_method_h) && !Arguments::is_compiler_only()) {
|
||||
max_task->set_comp_level(CompLevel_limited_profile);
|
||||
|
||||
if (CompileBroker::compilation_is_complete(max_method_h, max_task->osr_bci(), CompLevel_limited_profile)) {
|
||||
@ -683,7 +683,7 @@ CompileTask* CompilationPolicy::select_task(CompileQueue* compile_queue) {
|
||||
}
|
||||
compile_queue->remove_and_mark_stale(max_task);
|
||||
max_method->clear_queued_for_compilation();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (PrintTieredEvents) {
|
||||
@ -700,7 +700,7 @@ void CompilationPolicy::reprofile(ScopeDesc* trap_scope, bool is_osr) {
|
||||
print_event(REPROFILE, sd->method(), sd->method(), InvocationEntryBci, CompLevel_none);
|
||||
}
|
||||
MethodData* mdo = sd->method()->method_data();
|
||||
if (mdo != NULL) {
|
||||
if (mdo != nullptr) {
|
||||
mdo->reset_start_counters();
|
||||
}
|
||||
if (sd->is_top()) break;
|
||||
@ -716,11 +716,11 @@ nmethod* CompilationPolicy::event(const methodHandle& method, const methodHandle
|
||||
if (comp_level == CompLevel_none &&
|
||||
JvmtiExport::can_post_interpreter_events() &&
|
||||
THREAD->is_interp_only_mode()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (ReplayCompiles) {
|
||||
// Don't trigger other compiles in testing mode
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
handle_counter_overflow(method);
|
||||
@ -742,14 +742,14 @@ nmethod* CompilationPolicy::event(const methodHandle& method, const methodHandle
|
||||
CompLevel max_osr_level = static_cast<CompLevel>(inlinee->highest_osr_comp_level());
|
||||
if (max_osr_level >= expected_comp_level) { // fast check to avoid locking in a typical scenario
|
||||
nmethod* osr_nm = inlinee->lookup_osr_nmethod_for(bci, expected_comp_level, false);
|
||||
assert(osr_nm == NULL || osr_nm->comp_level() >= expected_comp_level, "lookup_osr_nmethod_for is broken");
|
||||
if (osr_nm != NULL && osr_nm->comp_level() != comp_level) {
|
||||
assert(osr_nm == nullptr || osr_nm->comp_level() >= expected_comp_level, "lookup_osr_nmethod_for is broken");
|
||||
if (osr_nm != nullptr && osr_nm->comp_level() != comp_level) {
|
||||
// Perform OSR with new nmethod
|
||||
return osr_nm;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Check if the method can be compiled, change level if necessary
|
||||
@ -790,7 +790,7 @@ void CompilationPolicy::compile(const methodHandle& mh, int bci, CompLevel level
|
||||
if ((bci != InvocationEntryBci && !can_be_osr_compiled(mh, level))) {
|
||||
if (level == CompLevel_full_optimization && can_be_osr_compiled(mh, CompLevel_simple)) {
|
||||
nmethod* osr_nm = mh->lookup_osr_nmethod_for(bci, CompLevel_simple, false);
|
||||
if (osr_nm != NULL && osr_nm->comp_level() > CompLevel_simple) {
|
||||
if (osr_nm != nullptr && osr_nm->comp_level() > CompLevel_simple) {
|
||||
// Invalidate the existing OSR nmethod so that a compile at CompLevel_simple is permitted.
|
||||
osr_nm->make_not_entrant();
|
||||
}
|
||||
@ -816,7 +816,7 @@ void CompilationPolicy::compile(const methodHandle& mh, int bci, CompLevel level
|
||||
void CompilationPolicy::update_rate(jlong t, const methodHandle& method) {
|
||||
// Skip update if counters are absent.
|
||||
// Can't allocate them since we are holding compile queue lock.
|
||||
if (method->method_counters() == NULL) return;
|
||||
if (method->method_counters() == nullptr) return;
|
||||
|
||||
if (is_old(method)) {
|
||||
// We don't remove old methods from the queue,
|
||||
@ -894,7 +894,7 @@ bool CompilationPolicy::compare_methods(Method* x, Method* y) {
|
||||
// Is method profiled enough?
|
||||
bool CompilationPolicy::is_method_profiled(const methodHandle& method) {
|
||||
MethodData* mdo = method->method_data();
|
||||
if (mdo != NULL) {
|
||||
if (mdo != nullptr) {
|
||||
int i = mdo->invocation_count_delta();
|
||||
int b = mdo->backedge_count_delta();
|
||||
return CallPredicate::apply_scaled(method, CompLevel_full_profile, i, b, 1);
|
||||
@ -911,7 +911,7 @@ bool CompilationPolicy::is_mature(Method* method) {
|
||||
}
|
||||
methodHandle mh(Thread::current(), method);
|
||||
MethodData* mdo = method->method_data();
|
||||
if (mdo != NULL) {
|
||||
if (mdo != nullptr) {
|
||||
int i = mdo->invocation_count();
|
||||
int b = mdo->backedge_count();
|
||||
double k = ProfileMaturityPercentage / 100.0;
|
||||
@ -960,12 +960,12 @@ void CompilationPolicy::create_mdo(const methodHandle& mh, JavaThread* THREAD) {
|
||||
mh->is_constant_getter()) {
|
||||
return;
|
||||
}
|
||||
if (mh->method_data() == NULL) {
|
||||
if (mh->method_data() == nullptr) {
|
||||
Method::build_profiling_method_data(mh, CHECK_AND_CLEAR);
|
||||
}
|
||||
if (ProfileInterpreter) {
|
||||
MethodData* mdo = mh->method_data();
|
||||
if (mdo != NULL) {
|
||||
if (mdo != nullptr) {
|
||||
frame last_frame = THREAD->last_frame();
|
||||
if (last_frame.is_interpreted_frame() && mh == last_frame.interpreter_frame_method()) {
|
||||
int bci = last_frame.interpreter_frame_bci();
|
||||
@ -1057,7 +1057,7 @@ CompLevel CompilationPolicy::common(const methodHandle& method, CompLevel cur_le
|
||||
next_level = CompLevel_full_optimization;
|
||||
} else {
|
||||
MethodData* mdo = method->method_data();
|
||||
if (mdo != NULL) {
|
||||
if (mdo != nullptr) {
|
||||
if (mdo->would_profile()) {
|
||||
if (disable_feedback || (CompileBroker::queue_size(CompLevel_full_optimization) <=
|
||||
Tier3DelayOff * compiler_count(CompLevel_full_optimization) &&
|
||||
@ -1080,7 +1080,7 @@ CompLevel CompilationPolicy::common(const methodHandle& method, CompLevel cur_le
|
||||
case CompLevel_full_profile:
|
||||
{
|
||||
MethodData* mdo = method->method_data();
|
||||
if (mdo != NULL) {
|
||||
if (mdo != nullptr) {
|
||||
if (mdo->would_profile() || CompilationModeFlag::disable_intermediate()) {
|
||||
int mdo_i = mdo->invocation_count_delta();
|
||||
int mdo_b = mdo->backedge_count_delta();
|
||||
@ -1111,7 +1111,7 @@ CompLevel CompilationPolicy::call_event(const methodHandle& method, CompLevel cu
|
||||
// invocation of the method.
|
||||
if (osr_level == CompLevel_full_optimization && cur_level == CompLevel_full_profile) {
|
||||
MethodData* mdo = method->method_data();
|
||||
guarantee(mdo != NULL, "MDO should not be NULL");
|
||||
guarantee(mdo != nullptr, "MDO should not be nullptr");
|
||||
if (mdo->invocation_count() >= 1) {
|
||||
next_level = CompLevel_full_optimization;
|
||||
}
|
||||
@ -1174,7 +1174,7 @@ void CompilationPolicy::method_back_branch_event(const methodHandle& mh, const m
|
||||
CompLevel cur_level, next_level;
|
||||
if (mh() != imh()) { // If there is an enclosing method
|
||||
{
|
||||
guarantee(nm != NULL, "Should have nmethod here");
|
||||
guarantee(nm != nullptr, "Should have nmethod here");
|
||||
cur_level = comp_level(mh());
|
||||
next_level = call_event(mh, cur_level, THREAD);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -266,7 +266,7 @@ public:
|
||||
static void reprofile(ScopeDesc* trap_scope, bool is_osr);
|
||||
static nmethod* event(const methodHandle& method, const methodHandle& inlinee,
|
||||
int branch_bci, int bci, CompLevel comp_level, CompiledMethod* nm, TRAPS);
|
||||
// Select task is called by CompileBroker. We should return a task or NULL.
|
||||
// Select task is called by CompileBroker. We should return a task or nullptr.
|
||||
static CompileTask* select_task(CompileQueue* compile_queue);
|
||||
// Tell the runtime if we think a given method is adequately profiled.
|
||||
static bool is_mature(Method* method);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -132,11 +132,11 @@ int CompileBroker::_c1_count = 0;
|
||||
int CompileBroker::_c2_count = 0;
|
||||
|
||||
// An array of compiler names as Java String objects
|
||||
jobject* CompileBroker::_compiler1_objects = NULL;
|
||||
jobject* CompileBroker::_compiler2_objects = NULL;
|
||||
jobject* CompileBroker::_compiler1_objects = nullptr;
|
||||
jobject* CompileBroker::_compiler2_objects = nullptr;
|
||||
|
||||
CompileLog** CompileBroker::_compiler1_logs = NULL;
|
||||
CompileLog** CompileBroker::_compiler2_logs = NULL;
|
||||
CompileLog** CompileBroker::_compiler1_logs = nullptr;
|
||||
CompileLog** CompileBroker::_compiler2_logs = nullptr;
|
||||
|
||||
// These counters are used to assign an unique ID to each compilation.
|
||||
volatile jint CompileBroker::_compilation_id = 0;
|
||||
@ -144,28 +144,28 @@ volatile jint CompileBroker::_osr_compilation_id = 0;
|
||||
volatile jint CompileBroker::_native_compilation_id = 0;
|
||||
|
||||
// Performance counters
|
||||
PerfCounter* CompileBroker::_perf_total_compilation = NULL;
|
||||
PerfCounter* CompileBroker::_perf_osr_compilation = NULL;
|
||||
PerfCounter* CompileBroker::_perf_standard_compilation = NULL;
|
||||
PerfCounter* CompileBroker::_perf_total_compilation = nullptr;
|
||||
PerfCounter* CompileBroker::_perf_osr_compilation = nullptr;
|
||||
PerfCounter* CompileBroker::_perf_standard_compilation = nullptr;
|
||||
|
||||
PerfCounter* CompileBroker::_perf_total_bailout_count = NULL;
|
||||
PerfCounter* CompileBroker::_perf_total_invalidated_count = NULL;
|
||||
PerfCounter* CompileBroker::_perf_total_compile_count = NULL;
|
||||
PerfCounter* CompileBroker::_perf_total_osr_compile_count = NULL;
|
||||
PerfCounter* CompileBroker::_perf_total_standard_compile_count = NULL;
|
||||
PerfCounter* CompileBroker::_perf_total_bailout_count = nullptr;
|
||||
PerfCounter* CompileBroker::_perf_total_invalidated_count = nullptr;
|
||||
PerfCounter* CompileBroker::_perf_total_compile_count = nullptr;
|
||||
PerfCounter* CompileBroker::_perf_total_osr_compile_count = nullptr;
|
||||
PerfCounter* CompileBroker::_perf_total_standard_compile_count = nullptr;
|
||||
|
||||
PerfCounter* CompileBroker::_perf_sum_osr_bytes_compiled = NULL;
|
||||
PerfCounter* CompileBroker::_perf_sum_standard_bytes_compiled = NULL;
|
||||
PerfCounter* CompileBroker::_perf_sum_nmethod_size = NULL;
|
||||
PerfCounter* CompileBroker::_perf_sum_nmethod_code_size = NULL;
|
||||
PerfCounter* CompileBroker::_perf_sum_osr_bytes_compiled = nullptr;
|
||||
PerfCounter* CompileBroker::_perf_sum_standard_bytes_compiled = nullptr;
|
||||
PerfCounter* CompileBroker::_perf_sum_nmethod_size = nullptr;
|
||||
PerfCounter* CompileBroker::_perf_sum_nmethod_code_size = nullptr;
|
||||
|
||||
PerfStringVariable* CompileBroker::_perf_last_method = NULL;
|
||||
PerfStringVariable* CompileBroker::_perf_last_failed_method = NULL;
|
||||
PerfStringVariable* CompileBroker::_perf_last_invalidated_method = NULL;
|
||||
PerfVariable* CompileBroker::_perf_last_compile_type = NULL;
|
||||
PerfVariable* CompileBroker::_perf_last_compile_size = NULL;
|
||||
PerfVariable* CompileBroker::_perf_last_failed_type = NULL;
|
||||
PerfVariable* CompileBroker::_perf_last_invalidated_type = NULL;
|
||||
PerfStringVariable* CompileBroker::_perf_last_method = nullptr;
|
||||
PerfStringVariable* CompileBroker::_perf_last_failed_method = nullptr;
|
||||
PerfStringVariable* CompileBroker::_perf_last_invalidated_method = nullptr;
|
||||
PerfVariable* CompileBroker::_perf_last_compile_type = nullptr;
|
||||
PerfVariable* CompileBroker::_perf_last_compile_size = nullptr;
|
||||
PerfVariable* CompileBroker::_perf_last_failed_type = nullptr;
|
||||
PerfVariable* CompileBroker::_perf_last_invalidated_type = nullptr;
|
||||
|
||||
// Timers and counters for generating statistics
|
||||
elapsedTimer CompileBroker::_t_total_compilation;
|
||||
@ -191,8 +191,8 @@ jlong CompileBroker::_peak_compilation_time = 0;
|
||||
|
||||
CompilerStatistics CompileBroker::_stats_per_level[CompLevel_full_optimization];
|
||||
|
||||
CompileQueue* CompileBroker::_c2_compile_queue = NULL;
|
||||
CompileQueue* CompileBroker::_c1_compile_queue = NULL;
|
||||
CompileQueue* CompileBroker::_c2_compile_queue = nullptr;
|
||||
CompileQueue* CompileBroker::_c1_compile_queue = nullptr;
|
||||
|
||||
bool compileBroker_init() {
|
||||
if (LogEvents) {
|
||||
@ -216,16 +216,16 @@ CompileTaskWrapper::CompileTaskWrapper(CompileTask* task) {
|
||||
CompilerThread* thread = CompilerThread::current();
|
||||
thread->set_task(task);
|
||||
CompileLog* log = thread->log();
|
||||
if (log != NULL && !task->is_unloaded()) task->log_task_start(log);
|
||||
if (log != nullptr && !task->is_unloaded()) task->log_task_start(log);
|
||||
}
|
||||
|
||||
CompileTaskWrapper::~CompileTaskWrapper() {
|
||||
CompilerThread* thread = CompilerThread::current();
|
||||
CompileTask* task = thread->task();
|
||||
CompileLog* log = thread->log();
|
||||
if (log != NULL && !task->is_unloaded()) task->log_task_done(log);
|
||||
thread->set_task(NULL);
|
||||
thread->set_env(NULL);
|
||||
if (log != nullptr && !task->is_unloaded()) task->log_task_done(log);
|
||||
thread->set_task(nullptr);
|
||||
thread->set_env(nullptr);
|
||||
if (task->is_blocking()) {
|
||||
bool free_task = false;
|
||||
{
|
||||
@ -237,7 +237,7 @@ CompileTaskWrapper::~CompileTaskWrapper() {
|
||||
// The waiting thread timed out and thus did not free the task.
|
||||
free_task = true;
|
||||
}
|
||||
task->set_blocking_jvmci_compile_state(NULL);
|
||||
task->set_blocking_jvmci_compile_state(nullptr);
|
||||
}
|
||||
#endif
|
||||
if (!free_task) {
|
||||
@ -299,7 +299,7 @@ bool CompileBroker::can_remove(CompilerThread *ct, bool do_it) {
|
||||
if (compiler->is_jvmci()) {
|
||||
// Old j.l.Thread object can die when no longer referenced elsewhere.
|
||||
JNIHandles::destroy_global(compiler2_object(compiler_count - 1));
|
||||
_compiler2_objects[compiler_count - 1] = NULL;
|
||||
_compiler2_objects[compiler_count - 1] = nullptr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -314,17 +314,17 @@ bool CompileBroker::can_remove(CompilerThread *ct, bool do_it) {
|
||||
void CompileQueue::add(CompileTask* task) {
|
||||
assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
|
||||
|
||||
task->set_next(NULL);
|
||||
task->set_prev(NULL);
|
||||
task->set_next(nullptr);
|
||||
task->set_prev(nullptr);
|
||||
|
||||
if (_last == NULL) {
|
||||
if (_last == nullptr) {
|
||||
// The compile queue is empty.
|
||||
assert(_first == NULL, "queue is empty");
|
||||
assert(_first == nullptr, "queue is empty");
|
||||
_first = task;
|
||||
_last = task;
|
||||
} else {
|
||||
// Append the task to the queue.
|
||||
assert(_last->next() == NULL, "not last");
|
||||
assert(_last->next() == nullptr, "not last");
|
||||
_last->set_next(task);
|
||||
task->set_prev(_last);
|
||||
_last = task;
|
||||
@ -338,7 +338,7 @@ void CompileQueue::add(CompileTask* task) {
|
||||
print_tty();
|
||||
}
|
||||
|
||||
if (LogCompilation && xtty != NULL) {
|
||||
if (LogCompilation && xtty != nullptr) {
|
||||
task->log_task_queued();
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ void CompileQueue::free_all() {
|
||||
CompileTask* next = _first;
|
||||
|
||||
// Iterate over all tasks in the compile queue
|
||||
while (next != NULL) {
|
||||
while (next != nullptr) {
|
||||
CompileTask* current = next;
|
||||
next = current->next();
|
||||
{
|
||||
@ -368,8 +368,8 @@ void CompileQueue::free_all() {
|
||||
// Put the task back on the freelist.
|
||||
CompileTask::free(current);
|
||||
}
|
||||
_first = NULL;
|
||||
_last = NULL;
|
||||
_first = nullptr;
|
||||
_last = nullptr;
|
||||
|
||||
// Wake up all threads that block on the queue.
|
||||
MethodCompileQueue_lock->notify_all();
|
||||
@ -385,15 +385,15 @@ CompileTask* CompileQueue::get(CompilerThread* thread) {
|
||||
methodHandle save_hot_method;
|
||||
|
||||
MonitorLocker locker(MethodCompileQueue_lock);
|
||||
// If _first is NULL we have no more compile jobs. There are two reasons for
|
||||
// If _first is nullptr we have no more compile jobs. There are two reasons for
|
||||
// having no compile jobs: First, we compiled everything we wanted. Second,
|
||||
// we ran out of code cache so compilation has been disabled. In the latter
|
||||
// case we perform code cache sweeps to free memory such that we can re-enable
|
||||
// compilation.
|
||||
while (_first == NULL) {
|
||||
while (_first == nullptr) {
|
||||
// Exit loop if compilation is disabled forever
|
||||
if (CompileBroker::is_compilation_disabled_forever()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AbstractCompiler* compiler = thread->compiler();
|
||||
@ -413,26 +413,26 @@ CompileTask* CompileQueue::get(CompilerThread* thread) {
|
||||
// is not critical and we do not want idle compiler threads to wake up too often.
|
||||
locker.wait(5*1000);
|
||||
|
||||
if (UseDynamicNumberOfCompilerThreads && _first == NULL) {
|
||||
if (UseDynamicNumberOfCompilerThreads && _first == nullptr) {
|
||||
// Still nothing to compile. Give caller a chance to stop this thread.
|
||||
if (CompileBroker::can_remove(CompilerThread::current(), false)) return NULL;
|
||||
if (CompileBroker::can_remove(CompilerThread::current(), false)) return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (CompileBroker::is_compilation_disabled_forever()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CompileTask* task;
|
||||
{
|
||||
NoSafepointVerifier nsv;
|
||||
task = CompilationPolicy::select_task(this);
|
||||
if (task != NULL) {
|
||||
if (task != nullptr) {
|
||||
task = task->select_for_compilation();
|
||||
}
|
||||
}
|
||||
|
||||
if (task != NULL) {
|
||||
if (task != nullptr) {
|
||||
// Save method pointers across unlock safepoint. The task is removed from
|
||||
// the compilation queue, which is walked during RedefineClasses.
|
||||
Thread* thread = Thread::current();
|
||||
@ -449,16 +449,16 @@ CompileTask* CompileQueue::get(CompilerThread* thread) {
|
||||
// Temporarily releases MethodCompileQueue lock.
|
||||
void CompileQueue::purge_stale_tasks() {
|
||||
assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
|
||||
if (_first_stale != NULL) {
|
||||
if (_first_stale != nullptr) {
|
||||
// Stale tasks are purged when MCQ lock is released,
|
||||
// but _first_stale updates are protected by MCQ lock.
|
||||
// Once task processing starts and MCQ lock is released,
|
||||
// other compiler threads can reuse _first_stale.
|
||||
CompileTask* head = _first_stale;
|
||||
_first_stale = NULL;
|
||||
_first_stale = nullptr;
|
||||
{
|
||||
MutexUnlocker ul(MethodCompileQueue_lock);
|
||||
for (CompileTask* task = head; task != NULL; ) {
|
||||
for (CompileTask* task = head; task != nullptr; ) {
|
||||
CompileTask* next_task = task->next();
|
||||
CompileTaskWrapper ctw(task); // Frees the task
|
||||
task->set_failure_reason("stale task");
|
||||
@ -470,7 +470,7 @@ void CompileQueue::purge_stale_tasks() {
|
||||
|
||||
void CompileQueue::remove(CompileTask* task) {
|
||||
assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
|
||||
if (task->prev() != NULL) {
|
||||
if (task->prev() != nullptr) {
|
||||
task->prev()->set_next(task->next());
|
||||
} else {
|
||||
// max is the first element
|
||||
@ -478,7 +478,7 @@ void CompileQueue::remove(CompileTask* task) {
|
||||
_first = task->next();
|
||||
}
|
||||
|
||||
if (task->next() != NULL) {
|
||||
if (task->next() != nullptr) {
|
||||
task->next()->set_prev(task->prev());
|
||||
} else {
|
||||
// max is the last element
|
||||
@ -494,7 +494,7 @@ void CompileQueue::remove_and_mark_stale(CompileTask* task) {
|
||||
|
||||
// Enqueue the task for reclamation (should be done outside MCQ lock)
|
||||
task->set_next(_first_stale);
|
||||
task->set_prev(NULL);
|
||||
task->set_prev(nullptr);
|
||||
_first_stale = task;
|
||||
}
|
||||
|
||||
@ -502,7 +502,7 @@ void CompileQueue::remove_and_mark_stale(CompileTask* task) {
|
||||
// so that they don't get reclaimed by Redefine Classes
|
||||
void CompileQueue::mark_on_stack() {
|
||||
CompileTask* task = _first;
|
||||
while (task != NULL) {
|
||||
while (task != nullptr) {
|
||||
task->mark_on_stack();
|
||||
task = task->next();
|
||||
}
|
||||
@ -512,7 +512,7 @@ void CompileQueue::mark_on_stack() {
|
||||
CompileQueue* CompileBroker::compile_queue(int comp_level) {
|
||||
if (is_c2_compile(comp_level)) return _c2_compile_queue;
|
||||
if (is_c1_compile(comp_level)) return _c1_compile_queue;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CompileBroker::print_compile_queues(outputStream* st) {
|
||||
@ -523,10 +523,10 @@ void CompileBroker::print_compile_queues(outputStream* st) {
|
||||
Threads::print_threads_compiling(st, buf, buflen, /* short_form = */ true);
|
||||
|
||||
st->cr();
|
||||
if (_c1_compile_queue != NULL) {
|
||||
if (_c1_compile_queue != nullptr) {
|
||||
_c1_compile_queue->print(st);
|
||||
}
|
||||
if (_c2_compile_queue != NULL) {
|
||||
if (_c2_compile_queue != nullptr) {
|
||||
_c2_compile_queue->print(st);
|
||||
}
|
||||
}
|
||||
@ -535,11 +535,11 @@ void CompileQueue::print(outputStream* st) {
|
||||
assert_locked_or_safepoint(MethodCompileQueue_lock);
|
||||
st->print_cr("%s:", name());
|
||||
CompileTask* task = _first;
|
||||
if (task == NULL) {
|
||||
if (task == nullptr) {
|
||||
st->print_cr("Empty");
|
||||
} else {
|
||||
while (task != NULL) {
|
||||
task->print(st, NULL, true, true);
|
||||
while (task != nullptr) {
|
||||
task->print(st, nullptr, true, true);
|
||||
task = task->next();
|
||||
}
|
||||
}
|
||||
@ -832,11 +832,11 @@ void DeoptimizeObjectsALotThread::deoptimize_objects_alot_loop_all() {
|
||||
|
||||
|
||||
JavaThread* CompileBroker::make_thread(ThreadType type, jobject thread_handle, CompileQueue* queue, AbstractCompiler* comp, JavaThread* THREAD) {
|
||||
JavaThread* new_thread = NULL;
|
||||
JavaThread* new_thread = nullptr;
|
||||
|
||||
switch (type) {
|
||||
case compiler_t:
|
||||
assert(comp != NULL, "Compiler instance missing.");
|
||||
assert(comp != nullptr, "Compiler instance missing.");
|
||||
if (!InjectCompilerCreationFailure || comp->num_compiler_threads() == 0) {
|
||||
CompilerCounters* counters = new CompilerCounters();
|
||||
new_thread = new CompilerThread(queue, counters);
|
||||
@ -861,7 +861,7 @@ JavaThread* CompileBroker::make_thread(ThreadType type, jobject thread_handle, C
|
||||
// At this point it may be possible that no osthread was created for the
|
||||
// JavaThread due to lack of resources. We will handle that failure below.
|
||||
// Also check new_thread so that static analysis is happy.
|
||||
if (new_thread != NULL && new_thread->osthread() != NULL) {
|
||||
if (new_thread != nullptr && new_thread->osthread() != nullptr) {
|
||||
Handle thread_oop(THREAD, JNIHandles::resolve_non_null(thread_handle));
|
||||
|
||||
if (type == compiler_t) {
|
||||
@ -892,7 +892,7 @@ JavaThread* CompileBroker::make_thread(ThreadType type, jobject thread_handle, C
|
||||
&& comp->num_compiler_threads() > 0) {
|
||||
// The new thread is not known to Thread-SMR yet so we can just delete.
|
||||
delete new_thread;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
vm_exit_during_initialization("java.lang.OutOfMemoryError",
|
||||
os::native_thread_creation_failed_msg());
|
||||
@ -927,7 +927,7 @@ void CompileBroker::init_compiler_threads() {
|
||||
char name_buffer[256];
|
||||
|
||||
for (int i = 0; i < _c2_count; i++) {
|
||||
jobject thread_handle = NULL;
|
||||
jobject thread_handle = nullptr;
|
||||
// Create all j.l.Thread objects for C1 and C2 threads here, but only one
|
||||
// for JVMCI compiler which can create further ones on demand.
|
||||
JVMCI_ONLY(if (!UseJVMCICompiler || !UseDynamicNumberOfCompilerThreads || i == 0) {)
|
||||
@ -937,11 +937,11 @@ void CompileBroker::init_compiler_threads() {
|
||||
thread_handle = JNIHandles::make_global(thread_oop);
|
||||
JVMCI_ONLY(})
|
||||
_compiler2_objects[i] = thread_handle;
|
||||
_compiler2_logs[i] = NULL;
|
||||
_compiler2_logs[i] = nullptr;
|
||||
|
||||
if (!UseDynamicNumberOfCompilerThreads || i == 0) {
|
||||
JavaThread *ct = make_thread(compiler_t, thread_handle, _c2_compile_queue, _compilers[1], THREAD);
|
||||
assert(ct != NULL, "should have been handled for initial thread");
|
||||
assert(ct != nullptr, "should have been handled for initial thread");
|
||||
_compilers[1]->set_num_compiler_threads(i + 1);
|
||||
if (TraceCompilerThreads) {
|
||||
ResourceMark rm;
|
||||
@ -958,11 +958,11 @@ void CompileBroker::init_compiler_threads() {
|
||||
Handle thread_oop = create_thread_oop(name_buffer, CHECK);
|
||||
jobject thread_handle = JNIHandles::make_global(thread_oop);
|
||||
_compiler1_objects[i] = thread_handle;
|
||||
_compiler1_logs[i] = NULL;
|
||||
_compiler1_logs[i] = nullptr;
|
||||
|
||||
if (!UseDynamicNumberOfCompilerThreads || i == 0) {
|
||||
JavaThread *ct = make_thread(compiler_t, thread_handle, _c1_compile_queue, _compilers[0], THREAD);
|
||||
assert(ct != NULL, "should have been handled for initial thread");
|
||||
assert(ct != nullptr, "should have been handled for initial thread");
|
||||
_compilers[0]->set_num_compiler_threads(i + 1);
|
||||
if (TraceCompilerThreads) {
|
||||
ResourceMark rm;
|
||||
@ -984,7 +984,7 @@ void CompileBroker::init_compiler_threads() {
|
||||
for (int count = 0; count < total_count; count++) {
|
||||
Handle thread_oop = create_thread_oop("Deoptimize objects a lot single mode", CHECK);
|
||||
jobject thread_handle = JNIHandles::make_local(THREAD, thread_oop());
|
||||
make_thread(deoptimizer_t, thread_handle, NULL, NULL, THREAD);
|
||||
make_thread(deoptimizer_t, thread_handle, nullptr, nullptr, THREAD);
|
||||
}
|
||||
}
|
||||
#endif // defined(ASSERT) && COMPILER2_OR_JVMCI
|
||||
@ -1000,7 +1000,7 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) {
|
||||
// Only do attempt to start additional threads if the lock is free.
|
||||
if (!CompileThread_lock->try_lock()) return;
|
||||
|
||||
if (_c2_compile_queue != NULL) {
|
||||
if (_c2_compile_queue != nullptr) {
|
||||
int old_c2_count = _compilers[1]->num_compiler_threads();
|
||||
int new_c2_count = MIN4(_c2_count,
|
||||
_c2_compile_queue->size() / 2,
|
||||
@ -1037,12 +1037,12 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) {
|
||||
// Check if another thread has beaten us during the Java calls.
|
||||
if (_compilers[1]->num_compiler_threads() != i) break;
|
||||
jobject thread_handle = JNIHandles::make_global(thread_oop);
|
||||
assert(compiler2_object(i) == NULL, "Old one must be released!");
|
||||
assert(compiler2_object(i) == nullptr, "Old one must be released!");
|
||||
_compiler2_objects[i] = thread_handle;
|
||||
}
|
||||
#endif
|
||||
JavaThread *ct = make_thread(compiler_t, compiler2_object(i), _c2_compile_queue, _compilers[1], THREAD);
|
||||
if (ct == NULL) break;
|
||||
if (ct == nullptr) break;
|
||||
_compilers[1]->set_num_compiler_threads(i + 1);
|
||||
if (TraceCompilerThreads) {
|
||||
ResourceMark rm;
|
||||
@ -1054,7 +1054,7 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) {
|
||||
}
|
||||
}
|
||||
|
||||
if (_c1_compile_queue != NULL) {
|
||||
if (_c1_compile_queue != nullptr) {
|
||||
int old_c1_count = _compilers[0]->num_compiler_threads();
|
||||
int new_c1_count = MIN4(_c1_count,
|
||||
_c1_compile_queue->size() / 4,
|
||||
@ -1063,7 +1063,7 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) {
|
||||
|
||||
for (int i = old_c1_count; i < new_c1_count; i++) {
|
||||
JavaThread *ct = make_thread(compiler_t, compiler1_object(i), _c1_compile_queue, _compilers[0], THREAD);
|
||||
if (ct == NULL) break;
|
||||
if (ct == nullptr) break;
|
||||
_compilers[0]->set_num_compiler_threads(i + 1);
|
||||
if (TraceCompilerThreads) {
|
||||
ResourceMark rm;
|
||||
@ -1087,10 +1087,10 @@ void CompileBroker::mark_on_stack() {
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
|
||||
// Since we are at a safepoint, we do not need a lock to access
|
||||
// the compile queues.
|
||||
if (_c2_compile_queue != NULL) {
|
||||
if (_c2_compile_queue != nullptr) {
|
||||
_c2_compile_queue->mark_on_stack();
|
||||
}
|
||||
if (_c1_compile_queue != NULL) {
|
||||
if (_c1_compile_queue != nullptr) {
|
||||
_c1_compile_queue->mark_on_stack();
|
||||
}
|
||||
}
|
||||
@ -1167,7 +1167,7 @@ void CompileBroker::compile_method_base(const methodHandle& method,
|
||||
method->get_method_counters(thread);
|
||||
|
||||
// Outputs from the following MutexLocker block:
|
||||
CompileTask* task = NULL;
|
||||
CompileTask* task = nullptr;
|
||||
CompileQueue* queue = compile_queue(comp_level);
|
||||
|
||||
// Acquire our lock.
|
||||
@ -1289,11 +1289,11 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
TRAPS) {
|
||||
// Do nothing if compilebroker is not initialized or compiles are submitted on level none
|
||||
if (!_initialized || comp_level == CompLevel_none) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AbstractCompiler *comp = CompileBroker::compiler(comp_level);
|
||||
assert(comp != NULL, "Ensure we have a compiler");
|
||||
assert(comp != nullptr, "Ensure we have a compiler");
|
||||
|
||||
DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp);
|
||||
// CompileBroker::compile_method can trap and can have pending async exception.
|
||||
@ -1319,33 +1319,33 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
// lock, make sure that the compilation
|
||||
// isn't prohibited in a straightforward way.
|
||||
AbstractCompiler* comp = CompileBroker::compiler(comp_level);
|
||||
if (comp == NULL || compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) {
|
||||
return NULL;
|
||||
if (comp == nullptr || compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
if (comp->is_jvmci() && !JVMCI::can_initialize_JVMCI()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (osr_bci == InvocationEntryBci) {
|
||||
// standard compilation
|
||||
CompiledMethod* method_code = method->code();
|
||||
if (method_code != NULL && method_code->is_nmethod()) {
|
||||
if (method_code != nullptr && method_code->is_nmethod()) {
|
||||
if (compilation_is_complete(method, osr_bci, comp_level)) {
|
||||
return (nmethod*) method_code;
|
||||
}
|
||||
}
|
||||
if (method->is_not_compilable(comp_level)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
// osr compilation
|
||||
// We accept a higher level osr method
|
||||
nmethod* nm = method->lookup_osr_nmethod_for(osr_bci, comp_level, false);
|
||||
if (nm != NULL) return nm;
|
||||
if (method->is_not_osr_compilable(comp_level)) return NULL;
|
||||
if (nm != nullptr) return nm;
|
||||
if (method->is_not_osr_compilable(comp_level)) return nullptr;
|
||||
}
|
||||
|
||||
assert(!HAS_PENDING_EXCEPTION, "No exception should be present");
|
||||
@ -1370,14 +1370,14 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
// about it. The interpreter will kick-in and throw the exception.
|
||||
method->set_not_compilable("NativeLookup::lookup failed"); // implies is_not_osr_compilable()
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
assert(method->has_native_function(), "must have native code by now");
|
||||
}
|
||||
|
||||
// RedefineClasses() has replaced this method; just return
|
||||
if (method->is_old()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// JVMTI -- post_compile_event requires jmethod_id() that may require
|
||||
@ -1409,7 +1409,7 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
(UseSSE >= 2 &&
|
||||
(method->intrinsic_id() == vmIntrinsics::_longBitsToDouble ||
|
||||
method->intrinsic_id() == vmIntrinsics::_doubleToRawLongBits))) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif // X86 && !ZERO
|
||||
|
||||
@ -1420,13 +1420,13 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
// in this case. If we can't generate one and use it we can not execute the out-of-line method handle calls.
|
||||
AdapterHandlerLibrary::create_native_wrapper(method);
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
// If the compiler is shut off due to code cache getting full
|
||||
// fail out now so blocking compiles dont hang the java thread
|
||||
if (!should_compile_new_jobs()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
bool is_blocking = !directive->BackgroundCompilationOption || ReplayCompiles;
|
||||
compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, compile_reason, is_blocking, THREAD);
|
||||
@ -1436,7 +1436,7 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
// We accept a higher level osr method
|
||||
if (osr_bci == InvocationEntryBci) {
|
||||
CompiledMethod* code = method->code();
|
||||
if (code == NULL) {
|
||||
if (code == nullptr) {
|
||||
return (nmethod*) code;
|
||||
} else {
|
||||
return code->as_nmethod_or_null();
|
||||
@ -1459,14 +1459,14 @@ bool CompileBroker::compilation_is_complete(const methodHandle& method,
|
||||
return true;
|
||||
} else {
|
||||
nmethod* result = method->lookup_osr_nmethod_for(osr_bci, comp_level, true);
|
||||
return (result != NULL);
|
||||
return (result != nullptr);
|
||||
}
|
||||
} else {
|
||||
if (method->is_not_compilable(comp_level)) {
|
||||
return true;
|
||||
} else {
|
||||
CompiledMethod* result = method->code();
|
||||
if (result == NULL) return false;
|
||||
if (result == nullptr) return false;
|
||||
return comp_level == result->comp_level();
|
||||
}
|
||||
}
|
||||
@ -1495,14 +1495,14 @@ bool CompileBroker::compilation_is_prohibited(const methodHandle& method, int os
|
||||
bool is_native = method->is_native();
|
||||
// Some compilers may not support the compilation of natives.
|
||||
AbstractCompiler *comp = compiler(comp_level);
|
||||
if (is_native && (!CICompileNatives || comp == NULL)) {
|
||||
if (is_native && (!CICompileNatives || comp == nullptr)) {
|
||||
method->set_not_compilable_quietly("native methods not supported", comp_level);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_osr = (osr_bci != standard_entry_bci);
|
||||
// Some compilers may not support on stack replacement.
|
||||
if (is_osr && (!CICompileOSR || comp == NULL)) {
|
||||
if (is_osr && (!CICompileOSR || comp == nullptr)) {
|
||||
method->set_not_osr_compilable("OSR not supported", comp_level);
|
||||
return true;
|
||||
}
|
||||
@ -1622,7 +1622,7 @@ bool CompileBroker::wait_for_jvmci_completion(JVMCICompiler* jvmci, CompileTask*
|
||||
JVMCICompileState* jvmci_compile_state = task->blocking_jvmci_compile_state();
|
||||
|
||||
bool progress;
|
||||
if (jvmci_compile_state != NULL) {
|
||||
if (jvmci_compile_state != nullptr) {
|
||||
jint ticks = jvmci_compile_state->compilation_ticks();
|
||||
progress = (ticks - thread_jvmci_compilation_ticks) != 0;
|
||||
JVMCI_event_1("waiting on compilation %d [ticks=%d]", task->compile_id(), ticks);
|
||||
@ -1712,12 +1712,12 @@ bool CompileBroker::init_compiler_runtime() {
|
||||
CompilerThread* thread = CompilerThread::current();
|
||||
AbstractCompiler* comp = thread->compiler();
|
||||
// Final sanity check - the compiler object must exist
|
||||
guarantee(comp != NULL, "Compiler object must exist");
|
||||
guarantee(comp != nullptr, "Compiler object must exist");
|
||||
|
||||
{
|
||||
// Must switch to native to allocate ci_env
|
||||
ThreadToNativeFromVM ttn(thread);
|
||||
ciEnv ci_env((CompileTask*)NULL);
|
||||
ciEnv ci_env((CompileTask*)nullptr);
|
||||
// Cache Jvmti state
|
||||
ci_env.cache_jvmti_state();
|
||||
// Cache DTrace flags
|
||||
@ -1739,7 +1739,7 @@ bool CompileBroker::init_compiler_runtime() {
|
||||
}
|
||||
|
||||
// C1 specific check
|
||||
if (comp->is_c1() && (thread->get_buffer_blob() == NULL)) {
|
||||
if (comp->is_c1() && (thread->get_buffer_blob() == nullptr)) {
|
||||
warning("Initialization of %s thread failed (no space to run compilers)", thread->name());
|
||||
return false;
|
||||
}
|
||||
@ -1754,7 +1754,7 @@ bool CompileBroker::init_compiler_runtime() {
|
||||
*/
|
||||
void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) {
|
||||
// Free buffer blob, if allocated
|
||||
if (thread->get_buffer_blob() != NULL) {
|
||||
if (thread->get_buffer_blob() != nullptr) {
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::free(thread->get_buffer_blob());
|
||||
}
|
||||
@ -1770,11 +1770,11 @@ void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerTh
|
||||
comp->set_shut_down();
|
||||
|
||||
// Delete all queued compilation tasks to make compiler threads exit faster.
|
||||
if (_c1_compile_queue != NULL) {
|
||||
if (_c1_compile_queue != nullptr) {
|
||||
_c1_compile_queue->free_all();
|
||||
}
|
||||
|
||||
if (_c2_compile_queue != NULL) {
|
||||
if (_c2_compile_queue != nullptr) {
|
||||
_c2_compile_queue->free_all();
|
||||
}
|
||||
|
||||
@ -1792,14 +1792,14 @@ void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerTh
|
||||
* Helper function to create new or reuse old CompileLog.
|
||||
*/
|
||||
CompileLog* CompileBroker::get_log(CompilerThread* ct) {
|
||||
if (!LogCompilation) return NULL;
|
||||
if (!LogCompilation) return nullptr;
|
||||
|
||||
AbstractCompiler *compiler = ct->compiler();
|
||||
bool c1 = compiler->is_c1();
|
||||
jobject* compiler_objects = c1 ? _compiler1_objects : _compiler2_objects;
|
||||
assert(compiler_objects != NULL, "must be initialized at this point");
|
||||
assert(compiler_objects != nullptr, "must be initialized at this point");
|
||||
CompileLog** logs = c1 ? _compiler1_logs : _compiler2_logs;
|
||||
assert(logs != NULL, "must be initialized at this point");
|
||||
assert(logs != nullptr, "must be initialized at this point");
|
||||
int count = c1 ? _c1_count : _c2_count;
|
||||
|
||||
// Find Compiler number by its threadObj.
|
||||
@ -1819,7 +1819,7 @@ CompileLog* CompileBroker::get_log(CompilerThread* ct) {
|
||||
|
||||
// Return old one if it exists.
|
||||
CompileLog* log = *log_ptr;
|
||||
if (log != NULL) {
|
||||
if (log != nullptr) {
|
||||
ct->init_log(log);
|
||||
return log;
|
||||
}
|
||||
@ -1854,7 +1854,7 @@ void CompileBroker::compiler_thread_loop() {
|
||||
|
||||
// Open a log.
|
||||
CompileLog* log = get_log(thread);
|
||||
if (log != NULL) {
|
||||
if (log != nullptr) {
|
||||
log->begin_elem("start_compile_thread name='%s' thread='" UINTX_FORMAT "' process='%d'",
|
||||
thread->name(),
|
||||
os::current_thread_id(),
|
||||
@ -1880,7 +1880,7 @@ void CompileBroker::compiler_thread_loop() {
|
||||
HandleMark hm(thread);
|
||||
|
||||
CompileTask* task = queue->get(thread);
|
||||
if (task == NULL) {
|
||||
if (task == nullptr) {
|
||||
if (UseDynamicNumberOfCompilerThreads) {
|
||||
// Access compiler_count under lock to enforce consistency.
|
||||
MutexLocker only_one(CompileThread_lock);
|
||||
@ -1894,7 +1894,7 @@ void CompileBroker::compiler_thread_loop() {
|
||||
thread->compiler()->stopping_compiler_thread(thread);
|
||||
|
||||
// Free buffer blob, if allocated
|
||||
if (thread->get_buffer_blob() != NULL) {
|
||||
if (thread->get_buffer_blob() != nullptr) {
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::free(thread->get_buffer_blob());
|
||||
}
|
||||
@ -1942,11 +1942,11 @@ void CompileBroker::compiler_thread_loop() {
|
||||
void CompileBroker::init_compiler_thread_log() {
|
||||
CompilerThread* thread = CompilerThread::current();
|
||||
char file_name[4*K];
|
||||
FILE* fp = NULL;
|
||||
FILE* fp = nullptr;
|
||||
intx thread_id = os::current_thread_id();
|
||||
for (int try_temp_dir = 1; try_temp_dir >= 0; try_temp_dir--) {
|
||||
const char* dir = (try_temp_dir ? os::get_temp_directory() : NULL);
|
||||
if (dir == NULL) {
|
||||
const char* dir = (try_temp_dir ? os::get_temp_directory() : nullptr);
|
||||
if (dir == nullptr) {
|
||||
jio_snprintf(file_name, sizeof(file_name), "hs_c" UINTX_FORMAT "_pid%u.log",
|
||||
thread_id, os::current_process_id());
|
||||
} else {
|
||||
@ -1956,18 +1956,18 @@ void CompileBroker::init_compiler_thread_log() {
|
||||
}
|
||||
|
||||
fp = os::fopen(file_name, "wt");
|
||||
if (fp != NULL) {
|
||||
if (fp != nullptr) {
|
||||
if (LogCompilation && Verbose) {
|
||||
tty->print_cr("Opening compilation log %s", file_name);
|
||||
}
|
||||
CompileLog* log = new(mtCompiler) CompileLog(file_name, fp, thread_id);
|
||||
if (log == NULL) {
|
||||
if (log == nullptr) {
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
thread->init_log(log);
|
||||
|
||||
if (xtty != NULL) {
|
||||
if (xtty != nullptr) {
|
||||
ttyLocker ttyl;
|
||||
// Record any per thread log files
|
||||
xtty->elem("thread_logfile thread='" INTX_FORMAT "' filename='%s'", thread_id, file_name);
|
||||
@ -1981,7 +1981,7 @@ void CompileBroker::init_compiler_thread_log() {
|
||||
void CompileBroker::log_metaspace_failure() {
|
||||
const char* message = "some methods may not be compiled because metaspace "
|
||||
"is out of memory";
|
||||
if (CompilationLog::log() != NULL) {
|
||||
if (CompilationLog::log() != nullptr) {
|
||||
CompilationLog::log()->log_metaspace_failure(message);
|
||||
}
|
||||
if (PrintCompilation) {
|
||||
@ -2045,7 +2045,7 @@ static void codecache_print(outputStream* out, bool detailed) {
|
||||
char* remaining_log = s.as_string();
|
||||
while (*remaining_log != '\0') {
|
||||
char* eol = strchr(remaining_log, '\n');
|
||||
if (eol == NULL) {
|
||||
if (eol == nullptr) {
|
||||
out->print_cr("%s", remaining_log);
|
||||
remaining_log = remaining_log + strlen(remaining_log);
|
||||
} else {
|
||||
@ -2070,7 +2070,7 @@ void CompileBroker::handle_compile_error(CompilerThread* thread, CompileTask* ta
|
||||
}
|
||||
|
||||
static void post_compilation_event(EventCompilation& event, CompileTask* task) {
|
||||
assert(task != NULL, "invariant");
|
||||
assert(task != nullptr, "invariant");
|
||||
CompilerEvent::CompilationEvent::post(event,
|
||||
task->compile_id(),
|
||||
task->compiler()->type(),
|
||||
@ -2083,8 +2083,8 @@ static void post_compilation_event(EventCompilation& event, CompileTask* task) {
|
||||
}
|
||||
|
||||
int DirectivesStack::_depth = 0;
|
||||
CompilerDirectives* DirectivesStack::_top = NULL;
|
||||
CompilerDirectives* DirectivesStack::_bottom = NULL;
|
||||
CompilerDirectives* DirectivesStack::_top = nullptr;
|
||||
CompilerDirectives* DirectivesStack::_bottom = nullptr;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileBroker::invoke_compiler_on_method
|
||||
@ -2104,7 +2104,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
CompilerThread* thread = CompilerThread::current();
|
||||
ResourceMark rm(thread);
|
||||
|
||||
if (CompilationLog::log() != NULL) {
|
||||
if (CompilationLog::log() != nullptr) {
|
||||
CompilationLog::log()->log_compile(thread, task);
|
||||
}
|
||||
|
||||
@ -2112,7 +2112,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
int compile_id = task->compile_id();
|
||||
int osr_bci = task->osr_bci();
|
||||
bool is_osr = (osr_bci != standard_entry_bci);
|
||||
bool should_log = (thread->log() != NULL);
|
||||
bool should_log = (thread->log() != nullptr);
|
||||
bool should_break = false;
|
||||
const int task_level = task->comp_level();
|
||||
AbstractCompiler* comp = task->compiler();
|
||||
@ -2142,18 +2142,18 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
JNIHandleMark jhm(thread);
|
||||
Method* target_handle = task->method();
|
||||
int compilable = ciEnv::MethodCompilable;
|
||||
const char* failure_reason = NULL;
|
||||
const char* failure_reason = nullptr;
|
||||
bool failure_reason_on_C_heap = false;
|
||||
const char* retry_message = NULL;
|
||||
const char* retry_message = nullptr;
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
if (UseJVMCICompiler && comp != NULL && comp->is_jvmci()) {
|
||||
if (UseJVMCICompiler && comp != nullptr && comp->is_jvmci()) {
|
||||
JVMCICompiler* jvmci = (JVMCICompiler*) comp;
|
||||
|
||||
TraceTime t1("compilation", &time);
|
||||
EventCompilation event;
|
||||
JVMCICompileState compile_state(task, jvmci);
|
||||
JVMCIRuntime *runtime = NULL;
|
||||
JVMCIRuntime *runtime = nullptr;
|
||||
|
||||
if (JVMCI::in_shutdown()) {
|
||||
failure_reason = "in JVMCI shutdown";
|
||||
@ -2179,12 +2179,12 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
compilable = ciEnv::MethodCompilable_not_at_tier;
|
||||
}
|
||||
if (!task->is_success()) {
|
||||
assert(failure_reason != NULL, "must specify failure_reason");
|
||||
assert(failure_reason != nullptr, "must specify failure_reason");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!task->is_success()) {
|
||||
handle_compile_error(thread, task, NULL, compilable, failure_reason);
|
||||
handle_compile_error(thread, task, nullptr, compilable, failure_reason);
|
||||
}
|
||||
if (event.should_commit()) {
|
||||
post_compilation_event(event, task);
|
||||
@ -2225,7 +2225,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
TraceTime t1("compilation", &time);
|
||||
EventCompilation event;
|
||||
|
||||
if (comp == NULL) {
|
||||
if (comp == nullptr) {
|
||||
ci_env.record_method_not_compilable("no compiler");
|
||||
} else if (!ci_env.failing()) {
|
||||
if (WhiteBoxAPI && WhiteBox::compilation_locked) {
|
||||
@ -2272,13 +2272,13 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
}
|
||||
}
|
||||
|
||||
if (failure_reason != NULL) {
|
||||
if (failure_reason != nullptr) {
|
||||
task->set_failure_reason(failure_reason, failure_reason_on_C_heap);
|
||||
if (CompilationLog::log() != NULL) {
|
||||
if (CompilationLog::log() != nullptr) {
|
||||
CompilationLog::log()->log_failure(thread, task, failure_reason, retry_message);
|
||||
}
|
||||
if (PrintCompilation) {
|
||||
FormatBufferResource msg = retry_message != NULL ?
|
||||
FormatBufferResource msg = retry_message != nullptr ?
|
||||
FormatBufferResource("COMPILE SKIPPED: %s (%s)", failure_reason, retry_message) :
|
||||
FormatBufferResource("COMPILE SKIPPED: %s", failure_reason);
|
||||
task->print(tty, msg);
|
||||
@ -2344,7 +2344,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
void CompileBroker::handle_full_code_cache(CodeBlobType code_blob_type) {
|
||||
UseInterpreter = true;
|
||||
if (UseCompiler || AlwaysCompileLoopMethods ) {
|
||||
if (xtty != NULL) {
|
||||
if (xtty != nullptr) {
|
||||
stringStream s;
|
||||
// Dump code cache state into a buffer before locking the tty,
|
||||
// because log_state() will use locks causing lock conflicts.
|
||||
@ -2558,7 +2558,7 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time
|
||||
|
||||
const char* CompileBroker::compiler_name(int comp_level) {
|
||||
AbstractCompiler *comp = CompileBroker::compiler(comp_level);
|
||||
if (comp == NULL) {
|
||||
if (comp == nullptr) {
|
||||
return "no compiler";
|
||||
} else {
|
||||
return (comp->name());
|
||||
@ -2566,7 +2566,7 @@ const char* CompileBroker::compiler_name(int comp_level) {
|
||||
}
|
||||
|
||||
jlong CompileBroker::total_compilation_ticks() {
|
||||
return _perf_total_compilation != NULL ? _perf_total_compilation->get_value() : 0;
|
||||
return _perf_total_compilation != nullptr ? _perf_total_compilation->get_value() : 0;
|
||||
}
|
||||
|
||||
void CompileBroker::print_times(const char* name, CompilerStatistics* stats) {
|
||||
@ -2587,7 +2587,7 @@ void CompileBroker::print_times(bool per_compiler, bool aggregate) {
|
||||
}
|
||||
for (unsigned int i = 0; i < sizeof(_compilers) / sizeof(AbstractCompiler*); i++) {
|
||||
AbstractCompiler* comp = _compilers[i];
|
||||
if (comp != NULL) {
|
||||
if (comp != nullptr) {
|
||||
print_times(comp->name(), comp->stats());
|
||||
}
|
||||
}
|
||||
@ -2645,12 +2645,12 @@ void CompileBroker::print_times(bool per_compiler, bool aggregate) {
|
||||
total_invalidated_count == 0 ? 0.0 : CompileBroker::_t_invalidated_compilation.seconds() / total_invalidated_count);
|
||||
|
||||
AbstractCompiler *comp = compiler(CompLevel_simple);
|
||||
if (comp != NULL) {
|
||||
if (comp != nullptr) {
|
||||
tty->cr();
|
||||
comp->print_timers();
|
||||
}
|
||||
comp = compiler(CompLevel_full_optimization);
|
||||
if (comp != NULL) {
|
||||
if (comp != nullptr) {
|
||||
tty->cr();
|
||||
comp->print_timers();
|
||||
}
|
||||
@ -2682,7 +2682,7 @@ void CompileBroker::print_times(bool per_compiler, bool aggregate) {
|
||||
|
||||
// Print general/accumulated JIT information.
|
||||
void CompileBroker::print_info(outputStream *out) {
|
||||
if (out == NULL) out = tty;
|
||||
if (out == nullptr) out = tty;
|
||||
out->cr();
|
||||
out->print_cr("======================");
|
||||
out->print_cr(" General JIT info ");
|
||||
@ -2720,7 +2720,7 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, size
|
||||
bool methodNames = !strcmp(function, "MethodNames") || allFun;
|
||||
bool discard = !strcmp(function, "discard") || allFun;
|
||||
|
||||
if (out == NULL) {
|
||||
if (out == nullptr) {
|
||||
out = tty;
|
||||
}
|
||||
|
||||
@ -2766,14 +2766,14 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, size
|
||||
!Compile_lock->owned_by_self();
|
||||
bool should_take_CodeCache_lock = !SafepointSynchronize::is_at_safepoint() &&
|
||||
!CodeCache_lock->owned_by_self();
|
||||
Mutex* global_lock_1 = allFun ? (should_take_Compile_lock ? Compile_lock : NULL) : NULL;
|
||||
Monitor* global_lock_2 = allFun ? (should_take_CodeCache_lock ? CodeCache_lock : NULL) : NULL;
|
||||
Mutex* function_lock_1 = allFun ? NULL : (should_take_Compile_lock ? Compile_lock : NULL);
|
||||
Monitor* function_lock_2 = allFun ? NULL : (should_take_CodeCache_lock ? CodeCache_lock : NULL);
|
||||
Mutex* global_lock_1 = allFun ? (should_take_Compile_lock ? Compile_lock : nullptr) : nullptr;
|
||||
Monitor* global_lock_2 = allFun ? (should_take_CodeCache_lock ? CodeCache_lock : nullptr) : nullptr;
|
||||
Mutex* function_lock_1 = allFun ? nullptr : (should_take_Compile_lock ? Compile_lock : nullptr);
|
||||
Monitor* function_lock_2 = allFun ? nullptr : (should_take_CodeCache_lock ? CodeCache_lock : nullptr);
|
||||
ts_global.update(); // record starting point
|
||||
MutexLocker mu1(global_lock_1, Mutex::_safepoint_check_flag);
|
||||
MutexLocker mu2(global_lock_2, Mutex::_no_safepoint_check_flag);
|
||||
if ((global_lock_1 != NULL) || (global_lock_2 != NULL)) {
|
||||
if ((global_lock_1 != nullptr) || (global_lock_2 != nullptr)) {
|
||||
out->print_cr("\n__ Compile & CodeCache (global) lock wait took %10.3f seconds _________\n", ts_global.seconds());
|
||||
ts_global.update(); // record starting point
|
||||
}
|
||||
@ -2782,13 +2782,13 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, size
|
||||
ts.update(); // record starting point
|
||||
MutexLocker mu11(function_lock_1, Mutex::_safepoint_check_flag);
|
||||
MutexLocker mu22(function_lock_2, Mutex::_no_safepoint_check_flag);
|
||||
if ((function_lock_1 != NULL) || (function_lock_1 != NULL)) {
|
||||
if ((function_lock_1 != nullptr) || (function_lock_1 != nullptr)) {
|
||||
out->print_cr("\n__ Compile & CodeCache (function) lock wait took %10.3f seconds _________\n", ts.seconds());
|
||||
}
|
||||
|
||||
ts.update(); // record starting point
|
||||
CodeCache::aggregate(out, granularity);
|
||||
if ((function_lock_1 != NULL) || (function_lock_1 != NULL)) {
|
||||
if ((function_lock_1 != nullptr) || (function_lock_1 != nullptr)) {
|
||||
out->print_cr("\n__ Compile & CodeCache (function) lock hold took %10.3f seconds _________\n", ts.seconds());
|
||||
}
|
||||
}
|
||||
@ -2809,7 +2809,7 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, size
|
||||
}
|
||||
if (discard) CodeCache::discard(out);
|
||||
|
||||
if ((global_lock_1 != NULL) || (global_lock_2 != NULL)) {
|
||||
if ((global_lock_1 != nullptr) || (global_lock_2 != nullptr)) {
|
||||
out->print_cr("\n__ Compile & CodeCache (global) lock hold took %10.3f seconds _________\n", ts_global.seconds());
|
||||
}
|
||||
out->print_cr("\n__ CodeHeapStateAnalytics total duration %10.3f seconds _________\n", ts_total.seconds());
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -93,10 +93,10 @@ class CompileQueue : public CHeapObj<mtCompiler> {
|
||||
public:
|
||||
CompileQueue(const char* name) {
|
||||
_name = name;
|
||||
_first = NULL;
|
||||
_last = NULL;
|
||||
_first = nullptr;
|
||||
_last = nullptr;
|
||||
_size = 0;
|
||||
_first_stale = NULL;
|
||||
_first_stale = nullptr;
|
||||
}
|
||||
|
||||
const char* name() const { return _name; }
|
||||
@ -109,7 +109,7 @@ class CompileQueue : public CHeapObj<mtCompiler> {
|
||||
|
||||
CompileTask* get(CompilerThread* thread);
|
||||
|
||||
bool is_empty() const { return _first == NULL; }
|
||||
bool is_empty() const { return _first == nullptr; }
|
||||
int size() const { return _size; }
|
||||
|
||||
|
||||
@ -281,7 +281,7 @@ public:
|
||||
static AbstractCompiler* compiler(int comp_level) {
|
||||
if (is_c2_compile(comp_level)) return _compilers[1]; // C2
|
||||
if (is_c1_compile(comp_level)) return _compilers[0]; // C1
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool compilation_is_complete(const methodHandle& method, int osr_bci, int comp_level);
|
||||
@ -289,7 +289,7 @@ public:
|
||||
static void print_compile_queues(outputStream* st);
|
||||
static int queue_size(int comp_level) {
|
||||
CompileQueue *q = compile_queue(comp_level);
|
||||
return q != NULL ? q->size() : 0;
|
||||
return q != nullptr ? q->size() : 0;
|
||||
}
|
||||
static void compilation_init_phase1(JavaThread* THREAD);
|
||||
static void compilation_init_phase2();
|
||||
@ -379,13 +379,13 @@ public:
|
||||
|
||||
// Provide access to compiler thread Java objects
|
||||
static jobject compiler1_object(int idx) {
|
||||
assert(_compiler1_objects != NULL, "must be initialized");
|
||||
assert(_compiler1_objects != nullptr, "must be initialized");
|
||||
assert(idx < _c1_count, "oob");
|
||||
return _compiler1_objects[idx];
|
||||
}
|
||||
|
||||
static jobject compiler2_object(int idx) {
|
||||
assert(_compiler2_objects != NULL, "must be initialized");
|
||||
assert(_compiler2_objects != nullptr, "must be initialized");
|
||||
assert(idx < _c2_count, "oob");
|
||||
return _compiler2_objects[idx];
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,7 +32,7 @@
|
||||
#include "runtime/mutexLocker.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
|
||||
CompileLog* CompileLog::_first = NULL;
|
||||
CompileLog* CompileLog::_first = nullptr;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileLog::CompileLog
|
||||
@ -58,7 +58,7 @@ CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id)
|
||||
|
||||
CompileLog::~CompileLog() {
|
||||
delete _out; // Close fd in fileStream::~fileStream()
|
||||
_out = NULL;
|
||||
_out = nullptr;
|
||||
// Remove partial file after merging in CompileLog::finish_log_on_error
|
||||
unlink(_file);
|
||||
FREE_C_HEAP_ARRAY(char, _identities);
|
||||
@ -69,7 +69,7 @@ CompileLog::~CompileLog() {
|
||||
// see_tag, pop_tag: Override the default do-nothing methods on xmlStream.
|
||||
// These methods provide a hook for managing the extra context markup.
|
||||
void CompileLog::see_tag(const char* tag, bool push) {
|
||||
if (_context.size() > 0 && _out != NULL) {
|
||||
if (_context.size() > 0 && _out != nullptr) {
|
||||
_out->write(_context.base(), _context.size());
|
||||
_context.reset();
|
||||
}
|
||||
@ -84,7 +84,7 @@ void CompileLog::pop_tag(const char* tag) {
|
||||
// ------------------------------------------------------------------
|
||||
// CompileLog::identify
|
||||
int CompileLog::identify(ciBaseObject* obj) {
|
||||
if (obj == NULL) return 0;
|
||||
if (obj == nullptr) return 0;
|
||||
int id = obj->ident();
|
||||
if (id < 0) return id;
|
||||
// If it has already been identified, just return the id.
|
||||
@ -169,7 +169,7 @@ int CompileLog::identify(ciBaseObject* obj) {
|
||||
}
|
||||
|
||||
void CompileLog::name(ciSymbol* name) {
|
||||
if (name == NULL) return;
|
||||
if (name == nullptr) return;
|
||||
print(" name='");
|
||||
name->print_symbol_on(text()); // handles quoting conventions
|
||||
print("'");
|
||||
@ -204,7 +204,7 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen)
|
||||
called_exit = true;
|
||||
|
||||
CompileLog* log = _first;
|
||||
while (log != NULL) {
|
||||
while (log != nullptr) {
|
||||
log->flush();
|
||||
const char* partial_file = log->file();
|
||||
int partial_fd = open(partial_file, O_RDONLY);
|
||||
@ -291,7 +291,7 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen)
|
||||
delete log; // Removes partial file
|
||||
log = next_log;
|
||||
}
|
||||
_first = NULL;
|
||||
_first = nullptr;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,22 +36,22 @@
|
||||
#include "runtime/jniHandles.hpp"
|
||||
#include "runtime/mutexLocker.hpp"
|
||||
|
||||
CompileTask* CompileTask::_task_free_list = NULL;
|
||||
CompileTask* CompileTask::_task_free_list = nullptr;
|
||||
|
||||
/**
|
||||
* Allocate a CompileTask, from the free list if possible.
|
||||
*/
|
||||
CompileTask* CompileTask::allocate() {
|
||||
MutexLocker locker(CompileTaskAlloc_lock);
|
||||
CompileTask* task = NULL;
|
||||
CompileTask* task = nullptr;
|
||||
|
||||
if (_task_free_list != NULL) {
|
||||
if (_task_free_list != nullptr) {
|
||||
task = _task_free_list;
|
||||
_task_free_list = task->next();
|
||||
task->set_next(NULL);
|
||||
task->set_next(nullptr);
|
||||
} else {
|
||||
task = new CompileTask();
|
||||
task->set_next(NULL);
|
||||
task->set_next(nullptr);
|
||||
task->set_is_free(true);
|
||||
}
|
||||
assert(task->is_free(), "Task must be free.");
|
||||
@ -66,18 +66,18 @@ void CompileTask::free(CompileTask* task) {
|
||||
MutexLocker locker(CompileTaskAlloc_lock);
|
||||
if (!task->is_free()) {
|
||||
assert(!task->lock()->is_locked(), "Should not be locked when freed");
|
||||
if ((task->_method_holder != NULL && JNIHandles::is_weak_global_handle(task->_method_holder)) ||
|
||||
(task->_hot_method_holder != NULL && JNIHandles::is_weak_global_handle(task->_hot_method_holder))) {
|
||||
if ((task->_method_holder != nullptr && JNIHandles::is_weak_global_handle(task->_method_holder)) ||
|
||||
(task->_hot_method_holder != nullptr && JNIHandles::is_weak_global_handle(task->_hot_method_holder))) {
|
||||
JNIHandles::destroy_weak_global(task->_method_holder);
|
||||
JNIHandles::destroy_weak_global(task->_hot_method_holder);
|
||||
} else {
|
||||
JNIHandles::destroy_global(task->_method_holder);
|
||||
JNIHandles::destroy_global(task->_hot_method_holder);
|
||||
}
|
||||
if (task->_failure_reason_on_C_heap && task->_failure_reason != NULL) {
|
||||
if (task->_failure_reason_on_C_heap && task->_failure_reason != nullptr) {
|
||||
os::free((void*) task->_failure_reason);
|
||||
}
|
||||
task->_failure_reason = NULL;
|
||||
task->_failure_reason = nullptr;
|
||||
task->_failure_reason_on_C_heap = false;
|
||||
|
||||
task->set_is_free(true);
|
||||
@ -103,15 +103,15 @@ void CompileTask::initialize(int compile_id,
|
||||
_osr_bci = osr_bci;
|
||||
_is_blocking = is_blocking;
|
||||
JVMCI_ONLY(_has_waiter = CompileBroker::compiler(comp_level)->is_jvmci();)
|
||||
JVMCI_ONLY(_blocking_jvmci_compile_state = NULL;)
|
||||
JVMCI_ONLY(_blocking_jvmci_compile_state = nullptr;)
|
||||
_comp_level = comp_level;
|
||||
_num_inlined_bytecodes = 0;
|
||||
|
||||
_is_complete = false;
|
||||
_is_success = false;
|
||||
|
||||
_hot_method = NULL;
|
||||
_hot_method_holder = NULL;
|
||||
_hot_method = nullptr;
|
||||
_hot_method_holder = nullptr;
|
||||
_hot_count = hot_count;
|
||||
_time_queued = os::elapsed_counter();
|
||||
_time_started = 0;
|
||||
@ -121,7 +121,7 @@ void CompileTask::initialize(int compile_id,
|
||||
_directive = DirectivesStack::getMatchingDirective(method, comp);
|
||||
_nm_insts_size = 0;
|
||||
_nm_total_size = 0;
|
||||
_failure_reason = NULL;
|
||||
_failure_reason = nullptr;
|
||||
_failure_reason_on_C_heap = false;
|
||||
|
||||
if (LogCompilation) {
|
||||
@ -136,7 +136,7 @@ void CompileTask::initialize(int compile_id,
|
||||
}
|
||||
}
|
||||
|
||||
_next = NULL;
|
||||
_next = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +150,7 @@ AbstractCompiler* CompileTask::compiler() {
|
||||
CompileTask* CompileTask::select_for_compilation() {
|
||||
if (is_unloaded()) {
|
||||
// Guard against concurrent class unloading
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
Thread* thread = Thread::current();
|
||||
assert(_method->method_holder()->is_loader_alive(), "should be alive");
|
||||
@ -158,7 +158,7 @@ CompileTask* CompileTask::select_for_compilation() {
|
||||
JNIHandles::destroy_weak_global(_method_holder);
|
||||
JNIHandles::destroy_weak_global(_hot_method_holder);
|
||||
_method_holder = JNIHandles::make_global(method_holder);
|
||||
if (_hot_method != NULL) {
|
||||
if (_hot_method != nullptr) {
|
||||
_hot_method_holder = JNIHandles::make_global(Handle(thread, _hot_method->method_holder()->klass_holder()));
|
||||
}
|
||||
return this;
|
||||
@ -170,13 +170,13 @@ void CompileTask::mark_on_stack() {
|
||||
}
|
||||
// Mark these methods as something redefine classes cannot remove.
|
||||
_method->set_on_stack(true);
|
||||
if (_hot_method != NULL) {
|
||||
if (_hot_method != nullptr) {
|
||||
_hot_method->set_on_stack(true);
|
||||
}
|
||||
}
|
||||
|
||||
bool CompileTask::is_unloaded() const {
|
||||
return _method_holder != NULL && JNIHandles::is_weak_global_handle(_method_holder) && JNIHandles::is_weak_global_cleared(_method_holder);
|
||||
return _method_holder != nullptr && JNIHandles::is_weak_global_handle(_method_holder) && JNIHandles::is_weak_global_cleared(_method_holder);
|
||||
}
|
||||
|
||||
// RedefineClasses support
|
||||
@ -185,7 +185,7 @@ void CompileTask::metadata_do(MetadataClosure* f) {
|
||||
return;
|
||||
}
|
||||
f->do_metadata(method());
|
||||
if (hot_method() != NULL && hot_method() != method()) {
|
||||
if (hot_method() != nullptr && hot_method() != method()) {
|
||||
f->do_metadata(hot_method());
|
||||
}
|
||||
}
|
||||
@ -244,7 +244,7 @@ void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, i
|
||||
bool is_synchronized = false;
|
||||
bool has_exception_handler = false;
|
||||
bool is_native = false;
|
||||
if (method != NULL) {
|
||||
if (method != nullptr) {
|
||||
is_synchronized = method->is_synchronized();
|
||||
has_exception_handler = method->has_exception_handler();
|
||||
is_native = method->is_native();
|
||||
@ -265,7 +265,7 @@ void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, i
|
||||
}
|
||||
st->print(" "); // more indent
|
||||
|
||||
if (method == NULL) {
|
||||
if (method == nullptr) {
|
||||
st->print("(method)");
|
||||
} else {
|
||||
method->print_short_name(st);
|
||||
@ -278,7 +278,7 @@ void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, i
|
||||
st->print(" (%d bytes)", method->code_size());
|
||||
}
|
||||
|
||||
if (msg != NULL) {
|
||||
if (msg != nullptr) {
|
||||
st->print(" %s", msg);
|
||||
}
|
||||
if (cr) {
|
||||
@ -305,7 +305,7 @@ void CompileTask::print_inline_indent(int inline_level, outputStream* st) {
|
||||
// CompileTask::print_compilation
|
||||
void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) {
|
||||
bool is_osr_method = osr_bci() != InvocationEntryBci;
|
||||
print_impl(st, is_unloaded() ? NULL : method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form, cr, _time_queued, _time_started);
|
||||
print_impl(st, is_unloaded() ? nullptr : method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form, cr, _time_queued, _time_started);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@ -344,7 +344,7 @@ void CompileTask::log_task_queued() {
|
||||
assert(_compile_reason > CompileTask::Reason_None && _compile_reason < CompileTask::Reason_Count, "Valid values");
|
||||
xtty->print(" comment='%s'", reason_name(_compile_reason));
|
||||
|
||||
if (_hot_method != NULL && _hot_method != _method) {
|
||||
if (_hot_method != nullptr && _hot_method != _method) {
|
||||
xtty->method(_hot_method);
|
||||
}
|
||||
if (_hot_count != 0) {
|
||||
@ -371,8 +371,8 @@ void CompileTask::log_task_done(CompileLog* log) {
|
||||
ResourceMark rm(thread);
|
||||
|
||||
if (!_is_success) {
|
||||
assert(_failure_reason != NULL, "missing");
|
||||
const char* reason = _failure_reason != NULL ? _failure_reason : "unknown";
|
||||
assert(_failure_reason != nullptr, "missing");
|
||||
const char* reason = _failure_reason != nullptr ? _failure_reason : "unknown";
|
||||
log->begin_elem("failure reason='");
|
||||
log->text("%s", reason);
|
||||
log->print("'");
|
||||
@ -446,7 +446,7 @@ void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int i
|
||||
else
|
||||
st->print(" (not loaded)");
|
||||
|
||||
if (msg != NULL) {
|
||||
if (msg != nullptr) {
|
||||
st->print(" %s", msg);
|
||||
}
|
||||
st->cr();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -108,7 +108,7 @@ class CompileTask : public CHeapObj<mtCompiler> {
|
||||
bool _failure_reason_on_C_heap;
|
||||
|
||||
public:
|
||||
CompileTask() : _failure_reason(NULL), _failure_reason_on_C_heap(false) {
|
||||
CompileTask() : _failure_reason(nullptr), _failure_reason_on_C_heap(false) {
|
||||
// May hold MethodCompileQueue_lock
|
||||
_lock = new Monitor(Mutex::safepoint-1, "CompileTask_lock");
|
||||
}
|
||||
@ -195,18 +195,18 @@ class CompileTask : public CHeapObj<mtCompiler> {
|
||||
private:
|
||||
static void print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
|
||||
bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false,
|
||||
const char* msg = NULL, bool short_form = false, bool cr = true,
|
||||
const char* msg = nullptr, bool short_form = false, bool cr = true,
|
||||
jlong time_queued = 0, jlong time_started = 0);
|
||||
|
||||
public:
|
||||
void print(outputStream* st = tty, const char* msg = NULL, bool short_form = false, bool cr = true);
|
||||
void print_ul(const char* msg = NULL);
|
||||
static void print(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true) {
|
||||
void print(outputStream* st = tty, const char* msg = nullptr, bool short_form = false, bool cr = true);
|
||||
void print_ul(const char* msg = nullptr);
|
||||
static void print(outputStream* st, const nmethod* nm, const char* msg = nullptr, bool short_form = false, bool cr = true) {
|
||||
print_impl(st, nm->method(), nm->compile_id(), nm->comp_level(),
|
||||
nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false,
|
||||
msg, short_form, cr);
|
||||
}
|
||||
static void print_ul(const nmethod* nm, const char* msg = NULL);
|
||||
static void print_ul(const nmethod* nm, const char* msg = nullptr);
|
||||
|
||||
static void print_inline_indent(int inline_level, outputStream* st = tty);
|
||||
|
||||
@ -225,11 +225,11 @@ public:
|
||||
|
||||
bool check_break_at_flags();
|
||||
|
||||
static void print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = NULL);
|
||||
static void print_inlining_tty(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
|
||||
static void print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = nullptr);
|
||||
static void print_inlining_tty(ciMethod* method, int inline_level, int bci, const char* msg = nullptr) {
|
||||
print_inlining_inner(tty, method, inline_level, bci, msg);
|
||||
}
|
||||
static void print_inlining_ul(ciMethod* method, int inline_level, int bci, const char* msg = NULL);
|
||||
static void print_inlining_ul(ciMethod* method, int inline_level, int bci, const char* msg = nullptr);
|
||||
};
|
||||
|
||||
#endif // SHARE_COMPILER_COMPILETASK_HPP
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -53,7 +53,7 @@ bool CompilationModeFlag::initialize() {
|
||||
_mode = Mode::NORMAL;
|
||||
// During parsing we want to be very careful not to use any methods of CompilerConfig that depend on
|
||||
// CompilationModeFlag.
|
||||
if (CompilationMode != NULL) {
|
||||
if (CompilationMode != nullptr) {
|
||||
if (strcmp(CompilationMode, "default") == 0 || strcmp(CompilationMode, "normal") == 0) {
|
||||
assert(_mode == Mode::NORMAL, "Precondition");
|
||||
} else if (strcmp(CompilationMode, "quick-only") == 0) {
|
||||
@ -325,7 +325,7 @@ void CompilerConfig::set_compilation_policy_flags() {
|
||||
}
|
||||
|
||||
if (CompileThresholdScaling < 0) {
|
||||
vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL);
|
||||
vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", nullptr);
|
||||
}
|
||||
|
||||
if (CompilationModeFlag::disable_intermediate()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -38,7 +38,7 @@ enum CompilerType : u1 {
|
||||
};
|
||||
|
||||
extern const char* compilertype2name_tab[compiler_number_of_types]; // Map CompilerType to its name
|
||||
inline const char* compilertype2name(CompilerType t) { return (uint)t < compiler_number_of_types ? compilertype2name_tab[t] : NULL; }
|
||||
inline const char* compilertype2name(CompilerType t) { return (uint)t < compiler_number_of_types ? compilertype2name_tab[t] : nullptr; }
|
||||
|
||||
// Handy constants for deciding which compiler mode to use.
|
||||
enum MethodCompilation {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,7 +34,7 @@
|
||||
#include "opto/phasetype.hpp"
|
||||
#include "runtime/globals_extension.hpp"
|
||||
|
||||
CompilerDirectives::CompilerDirectives() : _next(NULL), _match(NULL), _ref_count(0) {
|
||||
CompilerDirectives::CompilerDirectives() : _next(nullptr), _match(nullptr), _ref_count(0) {
|
||||
_c1_store = new DirectiveSet(this);
|
||||
_c1_store->init_control_intrinsic();
|
||||
_c2_store = new DirectiveSet(this);
|
||||
@ -42,16 +42,16 @@ CompilerDirectives::CompilerDirectives() : _next(NULL), _match(NULL), _ref_count
|
||||
};
|
||||
|
||||
CompilerDirectives::~CompilerDirectives() {
|
||||
if (_c1_store != NULL) {
|
||||
if (_c1_store != nullptr) {
|
||||
delete _c1_store;
|
||||
}
|
||||
if (_c2_store != NULL) {
|
||||
if (_c2_store != nullptr) {
|
||||
delete _c2_store;
|
||||
}
|
||||
|
||||
// remove all linked method matchers
|
||||
BasicMatcher* tmp = _match;
|
||||
while (tmp != NULL) {
|
||||
while (tmp != nullptr) {
|
||||
BasicMatcher* next = tmp->next();
|
||||
delete tmp;
|
||||
tmp = next;
|
||||
@ -60,7 +60,7 @@ CompilerDirectives::~CompilerDirectives() {
|
||||
|
||||
void CompilerDirectives::print(outputStream* st) {
|
||||
assert(DirectivesStack_lock->owned_by_self(), "");
|
||||
if (_match != NULL) {
|
||||
if (_match != nullptr) {
|
||||
st->cr();
|
||||
st->print("Directive:");
|
||||
if (is_default_directive()) {
|
||||
@ -71,7 +71,7 @@ void CompilerDirectives::print(outputStream* st) {
|
||||
st->print(" matching: ");
|
||||
_match->print(st);
|
||||
BasicMatcher* tmp = _match->next();
|
||||
while (tmp != NULL) {
|
||||
while (tmp != nullptr) {
|
||||
st->print(", ");
|
||||
tmp->print(st);
|
||||
tmp = tmp->next();
|
||||
@ -81,11 +81,11 @@ void CompilerDirectives::print(outputStream* st) {
|
||||
assert(0, "There should always be a match");
|
||||
}
|
||||
|
||||
if (_c1_store != NULL) {
|
||||
if (_c1_store != nullptr) {
|
||||
st->print_cr(" c1 directives:");
|
||||
_c1_store->print(st);
|
||||
}
|
||||
if (_c2_store != NULL) {
|
||||
if (_c2_store != nullptr) {
|
||||
st->cr();
|
||||
st->print_cr(" c2 directives:");
|
||||
_c2_store->print(st);
|
||||
@ -94,10 +94,10 @@ void CompilerDirectives::print(outputStream* st) {
|
||||
}
|
||||
|
||||
void CompilerDirectives::finalize(outputStream* st) {
|
||||
if (_c1_store != NULL) {
|
||||
if (_c1_store != nullptr) {
|
||||
_c1_store->finalize(st);
|
||||
}
|
||||
if (_c2_store != NULL) {
|
||||
if (_c2_store != nullptr) {
|
||||
_c2_store->finalize(st);
|
||||
}
|
||||
}
|
||||
@ -123,7 +123,7 @@ void DirectiveSet::finalize(outputStream* st) {
|
||||
// if any flag has been modified - set directive as enabled
|
||||
// unless it already has been explicitly set.
|
||||
if (!_modified[EnableIndex]) {
|
||||
if (_inlinematchers != NULL) {
|
||||
if (_inlinematchers != nullptr) {
|
||||
EnableOption = true;
|
||||
return;
|
||||
}
|
||||
@ -145,7 +145,7 @@ bool CompilerDirectives::match(const methodHandle& method) {
|
||||
if (is_default_directive()) {
|
||||
return true;
|
||||
}
|
||||
if (method == NULL) {
|
||||
if (method == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (_match->match(method)) {
|
||||
@ -156,8 +156,8 @@ bool CompilerDirectives::match(const methodHandle& method) {
|
||||
|
||||
bool CompilerDirectives::add_match(char* str, const char*& error_msg) {
|
||||
BasicMatcher* bm = BasicMatcher::parse_method_pattern(str, error_msg, false);
|
||||
if (bm == NULL) {
|
||||
assert(error_msg != NULL, "Must have error message");
|
||||
if (bm == nullptr) {
|
||||
assert(error_msg != nullptr, "Must have error message");
|
||||
return false;
|
||||
} else {
|
||||
bm->set_next(_match);
|
||||
@ -183,7 +183,7 @@ int CompilerDirectives::refcount() {
|
||||
|
||||
DirectiveSet* CompilerDirectives::get_for(AbstractCompiler *comp) {
|
||||
assert(DirectivesStack_lock->owned_by_self(), "");
|
||||
if (comp == NULL) { // Xint
|
||||
if (comp == nullptr) { // Xint
|
||||
return _c1_store;
|
||||
} else if (comp->is_c2()) {
|
||||
return _c2_store;
|
||||
@ -241,7 +241,7 @@ ControlIntrinsicIter::~ControlIntrinsicIter() {
|
||||
|
||||
// pre-increment
|
||||
ControlIntrinsicIter& ControlIntrinsicIter::operator++() {
|
||||
_token = strtok_r(NULL, ",", &_saved_ptr);
|
||||
_token = strtok_r(nullptr, ",", &_saved_ptr);
|
||||
next_token();
|
||||
return *this;
|
||||
}
|
||||
@ -260,7 +260,7 @@ void ControlIntrinsicIter::next_token() {
|
||||
}
|
||||
|
||||
void DirectiveSet::init_control_intrinsic() {
|
||||
for (ControlIntrinsicIter iter(ControlIntrinsic); *iter != NULL; ++iter) {
|
||||
for (ControlIntrinsicIter iter(ControlIntrinsic); *iter != nullptr; ++iter) {
|
||||
vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
|
||||
|
||||
if (id != vmIntrinsics::_none) {
|
||||
@ -269,7 +269,7 @@ void DirectiveSet::init_control_intrinsic() {
|
||||
}
|
||||
|
||||
// Order matters, DisableIntrinsic can overwrite ControlIntrinsic
|
||||
for (ControlIntrinsicIter iter(DisableIntrinsic, true/*disable_all*/); *iter != NULL; ++iter) {
|
||||
for (ControlIntrinsicIter iter(DisableIntrinsic, true/*disable_all*/); *iter != nullptr; ++iter) {
|
||||
vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
|
||||
|
||||
if (id != vmIntrinsics::_none) {
|
||||
@ -278,7 +278,7 @@ void DirectiveSet::init_control_intrinsic() {
|
||||
}
|
||||
}
|
||||
|
||||
DirectiveSet::DirectiveSet(CompilerDirectives* d) :_inlinematchers(NULL), _directive(d) {
|
||||
DirectiveSet::DirectiveSet(CompilerDirectives* d) :_inlinematchers(nullptr), _directive(d) {
|
||||
#define init_defaults_definition(name, type, dvalue, compiler) this->name##Option = dvalue;
|
||||
_ideal_phase_name_mask = 0;
|
||||
compilerdirectives_common_flags(init_defaults_definition)
|
||||
@ -291,7 +291,7 @@ DirectiveSet::DirectiveSet(CompilerDirectives* d) :_inlinematchers(NULL), _direc
|
||||
DirectiveSet::~DirectiveSet() {
|
||||
// remove all linked methodmatchers
|
||||
InlineMatcher* tmp = _inlinematchers;
|
||||
while (tmp != NULL) {
|
||||
while (tmp != nullptr) {
|
||||
InlineMatcher* next = tmp->next();
|
||||
delete tmp;
|
||||
tmp = next;
|
||||
@ -315,7 +315,7 @@ class DirectiveSetPtr {
|
||||
|
||||
public:
|
||||
DirectiveSetPtr(DirectiveSet* origin): _origin(origin), _clone(nullptr) {
|
||||
assert(origin != nullptr, "DirectiveSetPtr cannot be initialized with a NULL pointer.");
|
||||
assert(origin != nullptr, "DirectiveSetPtr cannot be initialized with a nullptr pointer.");
|
||||
}
|
||||
|
||||
DirectiveSet const* operator->() {
|
||||
@ -431,7 +431,7 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
|
||||
need_reset = false;
|
||||
}
|
||||
|
||||
while (*iter != NULL) {
|
||||
while (*iter != nullptr) {
|
||||
vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
|
||||
if (id != vmIntrinsics::_none) {
|
||||
set.cloned()->_intrinsic_control_words[vmIntrinsics::as_int(id)] = iter.is_enabled();
|
||||
@ -451,7 +451,7 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
|
||||
need_reset = false;
|
||||
}
|
||||
|
||||
while (*iter != NULL) {
|
||||
while (*iter != nullptr) {
|
||||
vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
|
||||
if (id != vmIntrinsics::_none) {
|
||||
set.cloned()->_intrinsic_control_words[vmIntrinsics::as_int(id)] = false;
|
||||
@ -468,12 +468,12 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
|
||||
}
|
||||
|
||||
CompilerDirectives* DirectiveSet::directive() {
|
||||
assert(_directive != NULL, "Must have been initialized");
|
||||
assert(_directive != nullptr, "Must have been initialized");
|
||||
return _directive;
|
||||
}
|
||||
|
||||
bool DirectiveSet::matches_inline(const methodHandle& method, int inline_action) {
|
||||
if (_inlinematchers != NULL) {
|
||||
if (_inlinematchers != nullptr) {
|
||||
if (_inlinematchers->match(method, inline_action)) {
|
||||
return true;
|
||||
}
|
||||
@ -486,7 +486,7 @@ bool DirectiveSet::should_inline(ciMethod* inlinee) {
|
||||
VM_ENTRY_MARK;
|
||||
methodHandle mh(THREAD, inlinee->get_Method());
|
||||
|
||||
if (_inlinematchers != NULL) {
|
||||
if (_inlinematchers != nullptr) {
|
||||
return matches_inline(mh, InlineMatcher::force_inline);
|
||||
}
|
||||
if (!CompilerDirectivesIgnoreCompileCommandsOption) {
|
||||
@ -500,7 +500,7 @@ bool DirectiveSet::should_not_inline(ciMethod* inlinee) {
|
||||
VM_ENTRY_MARK;
|
||||
methodHandle mh(THREAD, inlinee->get_Method());
|
||||
|
||||
if (_inlinematchers != NULL) {
|
||||
if (_inlinematchers != nullptr) {
|
||||
return matches_inline(mh, InlineMatcher::dont_inline);
|
||||
}
|
||||
if (!CompilerDirectivesIgnoreCompileCommandsOption) {
|
||||
@ -511,36 +511,36 @@ bool DirectiveSet::should_not_inline(ciMethod* inlinee) {
|
||||
|
||||
bool DirectiveSet::parse_and_add_inline(char* str, const char*& error_msg) {
|
||||
InlineMatcher* m = InlineMatcher::parse_inline_pattern(str, error_msg);
|
||||
if (m != NULL) {
|
||||
if (m != nullptr) {
|
||||
// add matcher last in chain - the order is significant
|
||||
append_inline(m);
|
||||
return true;
|
||||
} else {
|
||||
assert(error_msg != NULL, "Error message must be set");
|
||||
assert(error_msg != nullptr, "Error message must be set");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DirectiveSet::append_inline(InlineMatcher* m) {
|
||||
if (_inlinematchers == NULL) {
|
||||
if (_inlinematchers == nullptr) {
|
||||
_inlinematchers = m;
|
||||
return;
|
||||
}
|
||||
InlineMatcher* tmp = _inlinematchers;
|
||||
while (tmp->next() != NULL) {
|
||||
while (tmp->next() != nullptr) {
|
||||
tmp = tmp->next();
|
||||
}
|
||||
tmp->set_next(m);
|
||||
}
|
||||
|
||||
void DirectiveSet::print_inline(outputStream* st) {
|
||||
if (_inlinematchers == NULL) {
|
||||
if (_inlinematchers == nullptr) {
|
||||
st->print_cr(" inline: -");
|
||||
} else {
|
||||
st->print(" inline: ");
|
||||
_inlinematchers->print(st);
|
||||
InlineMatcher* tmp = _inlinematchers->next();
|
||||
while (tmp != NULL) {
|
||||
while (tmp != nullptr) {
|
||||
st->print(", ");
|
||||
tmp->print(st);
|
||||
tmp = tmp->next();
|
||||
@ -562,7 +562,7 @@ bool DirectiveSet::is_intrinsic_disabled(const methodHandle& method) {
|
||||
}
|
||||
|
||||
DirectiveSet* DirectiveSet::clone(DirectiveSet const* src) {
|
||||
DirectiveSet* set = new DirectiveSet(NULL);
|
||||
DirectiveSet* set = new DirectiveSet(nullptr);
|
||||
// Ordinary allocations of DirectiveSet would call init_control_intrinsic()
|
||||
// immediately to create a new copy for set->Control/DisableIntrinsicOption.
|
||||
// However, here it does not need to because the code below creates
|
||||
@ -572,7 +572,7 @@ DirectiveSet* DirectiveSet::clone(DirectiveSet const* src) {
|
||||
memcpy(set->_modified, src->_modified, sizeof(src->_modified));
|
||||
|
||||
InlineMatcher* tmp = src->_inlinematchers;
|
||||
while (tmp != NULL) {
|
||||
while (tmp != nullptr) {
|
||||
set->append_inline(tmp->clone());
|
||||
tmp = tmp->next();
|
||||
}
|
||||
@ -591,7 +591,7 @@ DirectiveSet* DirectiveSet::clone(DirectiveSet const* src) {
|
||||
void DirectivesStack::init() {
|
||||
CompilerDirectives* _default_directives = new CompilerDirectives();
|
||||
char str[] = "*.*";
|
||||
const char* error_msg = NULL;
|
||||
const char* error_msg = nullptr;
|
||||
_default_directives->add_match(str, error_msg);
|
||||
#if defined(COMPILER1) || INCLUDE_JVMCI
|
||||
_default_directives->_c1_store->EnableOption = true;
|
||||
@ -601,14 +601,14 @@ void DirectivesStack::init() {
|
||||
_default_directives->_c2_store->EnableOption = true;
|
||||
}
|
||||
#endif
|
||||
assert(error_msg == NULL, "Must succeed.");
|
||||
assert(error_msg == nullptr, "Must succeed.");
|
||||
push(_default_directives);
|
||||
}
|
||||
|
||||
DirectiveSet* DirectivesStack::getDefaultDirective(AbstractCompiler* comp) {
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
assert(_bottom != NULL, "Must never be empty");
|
||||
assert(_bottom != nullptr, "Must never be empty");
|
||||
_bottom->inc_refcount();
|
||||
return _bottom->get_for(comp);
|
||||
}
|
||||
@ -617,8 +617,8 @@ void DirectivesStack::push(CompilerDirectives* directive) {
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
directive->inc_refcount();
|
||||
if (_top == NULL) {
|
||||
assert(_bottom == NULL, "There can only be one default directive");
|
||||
if (_top == nullptr) {
|
||||
assert(_bottom == nullptr, "There can only be one default directive");
|
||||
_bottom = directive; // default directive, can never be removed.
|
||||
}
|
||||
|
||||
@ -638,7 +638,7 @@ void DirectivesStack::pop(int count) {
|
||||
void DirectivesStack::pop_inner() {
|
||||
assert(DirectivesStack_lock->owned_by_self(), "");
|
||||
|
||||
if (_top->next() == NULL) {
|
||||
if (_top->next() == nullptr) {
|
||||
return; // Do nothing - don't allow an empty stack
|
||||
}
|
||||
CompilerDirectives* tmp = _top;
|
||||
@ -659,7 +659,7 @@ bool DirectivesStack::check_capacity(int request_size, outputStream* st) {
|
||||
void DirectivesStack::clear() {
|
||||
// holding the lock during the whole operation ensuring consistent result
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
while (_top->next() != NULL) {
|
||||
while (_top->next() != nullptr) {
|
||||
pop_inner();
|
||||
}
|
||||
}
|
||||
@ -667,7 +667,7 @@ void DirectivesStack::clear() {
|
||||
void DirectivesStack::print(outputStream* st) {
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
CompilerDirectives* tmp = _top;
|
||||
while (tmp != NULL) {
|
||||
while (tmp != nullptr) {
|
||||
tmp->print(st);
|
||||
tmp = tmp->next();
|
||||
st->cr();
|
||||
@ -675,13 +675,13 @@ void DirectivesStack::print(outputStream* st) {
|
||||
}
|
||||
|
||||
void DirectivesStack::release(DirectiveSet* set) {
|
||||
assert(set != NULL, "Never NULL");
|
||||
assert(set != nullptr, "Never nullptr");
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (set->is_exclusive_copy()) {
|
||||
// Old CompilecCmmands forced us to create an exclusive copy
|
||||
delete set;
|
||||
} else {
|
||||
assert(set->directive() != NULL, "Never NULL");
|
||||
assert(set->directive() != nullptr, "Never nullptr");
|
||||
release(set->directive());
|
||||
}
|
||||
}
|
||||
@ -698,17 +698,17 @@ void DirectivesStack::release(CompilerDirectives* dir) {
|
||||
DirectiveSet* DirectivesStack::getMatchingDirective(const methodHandle& method, AbstractCompiler *comp) {
|
||||
assert(_depth > 0, "Must never be empty");
|
||||
|
||||
DirectiveSet* match = NULL;
|
||||
DirectiveSet* match = nullptr;
|
||||
{
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
CompilerDirectives* dir = _top;
|
||||
assert(dir != NULL, "Must be initialized");
|
||||
assert(dir != nullptr, "Must be initialized");
|
||||
|
||||
while (dir != NULL) {
|
||||
while (dir != nullptr) {
|
||||
if (dir->is_default_directive() || dir->match(method)) {
|
||||
match = dir->get_for(comp);
|
||||
assert(match != NULL, "Consistency");
|
||||
assert(match != nullptr, "Consistency");
|
||||
if (match->EnableOption) {
|
||||
// The directiveSet for this compile is also enabled -> success
|
||||
dir->inc_refcount();
|
||||
@ -718,7 +718,7 @@ DirectiveSet* DirectivesStack::getMatchingDirective(const methodHandle& method,
|
||||
dir = dir->next();
|
||||
}
|
||||
}
|
||||
guarantee(match != NULL, "There should always be a default directive that matches");
|
||||
guarantee(match != nullptr, "There should always be a default directive that matches");
|
||||
|
||||
// Check for legacy compile commands update, without DirectivesStack_lock
|
||||
return match->compilecommand_compatibility_init(method);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -123,7 +123,7 @@ public:
|
||||
bool should_not_inline(ciMethod* inlinee);
|
||||
void print_inline(outputStream* st);
|
||||
DirectiveSet* compilecommand_compatibility_init(const methodHandle& method);
|
||||
bool is_exclusive_copy() { return _directive == NULL; }
|
||||
bool is_exclusive_copy() { return _directive == nullptr; }
|
||||
bool matches_inline(const methodHandle& method, int inline_action);
|
||||
static DirectiveSet* clone(DirectiveSet const* src);
|
||||
bool is_intrinsic_disabled(const methodHandle& method);
|
||||
@ -206,11 +206,11 @@ class ControlIntrinsicValidator {
|
||||
|
||||
public:
|
||||
ControlIntrinsicValidator(ccstrlist option, bool disable_all) : _valid(true), _bad(nullptr) {
|
||||
for (ControlIntrinsicIter iter(option, disable_all); *iter != NULL && _valid; ++iter) {
|
||||
for (ControlIntrinsicIter iter(option, disable_all); *iter != nullptr && _valid; ++iter) {
|
||||
if (vmIntrinsics::_none == vmIntrinsics::find_id(*iter)) {
|
||||
const size_t len = MIN2<size_t>(strlen(*iter), 63) + 1; // cap len to a value we know is enough for all intrinsic names
|
||||
_bad = NEW_C_HEAP_ARRAY(char, len, mtCompiler);
|
||||
// strncpy always writes len characters. If the source string is shorter, the function fills the remaining bytes with NULLs.
|
||||
// strncpy always writes len characters. If the source string is shorter, the function fills the remaining bytes with nullptrs.
|
||||
strncpy(_bad, *iter, len);
|
||||
_valid = false;
|
||||
}
|
||||
@ -218,7 +218,7 @@ class ControlIntrinsicValidator {
|
||||
}
|
||||
|
||||
~ControlIntrinsicValidator() {
|
||||
if (_bad != NULL) {
|
||||
if (_bad != nullptr) {
|
||||
FREE_C_HEAP_ARRAY(char, _bad);
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ public:
|
||||
bool add_match(char* str, const char*& error_msg);
|
||||
DirectiveSet* get_for(AbstractCompiler *comp);
|
||||
void print(outputStream* st);
|
||||
bool is_default_directive() { return _next == NULL; }
|
||||
bool is_default_directive() { return _next == nullptr; }
|
||||
void finalize(outputStream* st);
|
||||
|
||||
void inc_refcount();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,13 +57,13 @@ class PhaseTypeGuard : public StackObj {
|
||||
Semaphore PhaseTypeGuard::_mutex_semaphore(1);
|
||||
|
||||
// Table for mapping compiler phases names to int identifiers.
|
||||
static GrowableArray<const char*>* phase_names = NULL;
|
||||
static GrowableArray<const char*>* phase_names = nullptr;
|
||||
|
||||
class CompilerPhaseTypeConstant : public JfrSerializer {
|
||||
public:
|
||||
void serialize(JfrCheckpointWriter& writer) {
|
||||
PhaseTypeGuard guard;
|
||||
assert(phase_names != NULL, "invariant");
|
||||
assert(phase_names != nullptr, "invariant");
|
||||
assert(phase_names->is_nonempty(), "invariant");
|
||||
const u4 nof_entries = phase_names->length();
|
||||
writer.write_count(nof_entries);
|
||||
@ -89,7 +89,7 @@ int CompilerEvent::PhaseEvent::get_phase_id(const char* phase_name, bool may_exi
|
||||
bool register_jfr_serializer = false;
|
||||
{
|
||||
PhaseTypeGuard guard(sync);
|
||||
if (phase_names == NULL) {
|
||||
if (phase_names == nullptr) {
|
||||
phase_names = new (mtInternal) GrowableArray<const char*>(100, mtCompiler);
|
||||
register_jfr_serializer = true;
|
||||
} else if (may_exist) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -99,7 +99,7 @@ template<> OptionType get_type_for<double>() {
|
||||
class MethodMatcher;
|
||||
class TypedMethodOptionMatcher;
|
||||
|
||||
static TypedMethodOptionMatcher* option_list = NULL;
|
||||
static TypedMethodOptionMatcher* option_list = nullptr;
|
||||
static bool any_set = false;
|
||||
|
||||
// A filter for quick lookup if an option is set
|
||||
@ -136,7 +136,7 @@ class TypedMethodOptionMatcher : public MethodMatcher {
|
||||
} _u;
|
||||
|
||||
TypedMethodOptionMatcher() : MethodMatcher(),
|
||||
_next(NULL),
|
||||
_next(nullptr),
|
||||
_option(CompileCommand::Unknown) {
|
||||
memset(&_u, 0, sizeof(_u));
|
||||
}
|
||||
@ -236,7 +236,7 @@ void TypedMethodOptionMatcher::print() {
|
||||
|
||||
void TypedMethodOptionMatcher::print_all() {
|
||||
print();
|
||||
if (_next != NULL) {
|
||||
if (_next != nullptr) {
|
||||
tty->print(" ");
|
||||
_next->print_all();
|
||||
}
|
||||
@ -250,13 +250,13 @@ TypedMethodOptionMatcher* TypedMethodOptionMatcher::clone() {
|
||||
m->_method_name = _method_name;
|
||||
m->_signature = _signature;
|
||||
// Need to ref count the symbols
|
||||
if (_class_name != NULL) {
|
||||
if (_class_name != nullptr) {
|
||||
_class_name->increment_refcount();
|
||||
}
|
||||
if (_method_name != NULL) {
|
||||
if (_method_name != nullptr) {
|
||||
_method_name->increment_refcount();
|
||||
}
|
||||
if (_signature != NULL) {
|
||||
if (_signature != nullptr) {
|
||||
_signature->increment_refcount();
|
||||
}
|
||||
return m;
|
||||
@ -272,20 +272,20 @@ TypedMethodOptionMatcher::~TypedMethodOptionMatcher() {
|
||||
|
||||
TypedMethodOptionMatcher* TypedMethodOptionMatcher::parse_method_pattern(char*& line, char* errorbuf, const int buf_size) {
|
||||
assert(*errorbuf == '\0', "Dont call here with error_msg already set");
|
||||
const char* error_msg = NULL;
|
||||
const char* error_msg = nullptr;
|
||||
TypedMethodOptionMatcher* tom = new TypedMethodOptionMatcher();
|
||||
MethodMatcher::parse_method_pattern(line, error_msg, tom);
|
||||
if (error_msg != NULL) {
|
||||
if (error_msg != nullptr) {
|
||||
jio_snprintf(errorbuf, buf_size, error_msg);
|
||||
delete tom;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return tom;
|
||||
}
|
||||
|
||||
TypedMethodOptionMatcher* TypedMethodOptionMatcher::match(const methodHandle& method, enum CompileCommand option) {
|
||||
TypedMethodOptionMatcher* current = this;
|
||||
while (current != NULL) {
|
||||
while (current != nullptr) {
|
||||
if (current->_option == option) {
|
||||
if (current->matches(method)) {
|
||||
return current;
|
||||
@ -293,7 +293,7 @@ TypedMethodOptionMatcher* TypedMethodOptionMatcher::match(const methodHandle& me
|
||||
}
|
||||
current = current->next();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -332,9 +332,9 @@ bool CompilerOracle::has_option_value(const methodHandle& method, enum CompileCo
|
||||
if (!has_command(option)) {
|
||||
return false;
|
||||
}
|
||||
if (option_list != NULL) {
|
||||
if (option_list != nullptr) {
|
||||
TypedMethodOptionMatcher* m = option_list->match(method, option);
|
||||
if (m != NULL) {
|
||||
if (m != nullptr) {
|
||||
value = m->value<T>();
|
||||
return true;
|
||||
}
|
||||
@ -355,7 +355,7 @@ static bool resolve_inlining_predicate(enum CompileCommand option, const methodH
|
||||
// option_list lists options in reverse order. So the first option we find is the last which was specified.
|
||||
enum CompileCommand last_one = CompileCommand::Unknown;
|
||||
TypedMethodOptionMatcher* current = option_list;
|
||||
while (current != NULL) {
|
||||
while (current != nullptr) {
|
||||
last_one = current->option();
|
||||
if (last_one == CompileCommand::Inline || last_one == CompileCommand::DontInline) {
|
||||
if (current->matches(method)) {
|
||||
@ -749,7 +749,7 @@ static void scan_value(enum OptionType type, char* line, int& total_bytes_read,
|
||||
}
|
||||
}
|
||||
|
||||
// Scan next option and value in line, return MethodMatcher object on success, NULL on failure.
|
||||
// Scan next option and value in line, return MethodMatcher object on success, nullptr on failure.
|
||||
// On failure, error_msg contains description for the first error.
|
||||
// For future extensions: set error_msg on first error.
|
||||
static void scan_option_and_value(enum OptionType type, char* line, int& total_bytes_read,
|
||||
@ -852,7 +852,7 @@ void CompilerOracle::parse_from_line(char* line) {
|
||||
char option_type[256]; // stores option for Type (1) and type of Type (2)
|
||||
skip_comma(line);
|
||||
TypedMethodOptionMatcher* archetype = TypedMethodOptionMatcher::parse_method_pattern(line, error_buf, sizeof(error_buf));
|
||||
if (archetype == NULL) {
|
||||
if (archetype == nullptr) {
|
||||
print_parse_error(error_buf, original.get());
|
||||
return;
|
||||
}
|
||||
@ -891,7 +891,7 @@ void CompilerOracle::parse_from_line(char* line) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
assert(typed_matcher != NULL, "sanity");
|
||||
assert(typed_matcher != nullptr, "sanity");
|
||||
assert(*error_buf == '\0', "No error here");
|
||||
skip_whitespace(line);
|
||||
} // while(
|
||||
@ -905,7 +905,7 @@ void CompilerOracle::parse_from_line(char* line) {
|
||||
int bytes_read = 0;
|
||||
skip_comma(line);
|
||||
TypedMethodOptionMatcher* matcher = TypedMethodOptionMatcher::parse_method_pattern(line, error_buf, sizeof(error_buf));
|
||||
if (matcher == NULL) {
|
||||
if (matcher == nullptr) {
|
||||
print_parse_error(error_buf, original.get());
|
||||
return;
|
||||
}
|
||||
@ -926,7 +926,7 @@ void CompilerOracle::parse_from_line(char* line) {
|
||||
print_parse_error(error_buf, original.get());
|
||||
return;
|
||||
}
|
||||
assert(matcher != NULL, "consistency");
|
||||
assert(matcher != nullptr, "consistency");
|
||||
}
|
||||
}
|
||||
|
||||
@ -934,14 +934,14 @@ static const char* default_cc_file = ".hotspot_compiler";
|
||||
|
||||
static const char* cc_file() {
|
||||
#ifdef ASSERT
|
||||
if (CompileCommandFile == NULL)
|
||||
if (CompileCommandFile == nullptr)
|
||||
return default_cc_file;
|
||||
#endif
|
||||
return CompileCommandFile;
|
||||
}
|
||||
|
||||
bool CompilerOracle::has_command_file() {
|
||||
return cc_file() != NULL;
|
||||
return cc_file() != nullptr;
|
||||
}
|
||||
|
||||
bool CompilerOracle::_quiet = false;
|
||||
@ -949,7 +949,7 @@ bool CompilerOracle::_quiet = false;
|
||||
void CompilerOracle::parse_from_file() {
|
||||
assert(has_command_file(), "command file must be specified");
|
||||
FILE* stream = os::fopen(cc_file(), "rt");
|
||||
if (stream == NULL) return;
|
||||
if (stream == nullptr) return;
|
||||
|
||||
char token[1024];
|
||||
int pos = 0;
|
||||
@ -1012,10 +1012,10 @@ void compilerOracle_init() {
|
||||
void CompilerOracle::parse_compile_only(char* line) {
|
||||
int i;
|
||||
char name[1024];
|
||||
const char* className = NULL;
|
||||
const char* methodName = NULL;
|
||||
const char* className = nullptr;
|
||||
const char* methodName = nullptr;
|
||||
|
||||
bool have_colon = (strstr(line, "::") != NULL);
|
||||
bool have_colon = (strstr(line, "::") != nullptr);
|
||||
char method_sep = have_colon ? ':' : '.';
|
||||
|
||||
if (Verbose) {
|
||||
@ -1036,12 +1036,12 @@ void CompilerOracle::parse_compile_only(char* line) {
|
||||
|
||||
if (i > 0) {
|
||||
char* newName = NEW_RESOURCE_ARRAY( char, i + 1);
|
||||
if (newName == NULL)
|
||||
if (newName == nullptr)
|
||||
return;
|
||||
strncpy(newName, name, i);
|
||||
newName[i] = '\0';
|
||||
|
||||
if (className == NULL) {
|
||||
if (className == nullptr) {
|
||||
className = newName;
|
||||
} else {
|
||||
methodName = newName;
|
||||
@ -1049,13 +1049,13 @@ void CompilerOracle::parse_compile_only(char* line) {
|
||||
}
|
||||
|
||||
if (*line == method_sep) {
|
||||
if (className == NULL) {
|
||||
if (className == nullptr) {
|
||||
className = "";
|
||||
c_match = MethodMatcher::Any;
|
||||
}
|
||||
} else {
|
||||
// got foo or foo/bar
|
||||
if (className == NULL) {
|
||||
if (className == nullptr) {
|
||||
ShouldNotReachHere();
|
||||
} else {
|
||||
// missing class name handled as "Any" class match
|
||||
@ -1067,7 +1067,7 @@ void CompilerOracle::parse_compile_only(char* line) {
|
||||
|
||||
// each directive is terminated by , or NUL or . followed by NUL
|
||||
if (*line == ',' || *line == '\0' || (line[0] == '.' && line[1] == '\0')) {
|
||||
if (methodName == NULL) {
|
||||
if (methodName == nullptr) {
|
||||
methodName = "";
|
||||
if (*line != method_sep) {
|
||||
m_match = MethodMatcher::Any;
|
||||
@ -1077,7 +1077,7 @@ void CompilerOracle::parse_compile_only(char* line) {
|
||||
EXCEPTION_MARK;
|
||||
Symbol* c_name = SymbolTable::new_symbol(className);
|
||||
Symbol* m_name = SymbolTable::new_symbol(methodName);
|
||||
Symbol* signature = NULL;
|
||||
Symbol* signature = nullptr;
|
||||
|
||||
TypedMethodOptionMatcher* tom = new TypedMethodOptionMatcher();
|
||||
tom->init_matcher(c_name, c_match, m_name, m_match, signature);
|
||||
@ -1087,8 +1087,8 @@ void CompilerOracle::parse_compile_only(char* line) {
|
||||
tom->print();
|
||||
}
|
||||
|
||||
className = NULL;
|
||||
methodName = NULL;
|
||||
className = nullptr;
|
||||
methodName = nullptr;
|
||||
}
|
||||
|
||||
line = *line == '\0' ? line : line + 1;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,19 +32,19 @@
|
||||
CompilerThread::CompilerThread(CompileQueue* queue,
|
||||
CompilerCounters* counters)
|
||||
: JavaThread(&CompilerThread::thread_entry) {
|
||||
_env = NULL;
|
||||
_log = NULL;
|
||||
_task = NULL;
|
||||
_env = nullptr;
|
||||
_log = nullptr;
|
||||
_task = nullptr;
|
||||
_queue = queue;
|
||||
_counters = counters;
|
||||
_buffer_blob = NULL;
|
||||
_compiler = NULL;
|
||||
_buffer_blob = nullptr;
|
||||
_compiler = nullptr;
|
||||
|
||||
// Compiler uses resource area for compilation, let's bias it to mtCompiler
|
||||
resource_area()->bias_to(mtCompiler);
|
||||
|
||||
#ifndef PRODUCT
|
||||
_ideal_graph_printer = NULL;
|
||||
_ideal_graph_printer = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -59,5 +59,5 @@ void CompilerThread::thread_entry(JavaThread* thread, TRAPS) {
|
||||
}
|
||||
|
||||
bool CompilerThread::can_call_java() const {
|
||||
return _compiler != NULL && _compiler->is_jvmci();
|
||||
return _compiler != nullptr && _compiler->is_jvmci();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,7 +92,7 @@ class CompilerThread : public JavaThread {
|
||||
CompileLog* log() { return _log; }
|
||||
void init_log(CompileLog* log) {
|
||||
// Set once, for good.
|
||||
assert(_log == NULL, "set only once");
|
||||
assert(_log == nullptr, "set only once");
|
||||
_log = log;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -296,10 +296,10 @@
|
||||
product(ccstrlist, CompileOnly, "", \
|
||||
"List of methods (pkg/class.name) to restrict compilation to") \
|
||||
\
|
||||
product(ccstr, CompileCommandFile, NULL, \
|
||||
product(ccstr, CompileCommandFile, nullptr, \
|
||||
"Read compiler commands from this file [.hotspot_compiler]") \
|
||||
\
|
||||
product(ccstr, CompilerDirectivesFile, NULL, DIAGNOSTIC, \
|
||||
product(ccstr, CompilerDirectivesFile, nullptr, DIAGNOSTIC, \
|
||||
"Read compiler directives from this file") \
|
||||
\
|
||||
product(ccstrlist, CompileCommand, "", \
|
||||
@ -311,11 +311,11 @@
|
||||
product(bool, ReplayReduce, false, EXPERIMENTAL, \
|
||||
"Enable features to facilitate replay file reduction") \
|
||||
\
|
||||
product(ccstr, ReplayDataFile, NULL, \
|
||||
product(ccstr, ReplayDataFile, nullptr, \
|
||||
"File containing compilation replay information" \
|
||||
"[default: ./replay_pid%p.log] (%p replaced with pid)") \
|
||||
\
|
||||
product(ccstr, InlineDataFile, NULL, \
|
||||
product(ccstr, InlineDataFile, nullptr, \
|
||||
"File containing inlining replay information" \
|
||||
"[default: ./inline_pid%p.log] (%p replaced with pid)") \
|
||||
\
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -38,19 +38,19 @@ void DirectivesParser::push_tmp(CompilerDirectives* dir) {
|
||||
}
|
||||
|
||||
CompilerDirectives* DirectivesParser::pop_tmp() {
|
||||
if (_tmp_top == NULL) {
|
||||
return NULL;
|
||||
if (_tmp_top == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
CompilerDirectives* tmp = _tmp_top;
|
||||
_tmp_top = _tmp_top->next();
|
||||
tmp->set_next(NULL);
|
||||
tmp->set_next(nullptr);
|
||||
_tmp_depth--;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void DirectivesParser::clean_tmp() {
|
||||
CompilerDirectives* tmp = pop_tmp();
|
||||
while (tmp != NULL) {
|
||||
while (tmp != nullptr) {
|
||||
delete tmp;
|
||||
tmp = pop_tmp();
|
||||
}
|
||||
@ -70,7 +70,7 @@ int DirectivesParser::parse_string(const char* text, outputStream* st) {
|
||||
}
|
||||
|
||||
bool DirectivesParser::has_file() {
|
||||
return CompilerDirectivesFile != NULL;
|
||||
return CompilerDirectivesFile != nullptr;
|
||||
}
|
||||
|
||||
bool DirectivesParser::parse_from_flag() {
|
||||
@ -78,7 +78,7 @@ bool DirectivesParser::parse_from_flag() {
|
||||
}
|
||||
|
||||
bool DirectivesParser::parse_from_file(const char* filename, outputStream* st) {
|
||||
assert(filename != NULL, "Test before calling this");
|
||||
assert(filename != nullptr, "Test before calling this");
|
||||
if (!parse_from_file_inner(filename, st)) {
|
||||
st->print_cr("Could not load file: %s", filename);
|
||||
return false;
|
||||
@ -116,7 +116,7 @@ int DirectivesParser::install_directives() {
|
||||
// Pop from internal temporary stack and push to compileBroker.
|
||||
CompilerDirectives* tmp = pop_tmp();
|
||||
int i = 0;
|
||||
while (tmp != NULL) {
|
||||
while (tmp != nullptr) {
|
||||
i++;
|
||||
DirectivesStack::push(tmp);
|
||||
tmp = pop_tmp();
|
||||
@ -135,7 +135,7 @@ int DirectivesParser::install_directives() {
|
||||
}
|
||||
|
||||
DirectivesParser::DirectivesParser(const char* text, outputStream* st, bool silent)
|
||||
: JSON(text, silent, st), depth(0), current_directive(NULL), current_directiveset(NULL), _tmp_top(NULL), _tmp_depth(0) {
|
||||
: JSON(text, silent, st), depth(0), current_directive(nullptr), current_directiveset(nullptr), _tmp_top(nullptr), _tmp_depth(0) {
|
||||
#ifndef PRODUCT
|
||||
memset(stack, 0, MAX_DEPTH * sizeof(stack[0]));
|
||||
#endif
|
||||
@ -143,16 +143,16 @@ DirectivesParser::DirectivesParser(const char* text, outputStream* st, bool sile
|
||||
}
|
||||
|
||||
DirectivesParser::~DirectivesParser() {
|
||||
assert(_tmp_top == NULL, "Consistency");
|
||||
assert(_tmp_top == nullptr, "Consistency");
|
||||
assert(_tmp_depth == 0, "Consistency");
|
||||
}
|
||||
|
||||
const DirectivesParser::key DirectivesParser::keys[] = {
|
||||
// name, keytype, allow_array, allowed_mask, set_function
|
||||
{ "c1", type_c1, 0, mask(type_directives), NULL, UnknownFlagType },
|
||||
{ "c2", type_c2, 0, mask(type_directives), NULL, UnknownFlagType },
|
||||
{ "match", type_match, 1, mask(type_directives), NULL, UnknownFlagType },
|
||||
{ "inline", type_inline, 1, mask(type_directives) | mask(type_c1) | mask(type_c2), NULL, UnknownFlagType },
|
||||
{ "c1", type_c1, 0, mask(type_directives), nullptr, UnknownFlagType },
|
||||
{ "c2", type_c2, 0, mask(type_directives), nullptr, UnknownFlagType },
|
||||
{ "match", type_match, 1, mask(type_directives), nullptr, UnknownFlagType },
|
||||
{ "inline", type_inline, 1, mask(type_directives) | mask(type_c1) | mask(type_c2), nullptr, UnknownFlagType },
|
||||
|
||||
// Global flags
|
||||
#define common_flag_key(name, type, dvalue, compiler) \
|
||||
@ -179,7 +179,7 @@ const DirectivesParser::key* DirectivesParser::lookup_key(const char* str, size_
|
||||
return &keys[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint DirectivesParser::mask(keytype kt) {
|
||||
@ -190,7 +190,7 @@ bool DirectivesParser::push_key(const char* str, size_t len) {
|
||||
bool result = true;
|
||||
const key* k = lookup_key(str, len);
|
||||
|
||||
if (k == NULL) {
|
||||
if (k == nullptr) {
|
||||
// os::strdup
|
||||
char* s = NEW_C_HEAP_ARRAY(char, len + 1, mtCompiler);
|
||||
strncpy(s, str, len);
|
||||
@ -214,7 +214,7 @@ bool DirectivesParser::push_key(const key* k) {
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(stack[depth] == NULL, "element not nulled, something is wrong");
|
||||
assert(stack[depth] == nullptr, "element not nulled, something is wrong");
|
||||
|
||||
if (depth == 0 && !(k->allowedmask & 1)) {
|
||||
error(KEY_ERROR, "Key '%s' not allowed at top level.", k->name);
|
||||
@ -237,7 +237,7 @@ bool DirectivesParser::push_key(const key* k) {
|
||||
const DirectivesParser::key* DirectivesParser::current_key() {
|
||||
assert(depth > 0, "getting key from empty stack");
|
||||
if (depth == 0) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return stack[depth - 1];
|
||||
}
|
||||
@ -246,13 +246,13 @@ const DirectivesParser::key* DirectivesParser::pop_key() {
|
||||
assert(depth > 0, "popping empty stack");
|
||||
if (depth == 0) {
|
||||
error(INTERNAL_ERROR, "Popping empty stack.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
depth--;
|
||||
|
||||
const key* k = stack[depth];
|
||||
#ifndef PRODUCT
|
||||
stack[depth] = NULL;
|
||||
stack[depth] = nullptr;
|
||||
#endif
|
||||
|
||||
return k;
|
||||
@ -373,7 +373,7 @@ bool DirectivesParser::set_option(JSON_TYPE t, JSON_VAL* v) {
|
||||
switch (option_key->type) {
|
||||
case type_flag:
|
||||
{
|
||||
if (current_directiveset == NULL) {
|
||||
if (current_directiveset == nullptr) {
|
||||
assert(depth == 2, "Must not have active directive set");
|
||||
|
||||
if (!set_option_flag(t, v, option_key, current_directive->_c1_store)) {
|
||||
@ -405,9 +405,9 @@ bool DirectivesParser::set_option(JSON_TYPE t, JSON_VAL* v) {
|
||||
strncpy(s, v->str.start, v->str.length);
|
||||
s[v->str.length] = '\0';
|
||||
|
||||
const char* error_msg = NULL;
|
||||
const char* error_msg = nullptr;
|
||||
if (!current_directive->add_match(s, error_msg)) {
|
||||
assert (error_msg != NULL, "Must have valid error message");
|
||||
assert (error_msg != nullptr, "Must have valid error message");
|
||||
error(VALUE_ERROR, "Method pattern error: %s", error_msg);
|
||||
}
|
||||
FREE_C_HEAP_ARRAY(char, s);
|
||||
@ -425,20 +425,20 @@ bool DirectivesParser::set_option(JSON_TYPE t, JSON_VAL* v) {
|
||||
strncpy(s, v->str.start, v->str.length);
|
||||
s[v->str.length] = '\0';
|
||||
|
||||
const char* error_msg = NULL;
|
||||
if (current_directiveset == NULL) {
|
||||
const char* error_msg = nullptr;
|
||||
if (current_directiveset == nullptr) {
|
||||
if (current_directive->_c1_store->parse_and_add_inline(s, error_msg)) {
|
||||
if (!current_directive->_c2_store->parse_and_add_inline(s, error_msg)) {
|
||||
assert (error_msg != NULL, "Must have valid error message");
|
||||
assert (error_msg != nullptr, "Must have valid error message");
|
||||
error(VALUE_ERROR, "Method pattern error: %s", error_msg);
|
||||
}
|
||||
} else {
|
||||
assert (error_msg != NULL, "Must have valid error message");
|
||||
assert (error_msg != nullptr, "Must have valid error message");
|
||||
error(VALUE_ERROR, "Method pattern error: %s", error_msg);
|
||||
}
|
||||
} else {
|
||||
if (!current_directiveset->parse_and_add_inline(s, error_msg)) {
|
||||
assert (error_msg != NULL, "Must have valid error message");
|
||||
assert (error_msg != nullptr, "Must have valid error message");
|
||||
error(VALUE_ERROR, "Method pattern error: %s", error_msg);
|
||||
}
|
||||
}
|
||||
@ -535,18 +535,18 @@ bool DirectivesParser::callback(JSON_TYPE t, JSON_VAL* v, uint rlimit) {
|
||||
case type_c1:
|
||||
case type_c2:
|
||||
// This is how we now if options apply to a single or both directive sets
|
||||
current_directiveset = NULL;
|
||||
current_directiveset = nullptr;
|
||||
break;
|
||||
|
||||
case type_directives:
|
||||
// Check, finish and push to stack!
|
||||
if (current_directive->match() == NULL) {
|
||||
if (current_directive->match() == nullptr) {
|
||||
error(INTERNAL_ERROR, "Directive missing required match.");
|
||||
return false;
|
||||
}
|
||||
current_directive->finalize(_st);
|
||||
push_tmp(current_directive);
|
||||
current_directive = NULL;
|
||||
current_directive = nullptr;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -42,12 +42,12 @@
|
||||
#include "runtime/stubRoutines.hpp"
|
||||
#include "utilities/resourceHash.hpp"
|
||||
|
||||
void* Disassembler::_library = NULL;
|
||||
void* Disassembler::_library = nullptr;
|
||||
bool Disassembler::_tried_to_load_library = false;
|
||||
bool Disassembler::_library_usable = false;
|
||||
|
||||
// This routine is in the shared library:
|
||||
Disassembler::decode_func_virtual Disassembler::_decode_instructions_virtual = NULL;
|
||||
Disassembler::decode_func_virtual Disassembler::_decode_instructions_virtual = nullptr;
|
||||
|
||||
static const char hsdis_library_name[] = "hsdis-" HOTSPOT_LIB_ARCH;
|
||||
static const char decode_instructions_virtual_name[] = "decode_instructions_virtual";
|
||||
@ -57,11 +57,11 @@ static const char decode_instructions_virtual_name[] = "decode_instructions_virt
|
||||
class decode_env {
|
||||
private:
|
||||
outputStream* _output; // where the disassembly is directed to
|
||||
CodeBlob* _codeBlob; // != NULL only when decoding a CodeBlob
|
||||
nmethod* _nm; // != NULL only when decoding a nmethod
|
||||
CodeBlob* _codeBlob; // != nullptr only when decoding a CodeBlob
|
||||
nmethod* _nm; // != nullptr only when decoding a nmethod
|
||||
|
||||
address _start; // != NULL when decoding a range of unknown type
|
||||
address _end; // != NULL when decoding a range of unknown type
|
||||
address _start; // != nullptr when decoding a range of unknown type
|
||||
address _end; // != nullptr when decoding a range of unknown type
|
||||
|
||||
char _option_buf[512];
|
||||
char _print_raw;
|
||||
@ -98,7 +98,7 @@ class decode_env {
|
||||
|
||||
// Merge new option string with previously recorded options
|
||||
void collect_options(const char* p) {
|
||||
if (p == NULL || p[0] == '\0') return;
|
||||
if (p == nullptr || p[0] == '\0') return;
|
||||
size_t opt_so_far = strlen(_option_buf);
|
||||
if (opt_so_far + 1 + strlen(p) + 1 > sizeof(_option_buf)) return;
|
||||
char* fillp = &_option_buf[opt_so_far];
|
||||
@ -106,7 +106,7 @@ class decode_env {
|
||||
strcat(fillp, p);
|
||||
// replace white space by commas:
|
||||
char* q = fillp;
|
||||
while ((q = strpbrk(q, " \t\n")) != NULL)
|
||||
while ((q = strpbrk(q, " \t\n")) != nullptr)
|
||||
*q++ = ',';
|
||||
}
|
||||
|
||||
@ -146,14 +146,14 @@ class decode_env {
|
||||
outputStream* st = output();
|
||||
|
||||
if (AbstractDisassembler::show_comment()) {
|
||||
if ((_nm != NULL) && _nm->has_code_comment(pc0, pc)) {
|
||||
if ((_nm != nullptr) && _nm->has_code_comment(pc0, pc)) {
|
||||
_nm->print_code_comment_on
|
||||
(st,
|
||||
_post_decode_alignment ? _post_decode_alignment : COMMENT_COLUMN,
|
||||
pc0, pc);
|
||||
// this calls reloc_string_for which calls oop::print_value_on
|
||||
}
|
||||
print_hook_comments(pc0, _nm != NULL);
|
||||
print_hook_comments(pc0, _nm != nullptr);
|
||||
}
|
||||
Disassembler::annotate(pc0, output());
|
||||
// follow each complete insn by a nice newline
|
||||
@ -166,25 +166,25 @@ class decode_env {
|
||||
const char* file;
|
||||
int line;
|
||||
Link* next;
|
||||
Link(const char* f, int l) : file(f), line(l), next(NULL) {}
|
||||
Link(const char* f, int l) : file(f), line(l), next(nullptr) {}
|
||||
};
|
||||
Link *head, *tail;
|
||||
|
||||
void append(const char* file, int line) {
|
||||
if (tail != NULL && tail->file == file && tail->line == line) {
|
||||
if (tail != nullptr && tail->file == file && tail->line == line) {
|
||||
// Don't print duplicated lines at the same address. This could happen with C
|
||||
// macros that end up having multiple "__" tokens on the same __LINE__.
|
||||
return;
|
||||
}
|
||||
Link *link = new Link(file, line);
|
||||
if (head == NULL) {
|
||||
if (head == nullptr) {
|
||||
head = tail = link;
|
||||
} else {
|
||||
tail->next = link;
|
||||
tail = link;
|
||||
}
|
||||
}
|
||||
SourceFileInfo(const char* file, int line) : head(NULL), tail(NULL) {
|
||||
SourceFileInfo(const char* file, int line) : head(nullptr), tail(nullptr) {
|
||||
append(file, line);
|
||||
}
|
||||
};
|
||||
@ -199,7 +199,7 @@ class decode_env {
|
||||
static GrowableArray<const char*>* _cached_src_lines;
|
||||
|
||||
static SourceFileInfoTable& src_table() {
|
||||
if (_src_table == NULL) {
|
||||
if (_src_table == nullptr) {
|
||||
_src_table = new (mtCode)SourceFileInfoTable();
|
||||
}
|
||||
return *_src_table;
|
||||
@ -211,11 +211,11 @@ class decode_env {
|
||||
// Constructor for a 'decode_env' to decode an arbitrary
|
||||
// piece of memory, hopefully containing code.
|
||||
decode_env(address start, address end, outputStream* output
|
||||
NOT_PRODUCT(COMMA const AsmRemarks* remarks = NULL COMMA ptrdiff_t disp = 0));
|
||||
NOT_PRODUCT(COMMA const AsmRemarks* remarks = nullptr COMMA ptrdiff_t disp = 0));
|
||||
|
||||
// Add 'original_start' argument which is the original address
|
||||
// the instructions were located at (if this is not equal to 'start').
|
||||
address decode_instructions(address start, address end, address original_start = NULL);
|
||||
address decode_instructions(address start, address end, address original_start = nullptr);
|
||||
|
||||
address handle_event(const char* event, address arg);
|
||||
|
||||
@ -228,9 +228,9 @@ class decode_env {
|
||||
|
||||
bool decode_env::_optionsParsed = false;
|
||||
|
||||
decode_env::SourceFileInfoTable* decode_env::_src_table = NULL;
|
||||
const char* decode_env::_cached_src = NULL;
|
||||
GrowableArray<const char*>* decode_env::_cached_src_lines = NULL;
|
||||
decode_env::SourceFileInfoTable* decode_env::_src_table = nullptr;
|
||||
const char* decode_env::_cached_src = nullptr;
|
||||
GrowableArray<const char*>* decode_env::_cached_src_lines = nullptr;
|
||||
|
||||
void decode_env::hook(const char* file, int line, address pc) {
|
||||
// For simplication, we never free from this table. It's really not
|
||||
@ -238,7 +238,7 @@ void decode_env::hook(const char* file, int line, address pc) {
|
||||
// which means we are debugging the VM and a little bit of extra
|
||||
// memory usage doesn't matter.
|
||||
SourceFileInfo* found = src_table().get(pc);
|
||||
if (found != NULL) {
|
||||
if (found != nullptr) {
|
||||
found->append(file, line);
|
||||
} else {
|
||||
SourceFileInfo sfi(file, line);
|
||||
@ -249,17 +249,17 @@ void decode_env::hook(const char* file, int line, address pc) {
|
||||
void decode_env::print_hook_comments(address pc, bool newline) {
|
||||
SourceFileInfo* found = src_table().get(pc);
|
||||
outputStream* st = output();
|
||||
if (found != NULL) {
|
||||
if (found != nullptr) {
|
||||
for (SourceFileInfo::Link *link = found->head; link; link = link->next) {
|
||||
const char* file = link->file;
|
||||
int line = link->line;
|
||||
if (_cached_src == NULL || strcmp(_cached_src, file) != 0) {
|
||||
if (_cached_src == nullptr || strcmp(_cached_src, file) != 0) {
|
||||
FILE* fp;
|
||||
|
||||
// _cached_src_lines is a single cache of the lines of a source file, and we refill this cache
|
||||
// every time we need to print a line from a different source file. It's not the fastest,
|
||||
// but seems bearable.
|
||||
if (_cached_src_lines != NULL) {
|
||||
if (_cached_src_lines != nullptr) {
|
||||
for (int i=0; i<_cached_src_lines->length(); i++) {
|
||||
os::free((void*)_cached_src_lines->at(i));
|
||||
}
|
||||
@ -268,14 +268,14 @@ void decode_env::print_hook_comments(address pc, bool newline) {
|
||||
_cached_src_lines = new (mtCode) GrowableArray<const char*>(0, mtCode);
|
||||
}
|
||||
|
||||
if ((fp = os::fopen(file, "r")) == NULL) {
|
||||
_cached_src = NULL;
|
||||
if ((fp = os::fopen(file, "r")) == nullptr) {
|
||||
_cached_src = nullptr;
|
||||
return;
|
||||
}
|
||||
_cached_src = file;
|
||||
|
||||
char line[500]; // don't write lines that are too long in your source files!
|
||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||
while (fgets(line, sizeof(line), fp) != nullptr) {
|
||||
size_t len = strlen(line);
|
||||
if (len > 0 && line[len-1] == '\n') {
|
||||
line[len-1] = '\0';
|
||||
@ -317,12 +317,12 @@ void decode_env::print_hook_comments(address pc, bool newline) {
|
||||
decode_env::decode_env(CodeBlob* code, outputStream* output) :
|
||||
_output(output ? output : tty),
|
||||
_codeBlob(code),
|
||||
_nm(_codeBlob != NULL && _codeBlob->is_nmethod() ? (nmethod*) code : NULL),
|
||||
_start(NULL),
|
||||
_end(NULL),
|
||||
_nm(_codeBlob != nullptr && _codeBlob->is_nmethod() ? (nmethod*) code : nullptr),
|
||||
_start(nullptr),
|
||||
_end(nullptr),
|
||||
_option_buf(),
|
||||
_print_raw(0),
|
||||
_cur_insn(NULL),
|
||||
_cur_insn(nullptr),
|
||||
_bytes_per_line(0),
|
||||
_pre_decode_alignment(0),
|
||||
_post_decode_alignment(0),
|
||||
@ -338,13 +338,13 @@ decode_env::decode_env(CodeBlob* code, outputStream* output) :
|
||||
|
||||
decode_env::decode_env(nmethod* code, outputStream* output) :
|
||||
_output(output ? output : tty),
|
||||
_codeBlob(NULL),
|
||||
_codeBlob(nullptr),
|
||||
_nm(code),
|
||||
_start(_nm->code_begin()),
|
||||
_end(_nm->code_end()),
|
||||
_option_buf(),
|
||||
_print_raw(0),
|
||||
_cur_insn(NULL),
|
||||
_cur_insn(nullptr),
|
||||
_bytes_per_line(0),
|
||||
_pre_decode_alignment(0),
|
||||
_post_decode_alignment(0),
|
||||
@ -363,13 +363,13 @@ decode_env::decode_env(nmethod* code, outputStream* output) :
|
||||
decode_env::decode_env(address start, address end, outputStream* output
|
||||
NOT_PRODUCT(COMMA const AsmRemarks* remarks COMMA ptrdiff_t disp)) :
|
||||
_output(output ? output : tty),
|
||||
_codeBlob(NULL),
|
||||
_nm(NULL),
|
||||
_codeBlob(nullptr),
|
||||
_nm(nullptr),
|
||||
_start(start),
|
||||
_end(end),
|
||||
_option_buf(),
|
||||
_print_raw(0),
|
||||
_cur_insn(NULL),
|
||||
_cur_insn(nullptr),
|
||||
_bytes_per_line(0),
|
||||
_pre_decode_alignment(0),
|
||||
_post_decode_alignment(0),
|
||||
@ -469,7 +469,7 @@ void decode_env::process_options(outputStream* ost) {
|
||||
// binutils decoder does not handle to our liking (suboptimal
|
||||
// formatting, incomplete information, ...).
|
||||
// Returns:
|
||||
// - NULL for all standard invocations. The function result is not
|
||||
// - nullptr for all standard invocations. The function result is not
|
||||
// examined (as of now, 20190409) by the hsdis decoder loop.
|
||||
// - next for 'insn0' invocations.
|
||||
// next == arg: the custom decoder didn't do anything.
|
||||
@ -495,20 +495,20 @@ address decode_env::handle_event(const char* event, address arg) {
|
||||
//---< Event: end decoding loop (error, no progress) >---
|
||||
if (decode_env::match(event, "/insns")) {
|
||||
// Nothing to be done here.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---< Event: start decoding loop >---
|
||||
if (decode_env::match(event, "insns")) {
|
||||
// Nothing to be done here.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---< Event: finish decoding an instruction >---
|
||||
if (decode_env::match(event, "/insn")) {
|
||||
output()->fill_to(_post_decode_alignment);
|
||||
end_insn(arg);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---< Event: start decoding an instruction >---
|
||||
@ -517,13 +517,13 @@ address decode_env::handle_event(const char* event, address arg) {
|
||||
} else if (match(event, "/insn")) {
|
||||
end_insn(arg);
|
||||
} else if (match(event, "addr")) {
|
||||
if (arg != NULL) {
|
||||
if (arg != nullptr) {
|
||||
print_address(arg);
|
||||
return arg;
|
||||
}
|
||||
calculate_alignment();
|
||||
output()->fill_to(_pre_decode_alignment);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---< Event: call custom decoder (platform specific) >---
|
||||
@ -543,7 +543,7 @@ address decode_env::handle_event(const char* event, address arg) {
|
||||
// been printed. The decoded instruction (event "insn") is
|
||||
// printed afterwards. That doesn't look nice.
|
||||
if (decode_env::match(event, "mach")) {
|
||||
guarantee(arg != NULL, "event_to_env - arg must not be NULL for event 'mach'");
|
||||
guarantee(arg != nullptr, "event_to_env - arg must not be nullptr for event 'mach'");
|
||||
static char buffer[64] = { 0, };
|
||||
// Output suppressed because it messes up disassembly.
|
||||
// Only print this when the mach changes.
|
||||
@ -554,16 +554,16 @@ address decode_env::handle_event(const char* event, address arg) {
|
||||
buffer[sizeof(buffer) - 1] = '\0';
|
||||
output()->print_cr("[Disassembling for mach='%s']", (const char*)arg);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---< Event: format bytes-per-line >---
|
||||
if (decode_env::match(event, "format bytes-per-line")) {
|
||||
_bytes_per_line = (int) (intptr_t) arg;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void* event_to_env(void* env_pv, const char* event, void* arg) {
|
||||
@ -575,8 +575,8 @@ static void* event_to_env(void* env_pv, const char* event, void* arg) {
|
||||
void decode_env::print_address(address adr) {
|
||||
outputStream* st = output();
|
||||
|
||||
if (adr == NULL) {
|
||||
st->print("NULL");
|
||||
if (adr == nullptr) {
|
||||
st->print("nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -590,10 +590,10 @@ void decode_env::print_address(address adr) {
|
||||
if (Universe::is_fully_initialized()) {
|
||||
if (StubRoutines::contains(adr)) {
|
||||
StubCodeDesc* desc = StubCodeDesc::desc_for(adr);
|
||||
if (desc == NULL) {
|
||||
if (desc == nullptr) {
|
||||
desc = StubCodeDesc::desc_for(adr + frame::pc_return_offset);
|
||||
}
|
||||
if (desc != NULL) {
|
||||
if (desc != nullptr) {
|
||||
st->print("Stub::%s", desc->name());
|
||||
if (desc->begin() != adr) {
|
||||
st->print(INTX_FORMAT_W(+) " " PTR_FORMAT, adr - desc->begin(), p2i(adr));
|
||||
@ -615,7 +615,7 @@ void decode_env::print_address(address adr) {
|
||||
}
|
||||
}
|
||||
|
||||
if (_nm == NULL) {
|
||||
if (_nm == nullptr) {
|
||||
// Don't do this for native methods, as the function name will be printed in
|
||||
// nmethod::reloc_string_for().
|
||||
// Allocate the buffer on the stack instead of as RESOURCE array.
|
||||
@ -671,19 +671,19 @@ static int printf_to_env(void* env_pv, const char* format, ...) {
|
||||
decode_env* env = (decode_env*) env_pv;
|
||||
outputStream* st = env->output();
|
||||
size_t flen = strlen(format);
|
||||
const char* raw = NULL;
|
||||
const char* raw = nullptr;
|
||||
if (flen == 0) return 0;
|
||||
if (flen == 1 && format[0] == '\n') { st->bol(); return 1; }
|
||||
if (flen < 2 ||
|
||||
strchr(format, '%') == NULL) {
|
||||
strchr(format, '%') == nullptr) {
|
||||
raw = format;
|
||||
} else if (format[0] == '%' && format[1] == '%' &&
|
||||
strchr(format+2, '%') == NULL) {
|
||||
strchr(format+2, '%') == nullptr) {
|
||||
// happens a lot on machines with names like %foo
|
||||
flen--;
|
||||
raw = format+1;
|
||||
}
|
||||
if (raw != NULL) {
|
||||
if (raw != nullptr) {
|
||||
st->print_raw(raw, flen);
|
||||
return (int) flen;
|
||||
}
|
||||
@ -697,17 +697,17 @@ static int printf_to_env(void* env_pv, const char* format, ...) {
|
||||
}
|
||||
|
||||
// The 'original_start' argument holds the original address where
|
||||
// the instructions were located in the originating system. If zero (NULL)
|
||||
// the instructions were located in the originating system. If zero (nullptr)
|
||||
// is passed in, there is no original address.
|
||||
address decode_env::decode_instructions(address start, address end, address original_start /* = 0*/) {
|
||||
// CodeComment in Stubs.
|
||||
// Properly initialize _start/_end. Overwritten too often if
|
||||
// printing of instructions is called for each instruction.
|
||||
assert((_start == NULL) || (start == NULL) || (_start == start), "don't overwrite CTOR values");
|
||||
assert((_end == NULL) || (end == NULL) || (_end == end ), "don't overwrite CTOR values");
|
||||
if (start != NULL) set_start(start);
|
||||
if (end != NULL) set_end(end);
|
||||
if (original_start == NULL) {
|
||||
assert((_start == nullptr) || (start == nullptr) || (_start == start), "don't overwrite CTOR values");
|
||||
assert((_end == nullptr) || (end == nullptr) || (_end == end ), "don't overwrite CTOR values");
|
||||
if (start != nullptr) set_start(start);
|
||||
if (end != nullptr) set_end(end);
|
||||
if (original_start == nullptr) {
|
||||
original_start = start;
|
||||
}
|
||||
|
||||
@ -721,7 +721,7 @@ address decode_env::decode_instructions(address start, address end, address orig
|
||||
// Trying to decode instructions doesn't make sense if we
|
||||
// couldn't load the disassembler library.
|
||||
if (Disassembler::is_abstract()) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// decode a series of instructions and return the end of the last instruction
|
||||
@ -730,13 +730,13 @@ address decode_env::decode_instructions(address start, address end, address orig
|
||||
// Print whatever the library wants to print, w/o fancy callbacks.
|
||||
// This is mainly for debugging the library itself.
|
||||
FILE* out = stdout;
|
||||
FILE* xmlout = (_print_raw > 1 ? out : NULL);
|
||||
FILE* xmlout = (_print_raw > 1 ? out : nullptr);
|
||||
return
|
||||
(address)
|
||||
(*Disassembler::_decode_instructions_virtual)((uintptr_t)start, (uintptr_t)end,
|
||||
start, end - start,
|
||||
NULL, (void*) xmlout,
|
||||
NULL, (void*) out,
|
||||
nullptr, (void*) xmlout,
|
||||
nullptr, (void*) out,
|
||||
options(), 0/*nice new line*/);
|
||||
}
|
||||
|
||||
@ -764,7 +764,7 @@ void* Disassembler::dll_load(char* buf, int buflen, int offset, char* ebuf, int
|
||||
} else if (Verbose) {
|
||||
st->print_cr("Try to load hsdis library failed: the length of path is beyond the OS limit");
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Disassembler::load_library(outputStream* st) {
|
||||
@ -777,7 +777,7 @@ bool Disassembler::load_library(outputStream* st) {
|
||||
#if defined(SUPPORT_ASSEMBLY) || defined(SUPPORT_ABSTRACT_ASSEMBLY)
|
||||
// Print to given stream, if any.
|
||||
// Print to tty if Verbose is on and no stream given.
|
||||
st = ((st == NULL) && Verbose) ? tty : st;
|
||||
st = ((st == nullptr) && Verbose) ? tty : st;
|
||||
|
||||
// Compute fully qualified library name.
|
||||
char ebuf[1024];
|
||||
@ -796,13 +796,13 @@ bool Disassembler::load_library(outputStream* st) {
|
||||
// Match "[lib]jvm[^/]*" in jvm_path.
|
||||
const char* base = buf;
|
||||
const char* p = strrchr(buf, *os::file_separator());
|
||||
if (p != NULL) lib_offset = p - base + 1; // this points to the first char after separator
|
||||
if (p != nullptr) lib_offset = p - base + 1; // this points to the first char after separator
|
||||
#ifdef _WIN32
|
||||
p = strstr(p ? p : base, "jvm");
|
||||
if (p != NULL) jvm_offset = p - base; // this points to 'j' in jvm.
|
||||
if (p != nullptr) jvm_offset = p - base; // this points to 'j' in jvm.
|
||||
#else
|
||||
p = strstr(p ? p : base, "libjvm");
|
||||
if (p != NULL) jvm_offset = p - base + 3; // this points to 'j' in libjvm.
|
||||
if (p != nullptr) jvm_offset = p - base + 3; // this points to 'j' in libjvm.
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -816,47 +816,47 @@ bool Disassembler::load_library(outputStream* st) {
|
||||
if (jvm_offset >= 0) {
|
||||
// 1. <home>/lib/<vm>/libhsdis-<arch>.so
|
||||
_library = dll_load(buf, sizeof buf, jvm_offset, ebuf, sizeof ebuf, st);
|
||||
if (_library == NULL && lib_offset >= 0) {
|
||||
if (_library == nullptr && lib_offset >= 0) {
|
||||
// 2. <home>/lib/<vm>/hsdis-<arch>.so
|
||||
_library = dll_load(buf, sizeof buf, lib_offset, ebuf, sizeof ebuf, st);
|
||||
}
|
||||
if (_library == NULL && lib_offset > 0) {
|
||||
if (_library == nullptr && lib_offset > 0) {
|
||||
// 3. <home>/lib/hsdis-<arch>.so
|
||||
buf[lib_offset - 1] = '\0';
|
||||
const char* p = strrchr(buf, *os::file_separator());
|
||||
if (p != NULL) {
|
||||
if (p != nullptr) {
|
||||
lib_offset = p - buf + 1;
|
||||
_library = dll_load(buf, sizeof buf, lib_offset, ebuf, sizeof ebuf, st);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_library == NULL) {
|
||||
if (_library == nullptr) {
|
||||
_library = dll_load(buf, sizeof buf, 0, ebuf, sizeof ebuf, st);
|
||||
}
|
||||
|
||||
// load the decoder function to use.
|
||||
if (_library != NULL) {
|
||||
if (_library != nullptr) {
|
||||
_decode_instructions_virtual = CAST_TO_FN_PTR(Disassembler::decode_func_virtual,
|
||||
os::dll_lookup(_library, decode_instructions_virtual_name));
|
||||
} else {
|
||||
log_warning(os)("Loading hsdis library failed");
|
||||
}
|
||||
_tried_to_load_library = true;
|
||||
_library_usable = _decode_instructions_virtual != NULL;
|
||||
_library_usable = _decode_instructions_virtual != nullptr;
|
||||
|
||||
// Create a dummy environment to initialize PrintAssemblyOptions.
|
||||
// The PrintAssemblyOptions must be known for abstract disassemblies as well.
|
||||
decode_env dummy((unsigned char*)(&buf[0]), (unsigned char*)(&buf[1]), st);
|
||||
|
||||
// Report problems during dll_load or dll_lookup, if any.
|
||||
if (st != NULL) {
|
||||
if (st != nullptr) {
|
||||
// Success.
|
||||
if (_library_usable) {
|
||||
st->print_cr("Loaded disassembler from %s", buf);
|
||||
} else {
|
||||
st->print_cr("Could not load %s; %s; %s",
|
||||
buf,
|
||||
((_library != NULL)
|
||||
((_library != nullptr)
|
||||
? "entry point is missing"
|
||||
: ((WizardMode || PrintMiscellaneous)
|
||||
? (const char*)ebuf
|
||||
@ -882,7 +882,7 @@ void Disassembler::decode(CodeBlob* cb, outputStream* st) {
|
||||
decode_env env(cb, st);
|
||||
env.output()->print_cr("--------------------------------------------------------------------------------");
|
||||
env.output()->print("Decoding CodeBlob");
|
||||
if (cb->name() != NULL) {
|
||||
if (cb->name() != nullptr) {
|
||||
env.output()->print(", name: %s,", cb->name());
|
||||
}
|
||||
env.output()->print_cr(" at [" PTR_FORMAT ", " PTR_FORMAT "] " JLONG_FORMAT " bytes", p2i(cb->code_begin()), p2i(cb->code_end()), ((jlong)(cb->code_end() - cb->code_begin())));
|
||||
@ -923,8 +923,8 @@ void Disassembler::decode(address start, address end, outputStream* st
|
||||
#if defined(SUPPORT_ASSEMBLY) || defined(SUPPORT_ABSTRACT_ASSEMBLY)
|
||||
//---< Test memory before decoding >---
|
||||
if (!os::is_readable_range(start, end)) {
|
||||
//---< Allow output suppression, but prevent writing to a NULL stream. Could happen with +PrintStubCode. >---
|
||||
if (st != NULL) {
|
||||
//---< Allow output suppression, but prevent writing to a nullptr stream. Could happen with +PrintStubCode. >---
|
||||
if (st != nullptr) {
|
||||
st->print("Memory range [" PTR_FORMAT ".." PTR_FORMAT "] not readable", p2i(start), p2i(end));
|
||||
}
|
||||
return;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -62,9 +62,9 @@ class Disassembler : public AbstractDisassembler {
|
||||
|
||||
// tries to load library and return whether it succeeded.
|
||||
// Allow (diagnostic) output redirection.
|
||||
// No output at all if stream is NULL. Can be overridden
|
||||
// No output at all if stream is nullptr. Can be overridden
|
||||
// with -Verbose flag, in which case output goes to tty.
|
||||
static bool load_library(outputStream* st = NULL);
|
||||
static bool load_library(outputStream* st = nullptr);
|
||||
static void* dll_load(char* buf, int buflen, int offset, char* ebuf, int ebuflen, outputStream* st);
|
||||
|
||||
// Check if the two addresses are on the same page.
|
||||
@ -100,12 +100,12 @@ class Disassembler : public AbstractDisassembler {
|
||||
}
|
||||
|
||||
// Directly disassemble code blob.
|
||||
static void decode(CodeBlob* cb, outputStream* st = NULL);
|
||||
static void decode(CodeBlob* cb, outputStream* st = nullptr);
|
||||
// Directly disassemble nmethod.
|
||||
static void decode(nmethod* nm, outputStream* st = NULL);
|
||||
static void decode(nmethod* nm, outputStream* st = nullptr);
|
||||
// Disassemble an arbitrary memory range.
|
||||
static void decode(address start, address end, outputStream* st = NULL
|
||||
NOT_PRODUCT(COMMA const AsmRemarks* remarks = NULL COMMA ptrdiff_t disp = 0));
|
||||
static void decode(address start, address end, outputStream* st = nullptr
|
||||
NOT_PRODUCT(COMMA const AsmRemarks* remarks = nullptr COMMA ptrdiff_t disp = 0));
|
||||
|
||||
static void _hook(const char* file, int line, class MacroAssembler* masm);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -101,7 +101,7 @@ void MethodLiveness::init_basic_blocks() {
|
||||
ciMethodBlocks *mblocks = method()->get_method_blocks();
|
||||
|
||||
// Create an array to store the bci->BasicBlock mapping.
|
||||
_block_map = new (arena()) GrowableArray<BasicBlock*>(arena(), method_len, method_len, NULL);
|
||||
_block_map = new (arena()) GrowableArray<BasicBlock*>(arena(), method_len, method_len, nullptr);
|
||||
|
||||
_block_count = mblocks->num_blocks();
|
||||
_block_list = (BasicBlock **) arena()->Amalloc(sizeof(BasicBlock *) * _block_count);
|
||||
@ -132,7 +132,7 @@ void MethodLiveness::init_basic_blocks() {
|
||||
int limit = current_block->limit_bci();
|
||||
if (limit < method_len) {
|
||||
BasicBlock *next = _block_map->at(limit);
|
||||
assert( next != NULL, "must be a block immediately following this one.");
|
||||
assert( next != nullptr, "must be a block immediately following this one.");
|
||||
next->add_normal_predecessor(current_block);
|
||||
}
|
||||
continue;
|
||||
@ -143,7 +143,7 @@ void MethodLiveness::init_basic_blocks() {
|
||||
|
||||
// Now we need to interpret the instruction's effect
|
||||
// on control flow.
|
||||
assert (current_block != NULL, "we must have a current block");
|
||||
assert (current_block != nullptr, "we must have a current block");
|
||||
switch (code) {
|
||||
case Bytecodes::_ifeq:
|
||||
case Bytecodes::_ifne:
|
||||
@ -164,21 +164,21 @@ void MethodLiveness::init_basic_blocks() {
|
||||
// Two way branch. Set predecessors at each destination.
|
||||
if (bytes.next_bci() < method_len) {
|
||||
dest = _block_map->at(bytes.next_bci());
|
||||
assert(dest != NULL, "must be a block immediately following this one.");
|
||||
assert(dest != nullptr, "must be a block immediately following this one.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
}
|
||||
dest = _block_map->at(bytes.get_dest());
|
||||
assert(dest != NULL, "branch destination must start a block.");
|
||||
assert(dest != nullptr, "branch destination must start a block.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
break;
|
||||
case Bytecodes::_goto:
|
||||
dest = _block_map->at(bytes.get_dest());
|
||||
assert(dest != NULL, "branch destination must start a block.");
|
||||
assert(dest != nullptr, "branch destination must start a block.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
break;
|
||||
case Bytecodes::_goto_w:
|
||||
dest = _block_map->at(bytes.get_far_dest());
|
||||
assert(dest != NULL, "branch destination must start a block.");
|
||||
assert(dest != nullptr, "branch destination must start a block.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
break;
|
||||
case Bytecodes::_tableswitch:
|
||||
@ -188,11 +188,11 @@ void MethodLiveness::init_basic_blocks() {
|
||||
int len = tableswitch.length();
|
||||
|
||||
dest = _block_map->at(bci + tableswitch.default_offset());
|
||||
assert(dest != NULL, "branch destination must start a block.");
|
||||
assert(dest != nullptr, "branch destination must start a block.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
while (--len >= 0) {
|
||||
dest = _block_map->at(bci + tableswitch.dest_offset_at(len));
|
||||
assert(dest != NULL, "branch destination must start a block.");
|
||||
assert(dest != nullptr, "branch destination must start a block.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
}
|
||||
break;
|
||||
@ -205,12 +205,12 @@ void MethodLiveness::init_basic_blocks() {
|
||||
int npairs = lookupswitch.number_of_pairs();
|
||||
|
||||
dest = _block_map->at(bci + lookupswitch.default_offset());
|
||||
assert(dest != NULL, "branch destination must start a block.");
|
||||
assert(dest != nullptr, "branch destination must start a block.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
while(--npairs >= 0) {
|
||||
LookupswitchPair pair = lookupswitch.pair_at(npairs);
|
||||
dest = _block_map->at( bci + pair.offset());
|
||||
assert(dest != NULL, "branch destination must start a block.");
|
||||
assert(dest != nullptr, "branch destination must start a block.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
}
|
||||
break;
|
||||
@ -220,20 +220,20 @@ void MethodLiveness::init_basic_blocks() {
|
||||
{
|
||||
assert(bytes.is_wide()==false, "sanity check");
|
||||
dest = _block_map->at(bytes.get_dest());
|
||||
assert(dest != NULL, "branch destination must start a block.");
|
||||
assert(dest != nullptr, "branch destination must start a block.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
BasicBlock *jsrExit = _block_map->at(current_block->limit_bci());
|
||||
assert(jsrExit != NULL, "jsr return bci must start a block.");
|
||||
assert(jsrExit != nullptr, "jsr return bci must start a block.");
|
||||
jsr_exit_list->append(jsrExit);
|
||||
break;
|
||||
}
|
||||
case Bytecodes::_jsr_w:
|
||||
{
|
||||
dest = _block_map->at(bytes.get_far_dest());
|
||||
assert(dest != NULL, "branch destination must start a block.");
|
||||
assert(dest != nullptr, "branch destination must start a block.");
|
||||
dest->add_normal_predecessor(current_block);
|
||||
BasicBlock *jsrExit = _block_map->at(current_block->limit_bci());
|
||||
assert(jsrExit != NULL, "jsr return bci must start a block.");
|
||||
assert(jsrExit != nullptr, "jsr return bci must start a block.");
|
||||
jsr_exit_list->append(jsrExit);
|
||||
break;
|
||||
}
|
||||
@ -325,7 +325,7 @@ void MethodLiveness::propagate_liveness() {
|
||||
// blocks, which should be decent for quick convergence (with the
|
||||
// possible exception of exception handlers, which are all created
|
||||
// early).
|
||||
_work_list = NULL;
|
||||
_work_list = nullptr;
|
||||
for (int i = 0; i < num_blocks; i++) {
|
||||
block = _block_list[i];
|
||||
block->set_next(_work_list);
|
||||
@ -334,7 +334,7 @@ void MethodLiveness::propagate_liveness() {
|
||||
}
|
||||
|
||||
|
||||
while ((block = work_list_get()) != NULL) {
|
||||
while ((block = work_list_get()) != nullptr) {
|
||||
block->propagate(this);
|
||||
}
|
||||
}
|
||||
@ -349,7 +349,7 @@ void MethodLiveness::work_list_add(BasicBlock *block) {
|
||||
|
||||
MethodLiveness::BasicBlock *MethodLiveness::work_list_get() {
|
||||
BasicBlock *block = _work_list;
|
||||
if (block != NULL) {
|
||||
if (block != nullptr) {
|
||||
block->set_on_work_list(false);
|
||||
_work_list = block->next();
|
||||
}
|
||||
@ -374,10 +374,10 @@ MethodLivenessResult MethodLiveness::get_liveness_at(int entry_bci) {
|
||||
// We may not be at the block start, so search backwards to find the block
|
||||
// containing bci.
|
||||
int t = bci;
|
||||
while (block == NULL && t > 0) {
|
||||
while (block == nullptr && t > 0) {
|
||||
block = _block_map->at(--t);
|
||||
}
|
||||
guarantee(block != NULL, "invalid bytecode index; must be instruction index");
|
||||
guarantee(block != nullptr, "invalid bytecode index; must be instruction index");
|
||||
assert(bci >= block->start_bci() && bci < block->limit_bci(), "block must contain bci.");
|
||||
|
||||
answer = block->get_liveness_at(method(), bci);
|
||||
@ -411,9 +411,9 @@ MethodLiveness::BasicBlock::BasicBlock(MethodLiveness *analyzer, int start, int
|
||||
_start_bci = start;
|
||||
_limit_bci = limit;
|
||||
_normal_predecessors =
|
||||
new (analyzer->arena()) GrowableArray<MethodLiveness::BasicBlock*>(analyzer->arena(), 5, 0, NULL);
|
||||
new (analyzer->arena()) GrowableArray<MethodLiveness::BasicBlock*>(analyzer->arena(), 5, 0, nullptr);
|
||||
_exception_predecessors =
|
||||
new (analyzer->arena()) GrowableArray<MethodLiveness::BasicBlock*>(analyzer->arena(), 5, 0, NULL);
|
||||
new (analyzer->arena()) GrowableArray<MethodLiveness::BasicBlock*>(analyzer->arena(), 5, 0, nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -72,21 +72,21 @@
|
||||
#define RANGESLASH "[*" RANGEBASE "/]"
|
||||
|
||||
MethodMatcher::MethodMatcher():
|
||||
_class_name(NULL)
|
||||
, _method_name(NULL)
|
||||
, _signature(NULL)
|
||||
_class_name(nullptr)
|
||||
, _method_name(nullptr)
|
||||
, _signature(nullptr)
|
||||
, _class_mode(Exact)
|
||||
, _method_mode(Exact) {
|
||||
}
|
||||
|
||||
MethodMatcher::~MethodMatcher() {
|
||||
if (_class_name != NULL) {
|
||||
if (_class_name != nullptr) {
|
||||
_class_name->decrement_refcount();
|
||||
}
|
||||
if (_method_name != NULL) {
|
||||
if (_method_name != nullptr) {
|
||||
_method_name->decrement_refcount();
|
||||
}
|
||||
if (_signature != NULL) {
|
||||
if (_signature != nullptr) {
|
||||
_signature->decrement_refcount();
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,7 @@ void MethodMatcher::init(Symbol* class_name, Mode class_mode,
|
||||
|
||||
bool MethodMatcher::canonicalize(char * line, const char *& error_msg) {
|
||||
char* colon = strstr(line, "::");
|
||||
bool have_colon = (colon != NULL);
|
||||
bool have_colon = (colon != nullptr);
|
||||
if (have_colon) {
|
||||
// Don't allow multiple '::'
|
||||
if (colon[2] != '\0') {
|
||||
@ -114,7 +114,7 @@ bool MethodMatcher::canonicalize(char * line, const char *& error_msg) {
|
||||
}
|
||||
|
||||
char* pos = line;
|
||||
if (pos != NULL) {
|
||||
if (pos != nullptr) {
|
||||
for (char* lp = pos + 1; *lp != '\0'; lp++) {
|
||||
if (*lp == '(') {
|
||||
break;
|
||||
@ -130,7 +130,7 @@ bool MethodMatcher::canonicalize(char * line, const char *& error_msg) {
|
||||
// Don't allow mixed package separators
|
||||
char* pos = strchr(line, '.');
|
||||
bool in_signature = false;
|
||||
if (pos != NULL) {
|
||||
if (pos != nullptr) {
|
||||
for (char* lp = pos + 1; *lp != '\0'; lp++) {
|
||||
if (*lp == '(') {
|
||||
in_signature = true;
|
||||
@ -210,7 +210,7 @@ bool MethodMatcher::match(Symbol* candidate, Symbol* match, Mode match_mode) con
|
||||
}
|
||||
|
||||
case Substring:
|
||||
return strstr(candidate_string, match_string) != NULL;
|
||||
return strstr(candidate_string, match_string) != nullptr;
|
||||
|
||||
default:
|
||||
return false;
|
||||
@ -238,7 +238,7 @@ static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) {
|
||||
return MethodMatcher::Any;
|
||||
}
|
||||
|
||||
if (strstr(name, "*") != NULL) {
|
||||
if (strstr(name, "*") != nullptr) {
|
||||
error_msg = " Embedded * not allowed";
|
||||
return MethodMatcher::Unknown;
|
||||
}
|
||||
@ -264,10 +264,10 @@ void MethodMatcher::parse_method_pattern(char*& line, const char*& error_msg, Me
|
||||
int bytes_read = 0;
|
||||
int total_bytes_read = 0;
|
||||
|
||||
assert(error_msg == NULL, "Dont call here with error_msg already set");
|
||||
assert(error_msg == nullptr, "Dont call here with error_msg already set");
|
||||
|
||||
if (!MethodMatcher::canonicalize(line, error_msg)) {
|
||||
assert(error_msg != NULL, "Message must be set if parsing failed");
|
||||
assert(error_msg != nullptr, "Message must be set if parsing failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -288,20 +288,20 @@ void MethodMatcher::parse_method_pattern(char*& line, const char*& error_msg, Me
|
||||
if ((OptionType::Unknown != CompilerOracle::parse_option_type(method_name) ||
|
||||
CompileCommand::Unknown != CompilerOracle::parse_option_name(method_name)) &&
|
||||
*(line + bytes_read) != '\0' &&
|
||||
strstr(line + bytes_read, method_name) == NULL) {
|
||||
strstr(line + bytes_read, method_name) == nullptr) {
|
||||
error_msg = "Did not specify any method name";
|
||||
method_name[0] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
if ((strchr(class_name, JVM_SIGNATURE_SPECIAL) != NULL) ||
|
||||
(strchr(class_name, JVM_SIGNATURE_ENDSPECIAL) != NULL)) {
|
||||
if ((strchr(class_name, JVM_SIGNATURE_SPECIAL) != nullptr) ||
|
||||
(strchr(class_name, JVM_SIGNATURE_ENDSPECIAL) != nullptr)) {
|
||||
error_msg = "Chars '<' and '>' not allowed in class name";
|
||||
return;
|
||||
}
|
||||
|
||||
if ((strchr(method_name, JVM_SIGNATURE_SPECIAL) != NULL) ||
|
||||
(strchr(method_name, JVM_SIGNATURE_ENDSPECIAL) != NULL)) {
|
||||
if ((strchr(method_name, JVM_SIGNATURE_SPECIAL) != nullptr) ||
|
||||
(strchr(method_name, JVM_SIGNATURE_ENDSPECIAL) != nullptr)) {
|
||||
if (!vmSymbols::object_initializer_name()->equals(method_name) &&
|
||||
!vmSymbols::class_initializer_name()->equals(method_name)) {
|
||||
error_msg = "Chars '<' and '>' only allowed in <init> and <clinit>";
|
||||
@ -310,12 +310,12 @@ void MethodMatcher::parse_method_pattern(char*& line, const char*& error_msg, Me
|
||||
}
|
||||
|
||||
if (c_match == MethodMatcher::Unknown || m_match == MethodMatcher::Unknown) {
|
||||
assert(error_msg != NULL, "Must have been set by check_mode()");
|
||||
assert(error_msg != nullptr, "Must have been set by check_mode()");
|
||||
return;
|
||||
}
|
||||
|
||||
EXCEPTION_MARK;
|
||||
Symbol* signature = NULL;
|
||||
Symbol* signature = nullptr;
|
||||
line += bytes_read;
|
||||
bytes_read = 0;
|
||||
|
||||
@ -328,7 +328,7 @@ void MethodMatcher::parse_method_pattern(char*& line, const char*& error_msg, Me
|
||||
sig[0] = '(';
|
||||
// scan the rest
|
||||
if (1 == sscanf(line, "%1022[[);/" RANGEBASE "]%n", sig+1, &bytes_read)) {
|
||||
if (strchr(sig, '*') != NULL) {
|
||||
if (strchr(sig, '*') != nullptr) {
|
||||
error_msg = " Wildcard * not allowed in signature";
|
||||
return;
|
||||
}
|
||||
@ -353,7 +353,7 @@ bool MethodMatcher::matches(const methodHandle& method) const {
|
||||
|
||||
if (match(class_name, this->class_name(), _class_mode) &&
|
||||
match(method_name, this->method_name(), _method_mode) &&
|
||||
((this->signature() == NULL) || match(signature, this->signature(), Prefix))) {
|
||||
((this->signature() == nullptr) || match(signature, this->signature(), Prefix))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -377,18 +377,18 @@ void MethodMatcher::print_base(outputStream* st) {
|
||||
print_symbol(st, class_name(), _class_mode);
|
||||
st->print(".");
|
||||
print_symbol(st, method_name(), _method_mode);
|
||||
if (signature() != NULL) {
|
||||
if (signature() != nullptr) {
|
||||
signature()->print_utf8_on(st);
|
||||
}
|
||||
}
|
||||
|
||||
BasicMatcher* BasicMatcher::parse_method_pattern(char* line, const char*& error_msg, bool expect_trailing_chars) {
|
||||
assert(error_msg == NULL, "Don't call here with error_msg already set");
|
||||
assert(error_msg == nullptr, "Don't call here with error_msg already set");
|
||||
BasicMatcher* bm = new BasicMatcher();
|
||||
MethodMatcher::parse_method_pattern(line, error_msg, bm);
|
||||
if (error_msg != NULL) {
|
||||
if (error_msg != nullptr) {
|
||||
delete bm;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (!expect_trailing_chars) {
|
||||
// check for bad trailing characters
|
||||
@ -397,14 +397,14 @@ BasicMatcher* BasicMatcher::parse_method_pattern(char* line, const char*& error_
|
||||
if (line[bytes_read] != '\0') {
|
||||
error_msg = "Unrecognized trailing text after method pattern";
|
||||
delete bm;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return bm;
|
||||
}
|
||||
|
||||
bool BasicMatcher::match(const methodHandle& method) {
|
||||
for (BasicMatcher* current = this; current != NULL; current = current->next()) {
|
||||
for (BasicMatcher* current = this; current != nullptr; current = current->next()) {
|
||||
if (current->matches(method)) {
|
||||
return true;
|
||||
}
|
||||
@ -422,18 +422,18 @@ void InlineMatcher::print(outputStream* st) {
|
||||
}
|
||||
|
||||
InlineMatcher* InlineMatcher::parse_method_pattern(char* line, const char*& error_msg) {
|
||||
assert(error_msg == NULL, "Dont call here with error_msg already set");
|
||||
assert(error_msg == nullptr, "Dont call here with error_msg already set");
|
||||
InlineMatcher* im = new InlineMatcher();
|
||||
MethodMatcher::parse_method_pattern(line, error_msg, im);
|
||||
if (error_msg != NULL) {
|
||||
if (error_msg != nullptr) {
|
||||
delete im;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return im;
|
||||
}
|
||||
|
||||
bool InlineMatcher::match(const methodHandle& method, int inline_action) {
|
||||
for (InlineMatcher* current = this; current != NULL; current = current->next()) {
|
||||
for (InlineMatcher* current = this; current != nullptr; current = current->next()) {
|
||||
if (current->matches(method)) {
|
||||
return (current->_inline_action == inline_action);
|
||||
}
|
||||
@ -453,15 +453,15 @@ InlineMatcher* InlineMatcher::parse_inline_pattern(char* str, const char*& error
|
||||
break;
|
||||
default:
|
||||
error_msg = "Missing leading inline type (+/-)";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
str++;
|
||||
|
||||
assert(error_msg == NULL, "error_msg must not be set yet");
|
||||
assert(error_msg == nullptr, "error_msg must not be set yet");
|
||||
InlineMatcher* im = InlineMatcher::parse_method_pattern(str, error_msg);
|
||||
if (im == NULL) {
|
||||
assert(error_msg != NULL, "Must have error message");
|
||||
return NULL;
|
||||
if (im == nullptr) {
|
||||
assert(error_msg != nullptr, "Must have error message");
|
||||
return nullptr;
|
||||
}
|
||||
im->set_action(_inline_action);
|
||||
return im;
|
||||
@ -473,15 +473,15 @@ InlineMatcher* InlineMatcher::clone() {
|
||||
m->_method_mode = _method_mode;
|
||||
m->_inline_action = _inline_action;
|
||||
m->_class_name = _class_name;
|
||||
if(_class_name != NULL) {
|
||||
if(_class_name != nullptr) {
|
||||
_class_name->increment_refcount();
|
||||
}
|
||||
m->_method_name = _method_name;
|
||||
if (_method_name != NULL) {
|
||||
if (_method_name != nullptr) {
|
||||
_method_name->increment_refcount();
|
||||
}
|
||||
m->_signature = _signature;
|
||||
if (_signature != NULL) {
|
||||
if (_signature != nullptr) {
|
||||
_signature->increment_refcount();
|
||||
}
|
||||
return m;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -74,7 +74,7 @@ private:
|
||||
public:
|
||||
|
||||
BasicMatcher() : MethodMatcher(),
|
||||
_next(NULL) {
|
||||
_next(nullptr) {
|
||||
}
|
||||
|
||||
BasicMatcher(BasicMatcher* next) :
|
||||
@ -89,7 +89,7 @@ public:
|
||||
void print(outputStream* st) { print_base(st); }
|
||||
void print_all(outputStream* st) {
|
||||
print_base(st);
|
||||
if (_next != NULL) {
|
||||
if (_next != nullptr) {
|
||||
_next->print_all(st);
|
||||
}
|
||||
}
|
||||
@ -108,7 +108,7 @@ private:
|
||||
InlineMatcher * _next;
|
||||
|
||||
InlineMatcher() : MethodMatcher(),
|
||||
_inline_action(unknown_inline), _next(NULL) {
|
||||
_inline_action(unknown_inline), _next(nullptr) {
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -443,7 +443,7 @@ void OopMapSet::oops_do(const frame *fr, const RegisterMap* reg_map, OopClosure*
|
||||
|
||||
void ImmutableOopMap::oops_do(const frame *fr, const RegisterMap *reg_map,
|
||||
OopClosure* oop_fn, DerivedOopClosure* derived_oop_fn) const {
|
||||
assert(derived_oop_fn != NULL, "sanity");
|
||||
assert(derived_oop_fn != nullptr, "sanity");
|
||||
OopMapDo<OopClosure, DerivedOopClosure, SkipNullValue> visitor(oop_fn, derived_oop_fn);
|
||||
visitor.oops_do(fr, reg_map, this);
|
||||
}
|
||||
@ -506,9 +506,9 @@ static void update_register_map1(const ImmutableOopMap* oopmap, const frame* fr,
|
||||
// Update callee-saved register info for the following frame
|
||||
void ImmutableOopMap::update_register_map(const frame *fr, RegisterMap *reg_map) const {
|
||||
CodeBlob* cb = fr->cb();
|
||||
assert(cb != NULL, "no codeblob");
|
||||
assert(cb != nullptr, "no codeblob");
|
||||
// Any reg might be saved by a safepoint handler (see generate_handler_blob).
|
||||
assert( reg_map->_update_for_id == NULL || fr->is_older(reg_map->_update_for_id),
|
||||
assert( reg_map->_update_for_id == nullptr || fr->is_older(reg_map->_update_for_id),
|
||||
"already updated this map; do not 'update' it twice!" );
|
||||
debug_only(reg_map->_update_for_id = fr->id());
|
||||
|
||||
@ -525,7 +525,7 @@ void ImmutableOopMap::update_register_map(const frame *fr, RegisterMap *reg_map)
|
||||
|
||||
// Check that runtime stubs save all callee-saved registers
|
||||
#ifdef COMPILER2
|
||||
assert(cb == NULL || cb->is_compiled_by_c1() || cb->is_compiled_by_jvmci() || !cb->is_runtime_stub() ||
|
||||
assert(cb == nullptr || cb->is_compiled_by_c1() || cb->is_compiled_by_jvmci() || !cb->is_runtime_stub() ||
|
||||
(nof_callee >= SAVED_ON_ENTRY_REG_COUNT || nof_callee >= C_SAVED_ON_ENTRY_REG_COUNT),
|
||||
"must save all");
|
||||
#endif // COMPILER2
|
||||
@ -536,9 +536,9 @@ const ImmutableOopMap* OopMapSet::find_map(const frame *fr) {
|
||||
}
|
||||
|
||||
const ImmutableOopMap* OopMapSet::find_map(const CodeBlob* cb, address pc) {
|
||||
assert(cb != NULL, "no codeblob");
|
||||
assert(cb != nullptr, "no codeblob");
|
||||
const ImmutableOopMap* map = cb->oop_map_for_return_address(pc);
|
||||
assert(map != NULL, "no ptr map found");
|
||||
assert(map != nullptr, "no ptr map found");
|
||||
return map;
|
||||
}
|
||||
|
||||
@ -572,7 +572,7 @@ void OopMapSet::trace_codeblob_maps(const frame *fr, const RegisterMap *reg_map)
|
||||
fr->print_on(tty);
|
||||
tty->print(" ");
|
||||
cb->print_value_on(tty); tty->cr();
|
||||
if (reg_map != NULL) {
|
||||
if (reg_map != nullptr) {
|
||||
reg_map->print();
|
||||
}
|
||||
tty->print_cr("------ ");
|
||||
@ -640,7 +640,7 @@ void OopMap::print_on(outputStream* st) const {
|
||||
void OopMap::print() const { print_on(tty); }
|
||||
|
||||
void ImmutableOopMapSet::print_on(outputStream* st) const {
|
||||
const ImmutableOopMap* last = NULL;
|
||||
const ImmutableOopMap* last = nullptr;
|
||||
const int len = count();
|
||||
|
||||
st->print_cr("ImmutableOopMapSet contains %d OopMaps", len);
|
||||
@ -704,7 +704,7 @@ int ImmutableOopMapSet::find_slot_for_offset(int pc_offset) const {
|
||||
|
||||
const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const {
|
||||
ImmutableOopMapPair* pairs = get_pairs();
|
||||
ImmutableOopMapPair* last = NULL;
|
||||
ImmutableOopMapPair* last = nullptr;
|
||||
|
||||
for (int i = 0; i < _count; ++i) {
|
||||
if (pairs[i].pc_offset() >= pc_offset) {
|
||||
@ -714,7 +714,7 @@ const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) con
|
||||
}
|
||||
|
||||
// Heal Coverity issue: potential index out of bounds access.
|
||||
guarantee(last != NULL, "last may not be null");
|
||||
guarantee(last != nullptr, "last may not be null");
|
||||
assert(last->pc_offset() == pc_offset, "oopmap not found");
|
||||
return last->get_from(this);
|
||||
}
|
||||
@ -747,7 +747,7 @@ int ImmutableOopMap::nr_of_bytes() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
ImmutableOopMapBuilder::ImmutableOopMapBuilder(const OopMapSet* set) : _set(set), _empty(NULL), _last(NULL), _empty_offset(-1), _last_offset(-1), _offset(0), _required(-1), _new_set(NULL) {
|
||||
ImmutableOopMapBuilder::ImmutableOopMapBuilder(const OopMapSet* set) : _set(set), _empty(nullptr), _last(nullptr), _empty_offset(-1), _last_offset(-1), _offset(0), _required(-1), _new_set(nullptr) {
|
||||
_mapping = NEW_RESOURCE_ARRAY(Mapping, _set->size());
|
||||
}
|
||||
|
||||
@ -816,7 +816,7 @@ void ImmutableOopMapBuilder::fill(ImmutableOopMapSet* set, int sz) {
|
||||
|
||||
for (int i = 0; i < set->count(); ++i) {
|
||||
const OopMap* map = _mapping[i]._map;
|
||||
ImmutableOopMapPair* pair = NULL;
|
||||
ImmutableOopMapPair* pair = nullptr;
|
||||
int size = 0;
|
||||
|
||||
if (_mapping[i]._kind == Mapping::OOPMAP_NEW) {
|
||||
@ -885,7 +885,7 @@ class DerivedPointerTable::Entry : public CHeapObj<mtCompiler> {
|
||||
|
||||
public:
|
||||
Entry(derived_pointer* location, intptr_t offset) :
|
||||
_location(location), _offset(offset), _next(NULL) {}
|
||||
_location(location), _offset(offset), _next(nullptr) {}
|
||||
|
||||
derived_pointer* location() const { return _location; }
|
||||
intptr_t offset() const { return _offset; }
|
||||
@ -895,11 +895,11 @@ public:
|
||||
static List* _list;
|
||||
};
|
||||
|
||||
DerivedPointerTable::Entry::List* DerivedPointerTable::Entry::_list = NULL;
|
||||
DerivedPointerTable::Entry::List* DerivedPointerTable::Entry::_list = nullptr;
|
||||
bool DerivedPointerTable::_active = false;
|
||||
|
||||
bool DerivedPointerTable::is_empty() {
|
||||
return Entry::_list == NULL || Entry::_list->empty();
|
||||
return Entry::_list == nullptr || Entry::_list->empty();
|
||||
}
|
||||
|
||||
void DerivedPointerTable::clear() {
|
||||
@ -908,7 +908,7 @@ void DerivedPointerTable::clear() {
|
||||
// update_pointers after last GC/Scavenge.
|
||||
assert (!_active, "should not be active");
|
||||
assert(is_empty(), "table not empty");
|
||||
if (Entry::_list == NULL) {
|
||||
if (Entry::_list == nullptr) {
|
||||
void* mem = NEW_C_HEAP_OBJ(Entry::List, mtCompiler);
|
||||
Entry::_list = ::new (mem) Entry::List();
|
||||
}
|
||||
@ -921,7 +921,7 @@ void DerivedPointerTable::add(derived_pointer* derived_loc, oop *base_loc) {
|
||||
derived_pointer base_loc_as_derived_pointer =
|
||||
static_cast<derived_pointer>(reinterpret_cast<intptr_t>(base_loc));
|
||||
assert(*derived_loc != base_loc_as_derived_pointer, "location already added");
|
||||
assert(Entry::_list != NULL, "list must exist");
|
||||
assert(Entry::_list != nullptr, "list must exist");
|
||||
assert(is_active(), "table must be active here");
|
||||
intptr_t offset = *derived_loc - to_derived_pointer(*base_loc);
|
||||
// This assert is invalid because derived pointers can be
|
||||
@ -943,9 +943,9 @@ void DerivedPointerTable::add(derived_pointer* derived_loc, oop *base_loc) {
|
||||
}
|
||||
|
||||
void DerivedPointerTable::update_pointers() {
|
||||
assert(Entry::_list != NULL, "list must exist");
|
||||
assert(Entry::_list != nullptr, "list must exist");
|
||||
Entry* entries = Entry::_list->pop_all();
|
||||
while (entries != NULL) {
|
||||
while (entries != nullptr) {
|
||||
Entry* entry = entries;
|
||||
entries = entry->next();
|
||||
derived_pointer* derived_loc = entry->location();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -230,7 +230,7 @@ class OopMapSet : public ResourceObj {
|
||||
// Collect OopMaps.
|
||||
int add_gc_map(int pc, OopMap* map);
|
||||
|
||||
// Methods oops_do() and all_do() filter out NULL oops and
|
||||
// Methods oops_do() and all_do() filter out nullptr oops and
|
||||
// oop == CompressedOops::base() before passing oops
|
||||
// to closures.
|
||||
|
||||
@ -404,7 +404,7 @@ private:
|
||||
const OopMap* _map;
|
||||
const OopMap* _other;
|
||||
|
||||
Mapping() : _kind(OOPMAP_UNKNOWN), _offset(-1), _size(-1), _map(NULL) {}
|
||||
Mapping() : _kind(OOPMAP_UNKNOWN), _offset(-1), _size(-1), _map(nullptr) {}
|
||||
|
||||
void set(kind_t kind, int offset, int size, const OopMap* map = 0, const OopMap* other = 0) {
|
||||
_kind = kind;
|
||||
@ -427,7 +427,7 @@ private:
|
||||
}
|
||||
|
||||
bool is_last_duplicate(const OopMap* map) {
|
||||
if (_last != NULL && _last->count() > 0 && _last->equals(map)) {
|
||||
if (_last != nullptr && _last->count() > 0 && _last->equals(map)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -48,14 +48,14 @@ inline const ImmutableOopMap* ImmutableOopMapPair::get_from(const ImmutableOopMa
|
||||
}
|
||||
|
||||
inline bool SkipNullValue::should_skip(oop val) {
|
||||
return val == (oop)NULL || CompressedOops::is_base(val);
|
||||
return val == (oop)nullptr || CompressedOops::is_base(val);
|
||||
}
|
||||
|
||||
template <typename OopFnT, typename DerivedOopFnT, typename ValueFilterT>
|
||||
template <typename RegisterMapT>
|
||||
void OopMapDo<OopFnT, DerivedOopFnT, ValueFilterT>::iterate_oops_do(const frame *fr, const RegisterMapT *reg_map, const ImmutableOopMap* oopmap) {
|
||||
NOT_PRODUCT(if (TraceCodeBlobStacks) OopMapSet::trace_codeblob_maps(fr, reg_map->as_RegisterMap());)
|
||||
assert(fr != NULL, "");
|
||||
assert(fr != nullptr, "");
|
||||
|
||||
// handle derived pointers first (otherwise base pointer may be
|
||||
// changed before derived pointer offset has been collected)
|
||||
@ -76,21 +76,21 @@ void OopMapDo<OopFnT, DerivedOopFnT, ValueFilterT>::iterate_oops_do(const frame
|
||||
|
||||
address loc = fr->oopmapreg_to_location(omv.reg(), reg_map);
|
||||
|
||||
DEBUG_ONLY(if (loc == NULL && reg_map->should_skip_missing()) continue;)
|
||||
DEBUG_ONLY(if (loc == nullptr && reg_map->should_skip_missing()) continue;)
|
||||
|
||||
if (loc == NULL) {
|
||||
if (loc == nullptr) {
|
||||
tty->print("oops reg: "); omv.reg()->print_on(tty); tty->cr();
|
||||
fr->print_on(tty);
|
||||
}
|
||||
guarantee(loc != NULL, "missing saved register");
|
||||
guarantee(loc != nullptr, "missing saved register");
|
||||
derived_pointer* derived_loc = (derived_pointer*)loc;
|
||||
oop* base_loc = fr->oopmapreg_to_oop_location(omv.content_reg(), reg_map);
|
||||
// Ignore NULL oops and decoded NULL narrow oops which
|
||||
// Ignore nullptr oops and decoded nullptr narrow oops which
|
||||
// equal to CompressedOops::base() when a narrow oop
|
||||
// implicit null check is used in compiled code.
|
||||
// The narrow_oop_base could be NULL or be the address
|
||||
// The narrow_oop_base could be nullptr or be the address
|
||||
// of the page below heap depending on compressed oops mode.
|
||||
if (base_loc != NULL && *base_loc != (oop)NULL && !CompressedOops::is_base(*base_loc)) {
|
||||
if (base_loc != nullptr && *base_loc != (oop)nullptr && !CompressedOops::is_base(*base_loc)) {
|
||||
_derived_oop_fn->do_derived_oop(base_loc, derived_loc);
|
||||
}
|
||||
}
|
||||
@ -108,7 +108,7 @@ void OopMapDo<OopFnT, DerivedOopFnT, ValueFilterT>::iterate_oops_do(const frame
|
||||
// this was allowed previously because value_value items might
|
||||
// be missing?
|
||||
#ifdef ASSERT
|
||||
if (loc == NULL) {
|
||||
if (loc == nullptr) {
|
||||
if (reg_map->should_skip_missing())
|
||||
continue;
|
||||
VMReg reg = omv.reg();
|
||||
@ -116,18 +116,18 @@ void OopMapDo<OopFnT, DerivedOopFnT, ValueFilterT>::iterate_oops_do(const frame
|
||||
fr->print_on(tty);
|
||||
}
|
||||
#endif
|
||||
if (loc == NULL) {
|
||||
if (loc == nullptr) {
|
||||
tty->print("oops reg: "); omv.reg()->print_on(tty); tty->cr();
|
||||
fr->print_on(tty);
|
||||
}
|
||||
guarantee(loc != NULL, "missing saved register");
|
||||
guarantee(loc != nullptr, "missing saved register");
|
||||
if ( omv.type() == OopMapValue::oop_value ) {
|
||||
oop val = *loc;
|
||||
if (ValueFilterT::should_skip(val)) { // TODO: UGLY (basically used to decide if we're freezing/thawing continuation)
|
||||
// Ignore NULL oops and decoded NULL narrow oops which
|
||||
// Ignore nullptr oops and decoded nullptr narrow oops which
|
||||
// equal to CompressedOops::base() when a narrow oop
|
||||
// implicit null check is used in compiled code.
|
||||
// The narrow_oop_base could be NULL or be the address
|
||||
// The narrow_oop_base could be nullptr or be the address
|
||||
// of the page below heap depending on compressed oops mode.
|
||||
continue;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user