mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-7523 fix ClassUnloading support in DCEVM
This commit is contained in:
@@ -106,6 +106,7 @@ u8 VM_EnhancedRedefineClasses::_id_counter = 0;
|
||||
// @param class_load_kind always jvmti_class_load_kind_redefine
|
||||
VM_EnhancedRedefineClasses::VM_EnhancedRedefineClasses(jint class_count, const jvmtiClassDefinition *class_defs, JvmtiClassLoadKind class_load_kind) :
|
||||
VM_GC_Operation(Universe::heap()->total_collections(), GCCause::_heap_inspection, Universe::heap()->total_full_collections(), true) {
|
||||
_new_classes = nullptr;
|
||||
_affected_klasses = nullptr;
|
||||
_class_count = class_count;
|
||||
_class_defs = class_defs;
|
||||
@@ -717,12 +718,6 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
Universe::objectArrayKlassObj()->append_to_sibling_list();
|
||||
}
|
||||
|
||||
if (_object_klass_redefined) {
|
||||
// TODO: This is a hack; it keeps old mirror instances on the heap. A correct solution could be to hold the old mirror class in the new mirror class.
|
||||
ClassUnloading = false;
|
||||
ClassUnloadingWithConcurrentMark = false;
|
||||
}
|
||||
|
||||
if (needs_instance_update) {
|
||||
// Do a full garbage collection to update the instance sizes accordingly
|
||||
log_trace(redefine, class, redefine, metadata)("Before redefinition full GC run");
|
||||
@@ -788,6 +783,10 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
|
||||
Universe::set_inside_redefinition(false);
|
||||
_timer_vm_op_doit.stop();
|
||||
|
||||
if (log_is_enabled(Trace, redefine, class, codecache)) {
|
||||
CodeCache::print();
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup - runs in JVM thread
|
||||
@@ -1027,9 +1026,11 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions_single_step(TRAPS
|
||||
// The hidden class loader data has been artificially been kept alive to
|
||||
// this point. The mirror and any instances of this class have to keep
|
||||
// it alive afterwards.
|
||||
if (the_class->class_loader_data()->keep_alive_cnt() > 0) {
|
||||
the_class->class_loader_data()->dec_keep_alive();
|
||||
}
|
||||
|
||||
// Keep old classloader data alive otherwise it crashes with ClassUnloading=true
|
||||
// if (the_class->class_loader_data()->keep_alive_cnt() > 0) {
|
||||
// the_class->class_loader_data()->dec_keep_alive();
|
||||
// }
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -4021,15 +4021,6 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
|
||||
setup_hotswap_agent();
|
||||
|
||||
if (AllowEnhancedClassRedefinition) {
|
||||
if (!FLAG_IS_CMDLINE(ClassUnloading)) {
|
||||
ClassUnloading = false;
|
||||
ClassUnloadingWithConcurrentMark = false;
|
||||
} else {
|
||||
warning("The JVM is unstable when using -XX:+AllowEnhancedClassRedefinition and -XX:+ClassUnloading together!");
|
||||
}
|
||||
}
|
||||
|
||||
#if !INCLUDE_CDS
|
||||
if (DumpSharedSpaces || RequireSharedSpaces) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
|
||||
Reference in New Issue
Block a user