8264941: Remove CodeCache::mark_for_evol_deoptimization() method
Reviewed-by: kvn, vlivanov, sspitsyn
This commit is contained in:
parent
18a1dd261c
commit
33c23a1cf2
@ -1077,12 +1077,6 @@ void CodeCache::old_nmethods_do(MetadataClosure* f) {
|
|||||||
log_debug(redefine, class, nmethod)("Walked %d nmethods for mark_on_stack", length);
|
log_debug(redefine, class, nmethod)("Walked %d nmethods for mark_on_stack", length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just marks the methods in this class as needing deoptimization
|
|
||||||
void CodeCache::mark_for_evol_deoptimization(InstanceKlass* dependee) {
|
|
||||||
assert(SafepointSynchronize::is_at_safepoint(), "Can only do this at a safepoint!");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Walk compiled methods and mark dependent methods for deoptimization.
|
// Walk compiled methods and mark dependent methods for deoptimization.
|
||||||
int CodeCache::mark_dependents_for_evol_deoptimization() {
|
int CodeCache::mark_dependents_for_evol_deoptimization() {
|
||||||
assert(SafepointSynchronize::is_at_safepoint(), "Can only do this at a safepoint!");
|
assert(SafepointSynchronize::is_at_safepoint(), "Can only do this at a safepoint!");
|
||||||
|
@ -271,7 +271,6 @@ class CodeCache : AllStatic {
|
|||||||
|
|
||||||
// RedefineClasses support
|
// RedefineClasses support
|
||||||
// Flushing and deoptimization in case of evolution
|
// Flushing and deoptimization in case of evolution
|
||||||
static void mark_for_evol_deoptimization(InstanceKlass* dependee);
|
|
||||||
static int mark_dependents_for_evol_deoptimization();
|
static int mark_dependents_for_evol_deoptimization();
|
||||||
static void mark_all_nmethods_for_evol_deoptimization();
|
static void mark_all_nmethods_for_evol_deoptimization();
|
||||||
static void flush_evol_dependents();
|
static void flush_evol_dependents();
|
||||||
|
@ -312,7 +312,6 @@ bool JvmtiExport::_can_modify_any_class = fals
|
|||||||
bool JvmtiExport::_can_walk_any_space = false;
|
bool JvmtiExport::_can_walk_any_space = false;
|
||||||
|
|
||||||
uint64_t JvmtiExport::_redefinition_count = 0;
|
uint64_t JvmtiExport::_redefinition_count = 0;
|
||||||
bool JvmtiExport::_all_dependencies_are_recorded = false;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// field access management
|
// field access management
|
||||||
|
@ -187,13 +187,6 @@ class JvmtiExport : public AllStatic {
|
|||||||
inline static void increment_redefinition_count() {
|
inline static void increment_redefinition_count() {
|
||||||
JVMTI_ONLY(_redefinition_count++;)
|
JVMTI_ONLY(_redefinition_count++;)
|
||||||
}
|
}
|
||||||
// Flag to indicate if the compiler has recorded all dependencies. When the
|
|
||||||
// can_redefine_classes capability is enabled in the OnLoad phase then the compiler
|
|
||||||
// records all dependencies from startup. However if the capability is first
|
|
||||||
// enabled some time later then the dependencies recorded by the compiler
|
|
||||||
// are incomplete. This flag is used by RedefineClasses to know if the
|
|
||||||
// dependency information is complete or not.
|
|
||||||
static bool _all_dependencies_are_recorded;
|
|
||||||
|
|
||||||
static void post_method_exit_inner(JavaThread* thread,
|
static void post_method_exit_inner(JavaThread* thread,
|
||||||
methodHandle& mh,
|
methodHandle& mh,
|
||||||
@ -214,14 +207,6 @@ class JvmtiExport : public AllStatic {
|
|||||||
NOT_JVMTI(return 0);
|
NOT_JVMTI(return 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static bool all_dependencies_are_recorded() {
|
|
||||||
return _all_dependencies_are_recorded;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline static void set_all_dependencies_are_recorded(bool on) {
|
|
||||||
_all_dependencies_are_recorded = (on != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add read edges to the unnamed modules of the bootstrap and app class loaders
|
// Add read edges to the unnamed modules of the bootstrap and app class loaders
|
||||||
static void add_default_read_edges(Handle h_module, TRAPS) NOT_JVMTI_RETURN;
|
static void add_default_read_edges(Handle h_module, TRAPS) NOT_JVMTI_RETURN;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -328,13 +328,6 @@ void JvmtiManageCapabilities::update() {
|
|||||||
RewriteFrequentPairs = false;
|
RewriteFrequentPairs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If can_redefine_classes is enabled in the onload phase then we know that the
|
|
||||||
// dependency information recorded by the compiler is complete.
|
|
||||||
if ((avail.can_redefine_classes || avail.can_retransform_classes) &&
|
|
||||||
JvmtiEnv::get_phase() == JVMTI_PHASE_ONLOAD) {
|
|
||||||
JvmtiExport::set_all_dependencies_are_recorded(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
JvmtiExport::set_can_get_source_debug_extension(avail.can_get_source_debug_extension);
|
JvmtiExport::set_can_get_source_debug_extension(avail.can_get_source_debug_extension);
|
||||||
JvmtiExport::set_can_maintain_original_method_order(avail.can_maintain_original_method_order);
|
JvmtiExport::set_can_maintain_original_method_order(avail.can_maintain_original_method_order);
|
||||||
JvmtiExport::set_can_post_interpreter_events(interp_events);
|
JvmtiExport::set_can_post_interpreter_events(interp_events);
|
||||||
|
@ -4068,56 +4068,17 @@ void VM_RedefineClasses::transfer_old_native_function_registrations(InstanceKlas
|
|||||||
transfer.transfer_registrations(_matching_old_methods, _matching_methods_length);
|
transfer.transfer_registrations(_matching_old_methods, _matching_methods_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deoptimize all compiled code that depends on this class.
|
// Deoptimize all compiled code that depends on the classes redefined.
|
||||||
//
|
|
||||||
// If the can_redefine_classes capability is obtained in the onload
|
|
||||||
// phase then the compiler has recorded all dependencies from startup.
|
|
||||||
// In that case we need only deoptimize and throw away all compiled code
|
|
||||||
// that depends on the class.
|
|
||||||
//
|
|
||||||
// If can_redefine_classes is obtained sometime after the onload
|
|
||||||
// phase then the dependency information may be incomplete. In that case
|
|
||||||
// the first call to RedefineClasses causes all compiled code to be
|
|
||||||
// thrown away. As can_redefine_classes has been obtained then
|
|
||||||
// all future compilations will record dependencies so second and
|
|
||||||
// subsequent calls to RedefineClasses need only throw away code
|
|
||||||
// that depends on the class.
|
|
||||||
//
|
|
||||||
|
|
||||||
// First step is to walk the code cache for each class redefined and mark
|
|
||||||
// dependent methods. Wait until all classes are processed to deoptimize everything.
|
|
||||||
void VM_RedefineClasses::mark_dependent_code(InstanceKlass* ik) {
|
|
||||||
assert_locked_or_safepoint(Compile_lock);
|
|
||||||
|
|
||||||
// All dependencies have been recorded from startup or this is a second or
|
|
||||||
// subsequent use of RedefineClasses
|
|
||||||
if (JvmtiExport::all_dependencies_are_recorded()) {
|
|
||||||
CodeCache::mark_for_evol_deoptimization(ik);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VM_RedefineClasses::flush_dependent_code() {
|
void VM_RedefineClasses::flush_dependent_code() {
|
||||||
assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
|
assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
|
||||||
|
|
||||||
bool deopt_needed;
|
|
||||||
|
|
||||||
// This is the first redefinition, mark all the nmethods for deoptimization
|
|
||||||
if (!JvmtiExport::all_dependencies_are_recorded()) {
|
|
||||||
log_debug(redefine, class, nmethod)("Marked all nmethods for deopt");
|
|
||||||
CodeCache::mark_all_nmethods_for_evol_deoptimization();
|
|
||||||
deopt_needed = true;
|
|
||||||
} else {
|
|
||||||
int deopt = CodeCache::mark_dependents_for_evol_deoptimization();
|
int deopt = CodeCache::mark_dependents_for_evol_deoptimization();
|
||||||
log_debug(redefine, class, nmethod)("Marked %d dependent nmethods for deopt", deopt);
|
log_debug(redefine, class, nmethod)("Marked %d dependent nmethods for deopt", deopt);
|
||||||
deopt_needed = (deopt != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (deopt_needed) {
|
if (deopt != 0) {
|
||||||
CodeCache::flush_evol_dependents();
|
CodeCache::flush_evol_dependents();
|
||||||
}
|
}
|
||||||
|
|
||||||
// From now on we know that the dependency information is complete
|
|
||||||
JvmtiExport::set_all_dependencies_are_recorded(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VM_RedefineClasses::compute_added_deleted_matching_methods() {
|
void VM_RedefineClasses::compute_added_deleted_matching_methods() {
|
||||||
@ -4221,9 +4182,6 @@ void VM_RedefineClasses::redefine_single_class(Thread* current, jclass the_jclas
|
|||||||
JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
|
JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
|
||||||
jvmti_breakpoints.clearall_in_class_at_safepoint(the_class);
|
jvmti_breakpoints.clearall_in_class_at_safepoint(the_class);
|
||||||
|
|
||||||
// Mark all compiled code that depends on this class
|
|
||||||
mark_dependent_code(the_class);
|
|
||||||
|
|
||||||
_old_methods = the_class->methods();
|
_old_methods = the_class->methods();
|
||||||
_new_methods = scratch_class->methods();
|
_new_methods = scratch_class->methods();
|
||||||
_the_class = the_class;
|
_the_class = the_class;
|
||||||
|
@ -493,7 +493,6 @@ class VM_RedefineClasses: public VM_Operation {
|
|||||||
constantPoolHandle scratch_cp, int scratch_cp_length, TRAPS);
|
constantPoolHandle scratch_cp, int scratch_cp_length, TRAPS);
|
||||||
|
|
||||||
void flush_dependent_code();
|
void flush_dependent_code();
|
||||||
void mark_dependent_code(InstanceKlass* ik);
|
|
||||||
|
|
||||||
// lock classes to redefine since constant pool merging isn't thread safe.
|
// lock classes to redefine since constant pool merging isn't thread safe.
|
||||||
void lock_classes();
|
void lock_classes();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user