Skip to content
Permalink
Browse files
8245126: Kitchensink fails with: assert(!method->is_old()) failed: Sh…
…ould not be installing old methods

Fix the method->is_old() assert

Reviewed-by: dlong, chagedorn
  • Loading branch information
Serguei Spitsyn committed Jun 11, 2020
1 parent 2ff9f53 commit 6d8c81f6941c99deb7eee885be8d7eba9612d1ad
Showing 5 changed files with 20 additions and 9 deletions.
@@ -41,6 +41,7 @@
#include "compiler/compileBroker.hpp"
#include "compiler/compilerEvent.hpp"
#include "compiler/compileLog.hpp"
#include "compiler/compileTask.hpp"
#include "compiler/disassembler.hpp"
#include "gc/shared/collectedHeap.inline.hpp"
#include "interpreter/linkResolver.hpp"
@@ -230,7 +231,7 @@ ciEnv::~ciEnv() {

// ------------------------------------------------------------------
// Cache Jvmti state
void ciEnv::cache_jvmti_state() {
bool ciEnv::cache_jvmti_state() {
VM_ENTRY_MARK;
// Get Jvmti capabilities under lock to get consistant values.
MutexLocker mu(JvmtiThreadState_lock);
@@ -240,6 +241,7 @@ void ciEnv::cache_jvmti_state() {
_jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
_jvmti_can_pop_frame = JvmtiExport::can_pop_frame();
_jvmti_can_get_owned_monitor_info = JvmtiExport::can_get_owned_monitor_info();
return _task != NULL && _task->method()->is_old();
}

bool ciEnv::jvmti_state_changed() const {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@@ -341,7 +341,7 @@ class ciEnv : StackObj {
void set_break_at_compile(bool z) { _break_at_compile = z; }

// Cache Jvmti state
void cache_jvmti_state();
bool cache_jvmti_state();
bool jvmti_state_changed() const;
bool should_retain_local_variables() const {
return _jvmti_can_access_local_variables || _jvmti_can_pop_frame;
@@ -2149,14 +2149,14 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {

TraceTime t1("compilation", &time);
EventCompilation event;
JVMCICompileState compile_state(task);

// Skip redefined methods
if (target_handle->is_old()) {
if (compile_state.target_method_is_old()) {
failure_reason = "redefined method";
retry_message = "not retryable";
compilable = ciEnv::MethodCompilable_never;
} else {
JVMCICompileState compile_state(task);
JVMCIEnv env(thread, &compile_state, __FILE__, __LINE__);
methodHandle method(thread, target_handle);
env.runtime()->compile_method(&env, jvmci, method, osr_bci);
@@ -2193,7 +2193,12 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
// The thread-env() field is cleared in ~CompileTaskWrapper.

// Cache Jvmti state
ci_env.cache_jvmti_state();
bool method_is_old = ci_env.cache_jvmti_state();

// Skip redefined methods
if (method_is_old) {
ci_env.record_method_not_compilable("redefined method", true);
}

// Cache DTrace flags
ci_env.cache_dtrace_flags();
@@ -2205,7 +2210,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {

if (comp == NULL) {
ci_env.record_method_not_compilable("no compiler", !TieredCompilation);
} else {
} else if (!ci_env.failing()) {
if (WhiteBoxAPI && WhiteBox::compilation_locked) {
MonitorLocker locker(Compilation_lock, Mutex::_no_safepoint_check_flag);
while (WhiteBox::compilation_locked) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@@ -26,6 +26,7 @@
#include "classfile/stringTable.hpp"
#include "classfile/symbolTable.hpp"
#include "code/codeCache.hpp"
#include "compiler/compileTask.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
@@ -49,6 +50,7 @@ JVMCICompileState::JVMCICompileState(CompileTask* task):
_jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables() ? 1 : 0;
_jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions() ? 1 : 0;
_jvmti_can_pop_frame = JvmtiExport::can_pop_frame() ? 1 : 0;
_target_method_is_old = _task != NULL && _task->method()->is_old();
}

bool JVMCICompileState::jvmti_state_changed() const {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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,6 +99,7 @@ class JVMCICompileState : public ResourceObj {
jbyte _jvmti_can_access_local_variables;
jbyte _jvmti_can_post_on_exceptions;
jbyte _jvmti_can_pop_frame;
bool _target_method_is_old;

// Compilation result values.
bool _retryable;
@@ -119,6 +120,7 @@ class JVMCICompileState : public ResourceObj {
bool jvmti_can_access_local_variables() const { return _jvmti_can_access_local_variables != 0; }
bool jvmti_can_post_on_exceptions() const { return _jvmti_can_post_on_exceptions != 0; }
bool jvmti_can_pop_frame() const { return _jvmti_can_pop_frame != 0; }
bool target_method_is_old() const { return _target_method_is_old; }

const char* failure_reason() { return _failure_reason; }
bool failure_reason_on_C_heap() { return _failure_reason_on_C_heap; }

0 comments on commit 6d8c81f

Please sign in to comment.