Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/jvmci/jvmciRuntime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ class JVMCIRuntime: public CHeapObj<mtJVMCI> {

// 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);
Expand Down