diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp index d490b75919d2a..5ea4336f35e5a 100644 --- a/src/hotspot/share/ci/ciReplay.cpp +++ b/src/hotspot/share/ci/ciReplay.cpp @@ -806,7 +806,7 @@ class CompileReplay : public StackObj { } replay_state = this; CompileBroker::compile_method(methodHandle(THREAD, method), entry_bci, comp_level, - methodHandle(), 0, CompileTask::Reason_Replay, THREAD); + 0, CompileTask::Reason_Replay, THREAD); replay_state = nullptr; } diff --git a/src/hotspot/share/compiler/compilationPolicy.cpp b/src/hotspot/share/compiler/compilationPolicy.cpp index fa18b3c8ab4c0..9885136bed244 100644 --- a/src/hotspot/share/compiler/compilationPolicy.cpp +++ b/src/hotspot/share/compiler/compilationPolicy.cpp @@ -104,7 +104,7 @@ void CompilationPolicy::compile_if_required(const methodHandle& m, TRAPS) { if (PrintTieredEvents) { print_event(COMPILE, m(), m(), InvocationEntryBci, level); } - CompileBroker::compile_method(m, InvocationEntryBci, level, methodHandle(), 0, CompileTask::Reason_MustBeCompiled, THREAD); + CompileBroker::compile_method(m, InvocationEntryBci, level, 0, CompileTask::Reason_MustBeCompiled, THREAD); } } @@ -812,7 +812,7 @@ void CompilationPolicy::compile(const methodHandle& mh, int bci, CompLevel level } int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count(); update_rate(nanos_to_millis(os::javaTimeNanos()), mh); - CompileBroker::compile_method(mh, bci, level, mh, hot_count, CompileTask::Reason_Tiered, THREAD); + CompileBroker::compile_method(mh, bci, level, hot_count, CompileTask::Reason_Tiered, THREAD); } } diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index 168679feb9ba1..6dedc87302878 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -398,7 +398,6 @@ CompileTask* CompileQueue::get(CompilerThread* thread) { // save methods from RedefineClasses across safepoint // across MethodCompileQueue_lock below. methodHandle save_method; - methodHandle save_hot_method; MonitorLocker locker(MethodCompileQueue_lock); // If _first is null we have no more compile jobs. There are two reasons for @@ -453,7 +452,6 @@ CompileTask* CompileQueue::get(CompilerThread* thread) { // the compilation queue, which is walked during RedefineClasses. Thread* thread = Thread::current(); save_method = methodHandle(thread, task->method()); - save_hot_method = methodHandle(thread, task->hot_method()); remove(task); } @@ -1154,7 +1152,6 @@ void CompileBroker::mark_on_stack() { void CompileBroker::compile_method_base(const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, CompileTask::CompileReason compile_reason, bool blocking, @@ -1173,13 +1170,8 @@ void CompileBroker::compile_method_base(const methodHandle& method, tty->print(" osr_bci: %d", osr_bci); } tty->print(" level: %d comment: %s count: %d", comp_level, CompileTask::reason_name(compile_reason), hot_count); - if (!hot_method.is_null()) { - tty->print(" hot: "); - if (hot_method() != method()) { - hot_method->print_short_name(tty); - } else { - tty->print("yes"); - } + if (hot_count > 0) { + tty->print(" hot: yes"); } tty->cr(); } @@ -1326,7 +1318,7 @@ void CompileBroker::compile_method_base(const methodHandle& method, task = create_compile_task(queue, compile_id, method, osr_bci, comp_level, - hot_method, hot_count, compile_reason, + hot_count, compile_reason, blocking); } @@ -1337,7 +1329,7 @@ void CompileBroker::compile_method_base(const methodHandle& method, nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, + int hot_count, CompileTask::CompileReason compile_reason, TRAPS) { // Do nothing if compilebroker is not initialized or compiles are submitted on level none @@ -1357,14 +1349,14 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp); // CompileBroker::compile_method can trap and can have pending async exception. - nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, compile_reason, directive, THREAD); + nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_count, compile_reason, directive, THREAD); DirectivesStack::release(directive); return nm; } nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, + int hot_count, CompileTask::CompileReason compile_reason, DirectiveSet* directive, TRAPS) { @@ -1460,7 +1452,7 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, 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); + compile_method_base(method, osr_bci, comp_level, hot_count, compile_reason, is_blocking, THREAD); } // return requested nmethod @@ -1607,13 +1599,12 @@ CompileTask* CompileBroker::create_compile_task(CompileQueue* queue, const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, CompileTask::CompileReason compile_reason, bool blocking) { CompileTask* new_task = CompileTask::allocate(); new_task->initialize(compile_id, method, osr_bci, comp_level, - hot_method, hot_count, compile_reason, + hot_count, compile_reason, blocking); queue->add(new_task); return new_task; diff --git a/src/hotspot/share/compiler/compileBroker.hpp b/src/hotspot/share/compiler/compileBroker.hpp index 77662692f565f..a9f90c3e6183f 100644 --- a/src/hotspot/share/compiler/compileBroker.hpp +++ b/src/hotspot/share/compiler/compileBroker.hpp @@ -267,7 +267,6 @@ class CompileBroker: AllStatic { const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, CompileTask::CompileReason compile_reason, bool blocking); @@ -288,7 +287,6 @@ class CompileBroker: AllStatic { static void compile_method_base(const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, CompileTask::CompileReason compile_reason, bool blocking, @@ -322,7 +320,6 @@ class CompileBroker: AllStatic { static nmethod* compile_method(const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, CompileTask::CompileReason compile_reason, TRAPS); @@ -333,7 +330,6 @@ class CompileBroker: AllStatic { static nmethod* compile_method(const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, CompileTask::CompileReason compile_reason, DirectiveSet* directive, diff --git a/src/hotspot/share/compiler/compileTask.cpp b/src/hotspot/share/compiler/compileTask.cpp index fd066a9bc87ff..b6ce7609f63f8 100644 --- a/src/hotspot/share/compiler/compileTask.cpp +++ b/src/hotspot/share/compiler/compileTask.cpp @@ -66,13 +66,10 @@ 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 != nullptr && JNIHandles::is_weak_global_handle(task->_method_holder)) || - (task->_hot_method_holder != nullptr && JNIHandles::is_weak_global_handle(task->_hot_method_holder))) { + if ((task->_method_holder != nullptr && JNIHandles::is_weak_global_handle(task->_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 != nullptr) { os::free((void*) task->_failure_reason); @@ -90,7 +87,6 @@ void CompileTask::initialize(int compile_id, const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, CompileTask::CompileReason compile_reason, bool is_blocking) { @@ -112,8 +108,6 @@ void CompileTask::initialize(int compile_id, _is_complete = false; _is_success = false; - _hot_method = nullptr; - _hot_method_holder = nullptr; _hot_count = hot_count; _time_queued = os::elapsed_counter(); _time_started = 0; @@ -127,18 +121,6 @@ void CompileTask::initialize(int compile_id, _failure_reason_on_C_heap = false; _arena_bytes = 0; - if (LogCompilation) { - if (hot_method.not_null()) { - if (hot_method == method) { - _hot_method = _method; - } else { - _hot_method = hot_method(); - // only add loader or mirror if different from _method_holder - _hot_method_holder = JNIHandles::make_weak_global(Handle(thread, hot_method->method_holder()->klass_holder())); - } - } - } - _next = nullptr; } @@ -159,11 +141,7 @@ CompileTask* CompileTask::select_for_compilation() { assert(_method->method_holder()->is_loader_alive(), "should be alive"); Handle method_holder(thread, _method->method_holder()->klass_holder()); JNIHandles::destroy_weak_global(_method_holder); - JNIHandles::destroy_weak_global(_hot_method_holder); _method_holder = JNIHandles::make_global(method_holder); - if (_hot_method != nullptr) { - _hot_method_holder = JNIHandles::make_global(Handle(thread, _hot_method->method_holder()->klass_holder())); - } return this; } @@ -173,9 +151,6 @@ void CompileTask::mark_on_stack() { } // Mark these methods as something redefine classes cannot remove. _method->set_on_stack(true); - if (_hot_method != nullptr) { - _hot_method->set_on_stack(true); - } } bool CompileTask::is_unloaded() const { @@ -188,9 +163,6 @@ void CompileTask::metadata_do(MetadataClosure* f) { return; } f->do_metadata(method()); - if (hot_method() != nullptr && hot_method() != method()) { - f->do_metadata(hot_method()); - } } // ------------------------------------------------------------------ @@ -329,9 +301,6 @@ 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 != nullptr && _hot_method != _method) { - xtty->method(_hot_method); - } if (_hot_count != 0) { xtty->print(" hot_count='%d'", _hot_count); } diff --git a/src/hotspot/share/compiler/compileTask.hpp b/src/hotspot/share/compiler/compileTask.hpp index 04ad7e35a139b..4df1533d32af6 100644 --- a/src/hotspot/share/compiler/compileTask.hpp +++ b/src/hotspot/share/compiler/compileTask.hpp @@ -106,8 +106,6 @@ class CompileTask : public CHeapObj { // Fields used for logging why the compilation was initiated: jlong _time_queued; // time when task was enqueued jlong _time_started; // time when compilation started - Method* _hot_method; // which method actually triggered this task - jobject _hot_method_holder; int _hot_count; // information about its invocation counter CompileReason _compile_reason; // more info about the task const char* _failure_reason; @@ -122,7 +120,7 @@ class CompileTask : public CHeapObj { } void initialize(int compile_id, const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, + int hot_count, CompileTask::CompileReason compile_reason, bool is_blocking); static CompileTask* allocate(); @@ -130,7 +128,6 @@ class CompileTask : public CHeapObj { int compile_id() const { return _compile_id; } Method* method() const { return _method; } - Method* hot_method() const { return _hot_method; } int osr_bci() const { return _osr_bci; } bool is_complete() const { return _is_complete; } bool is_blocking() const { return _is_blocking; } diff --git a/src/hotspot/share/jvmci/jvmciCompiler.cpp b/src/hotspot/share/jvmci/jvmciCompiler.cpp index 38bf9c438e7d0..006e76477aefc 100644 --- a/src/hotspot/share/jvmci/jvmciCompiler.cpp +++ b/src/hotspot/share/jvmci/jvmciCompiler.cpp @@ -89,7 +89,7 @@ void JVMCICompiler::bootstrap(TRAPS) { if (!mh->is_native() && !mh->is_static() && !mh->is_object_initializer() && !mh->is_static_initializer()) { ResourceMark rm; int hot_count = 10; // TODO: what's the appropriate value? - CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, mh, hot_count, CompileTask::Reason_Bootstrap, CHECK); + CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, hot_count, CompileTask::Reason_Bootstrap, CHECK); } } diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index 2e277ffadabd0..69b1b0a8b9758 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -1124,7 +1124,7 @@ bool WhiteBox::compile_method(Method* method, int comp_level, int bci, JavaThrea DirectivesStack::release(directive); // Compile method and check result - nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), CompileTask::Reason_Whitebox, CHECK_false); + nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh->invocation_count(), CompileTask::Reason_Whitebox, CHECK_false); MutexLocker mu(THREAD, Compile_lock); bool is_queued = mh->queued_for_compilation(); if ((!is_blocking && is_queued) || nm != nullptr) {