747 _class_loader = class_loader;
748 _h_protection_domain = h_protection_domain;
749 _data_ptr = data_ptr;
750 _end_ptr = end_ptr;
751 _thread = JavaThread::current();
752 _curr_len = *end_ptr - *data_ptr;
753 _curr_data = *data_ptr;
754 _curr_env = NULL;
755 _cached_class_file_ptr = cache_ptr;
756 _has_been_modified = false;
757
758 _state = _thread->jvmti_thread_state();
759 if (_state != NULL) {
760 _class_being_redefined = _state->get_class_being_redefined();
761 _load_kind = _state->get_class_load_kind();
762 Klass* klass = (_class_being_redefined == NULL) ? NULL : _class_being_redefined;
763 if (_load_kind != jvmti_class_load_kind_load && klass != NULL) {
764 ModuleEntry* module_entry = InstanceKlass::cast(klass)->module();
765 assert(module_entry != NULL, "module_entry should always be set");
766 if (module_entry->is_named() &&
767 module_entry->module_handle() != NULL &&
768 !module_entry->has_default_read_edges()) {
769 if (!module_entry->set_has_default_read_edges()) {
770 // We won a potential race.
771 // Add read edges to the unnamed modules of the bootstrap and app class loaders
772 Handle class_module(_thread, module_entry->module()); // Obtain j.l.r.Module
773 JvmtiExport::add_default_read_edges(class_module, _thread);
774 }
775 }
776 }
777 // Clear class_being_redefined flag here. The action
778 // from agent handler could generate a new class file load
779 // hook event and if it is not cleared the new event generated
780 // from regular class file load could have this stale redefined
781 // class handle info.
782 _state->clear_class_being_redefined();
783 } else {
784 // redefine and retransform will always set the thread state
785 _class_being_redefined = NULL;
786 _load_kind = jvmti_class_load_kind_load;
787 }
|
747 _class_loader = class_loader;
748 _h_protection_domain = h_protection_domain;
749 _data_ptr = data_ptr;
750 _end_ptr = end_ptr;
751 _thread = JavaThread::current();
752 _curr_len = *end_ptr - *data_ptr;
753 _curr_data = *data_ptr;
754 _curr_env = NULL;
755 _cached_class_file_ptr = cache_ptr;
756 _has_been_modified = false;
757
758 _state = _thread->jvmti_thread_state();
759 if (_state != NULL) {
760 _class_being_redefined = _state->get_class_being_redefined();
761 _load_kind = _state->get_class_load_kind();
762 Klass* klass = (_class_being_redefined == NULL) ? NULL : _class_being_redefined;
763 if (_load_kind != jvmti_class_load_kind_load && klass != NULL) {
764 ModuleEntry* module_entry = InstanceKlass::cast(klass)->module();
765 assert(module_entry != NULL, "module_entry should always be set");
766 if (module_entry->is_named() &&
767 module_entry->module() != NULL &&
768 !module_entry->has_default_read_edges()) {
769 if (!module_entry->set_has_default_read_edges()) {
770 // We won a potential race.
771 // Add read edges to the unnamed modules of the bootstrap and app class loaders
772 Handle class_module(_thread, module_entry->module()); // Obtain j.l.r.Module
773 JvmtiExport::add_default_read_edges(class_module, _thread);
774 }
775 }
776 }
777 // Clear class_being_redefined flag here. The action
778 // from agent handler could generate a new class file load
779 // hook event and if it is not cleared the new event generated
780 // from regular class file load could have this stale redefined
781 // class handle info.
782 _state->clear_class_being_redefined();
783 } else {
784 // redefine and retransform will always set the thread state
785 _class_being_redefined = NULL;
786 _load_kind = jvmti_class_load_kind_load;
787 }
|