From 86dcfae867f21e4ee54affa3317f443ad6bf4ef7 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Tue, 30 May 2023 16:22:42 +0200 Subject: [PATCH] do not update decompile count when an invalid dependency at code installation is a call site dependency --- src/hotspot/share/jvmci/jvmciRuntime.cpp | 18 ++++++++++++++---- src/hotspot/share/jvmci/jvmciRuntime.hpp | 5 ++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index bdeb9cb6d7ea7..6a1bc38b4d50c 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -1966,7 +1966,12 @@ Method* JVMCIRuntime::get_method_by_index(const constantPoolHandle& cpool, // ------------------------------------------------------------------ // Check for changes to the system dictionary during compilation // class loads, evolution, breakpoints -JVMCI::CodeInstallResult JVMCIRuntime::validate_compile_task_dependencies(Dependencies* dependencies, JVMCICompileState* compile_state, char** failure_detail) { +JVMCI::CodeInstallResult JVMCIRuntime::validate_compile_task_dependencies(Dependencies* dependencies, + JVMCICompileState* compile_state, + char** failure_detail, + bool& failing_dep_is_call_site) +{ + failing_dep_is_call_site = false; // If JVMTI capabilities were enabled during compile, the compilation is invalidated. if (compile_state != nullptr && compile_state->jvmti_state_changed()) { *failure_detail = (char*) "Jvmti state change during compilation invalidated dependencies"; @@ -1975,10 +1980,13 @@ JVMCI::CodeInstallResult JVMCIRuntime::validate_compile_task_dependencies(Depend CompileTask* task = compile_state == nullptr ? nullptr : compile_state->task(); Dependencies::DepType result = dependencies->validate_dependencies(task, failure_detail); + if (result == Dependencies::end_marker) { return JVMCI::ok; } - + if (result == Dependencies::call_site_target_value) { + failing_dep_is_call_site = true; + } return JVMCI::dependencies_failed; } @@ -2167,11 +2175,13 @@ JVMCI::CodeInstallResult JVMCIRuntime::register_method(JVMCIEnv* JVMCIENV, } // Check for {class loads, evolution, breakpoints} during compilation - result = validate_compile_task_dependencies(dependencies, JVMCIENV->compile_state(), &failure_detail); + JVMCICompileState* compile_state = JVMCIENV->compile_state(); + bool failing_dep_is_call_site; + result = validate_compile_task_dependencies(dependencies, compile_state, &failure_detail, failing_dep_is_call_site); if (result != JVMCI::ok) { // While not a true deoptimization, it is a preemptive decompile. MethodData* mdp = method()->method_data(); - if (mdp != nullptr) { + if (mdp != nullptr && !failing_dep_is_call_site) { mdp->inc_decompile_count(); #ifdef ASSERT if (mdp->decompile_count() > (uint)PerMethodRecompilationCutoff) { diff --git a/src/hotspot/share/jvmci/jvmciRuntime.hpp b/src/hotspot/share/jvmci/jvmciRuntime.hpp index 5648a508b3a34..1d51f0ee31d03 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.hpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.hpp @@ -428,7 +428,10 @@ class JVMCIRuntime: public CHeapObj { // Helper routine for determining the validity of a compilation // with respect to concurrent class loading. - static JVMCI::CodeInstallResult validate_compile_task_dependencies(Dependencies* target, JVMCICompileState* task, char** failure_detail); + static JVMCI::CodeInstallResult validate_compile_task_dependencies(Dependencies* target, + JVMCICompileState* task, + char** failure_detail, + bool& failing_dep_is_call_site); // Compiles `target` with the JVMCI compiler. void compile_method(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, const methodHandle& target, int entry_bci);