63 #include "oops/symbol.hpp" 64 #include "prims/jvmtiExport.hpp" 65 #include "prims/jvmtiRedefineClasses.hpp" 66 #include "prims/jvmtiThreadState.hpp" 67 #include "prims/methodComparator.hpp" 68 #include "runtime/atomic.hpp" 69 #include "runtime/fieldDescriptor.inline.hpp" 70 #include "runtime/handles.inline.hpp" 71 #include "runtime/javaCalls.hpp" 72 #include "runtime/mutexLocker.hpp" 73 #include "runtime/orderAccess.hpp" 74 #include "runtime/thread.inline.hpp" 75 #include "services/classLoadingService.hpp" 76 #include "services/threadService.hpp" 77 #include "utilities/dtrace.hpp" 78 #include "utilities/macros.hpp" 79 #include "utilities/stringUtils.hpp" 80 #ifdef COMPILER1 81 #include "c1/c1_Compiler.hpp" 82 #endif 83 84 #ifdef DTRACE_ENABLED 85 86 87 #define HOTSPOT_CLASS_INITIALIZATION_required HOTSPOT_CLASS_INITIALIZATION_REQUIRED 88 #define HOTSPOT_CLASS_INITIALIZATION_recursive HOTSPOT_CLASS_INITIALIZATION_RECURSIVE 89 #define HOTSPOT_CLASS_INITIALIZATION_concurrent HOTSPOT_CLASS_INITIALIZATION_CONCURRENT 90 #define HOTSPOT_CLASS_INITIALIZATION_erroneous HOTSPOT_CLASS_INITIALIZATION_ERRONEOUS 91 #define HOTSPOT_CLASS_INITIALIZATION_super__failed HOTSPOT_CLASS_INITIALIZATION_SUPER_FAILED 92 #define HOTSPOT_CLASS_INITIALIZATION_clinit HOTSPOT_CLASS_INITIALIZATION_CLINIT 93 #define HOTSPOT_CLASS_INITIALIZATION_error HOTSPOT_CLASS_INITIALIZATION_ERROR 94 #define HOTSPOT_CLASS_INITIALIZATION_end HOTSPOT_CLASS_INITIALIZATION_END 95 #define DTRACE_CLASSINIT_PROBE(type, thread_type) \ 96 { \ 97 char* data = NULL; \ 98 int len = 0; \ 99 Symbol* clss_name = name(); \ 100 if (clss_name != NULL) { \ 101 data = (char*)clss_name->bytes(); \ 102 len = clss_name->utf8_length(); \ 2406 } 2407 } 2408 2409 return (old_state != is_in_error_state()); 2410 } 2411 2412 #if INCLUDE_JVMTI 2413 static void clear_all_breakpoints(Method* m) { 2414 m->clear_all_breakpoints(); 2415 } 2416 #endif 2417 2418 void InstanceKlass::notify_unload_class(InstanceKlass* ik) { 2419 // notify the debugger 2420 if (JvmtiExport::should_post_class_unload()) { 2421 JvmtiExport::post_class_unload(ik); 2422 } 2423 2424 // notify ClassLoadingService of class unload 2425 ClassLoadingService::notify_class_unloaded(ik); 2426 } 2427 2428 void InstanceKlass::release_C_heap_structures(InstanceKlass* ik) { 2429 // Clean up C heap 2430 ik->release_C_heap_structures(); 2431 ik->constants()->release_C_heap_structures(); 2432 } 2433 2434 void InstanceKlass::release_C_heap_structures() { 2435 // Can't release the constant pool here because the constant pool can be 2436 // deallocated separately from the InstanceKlass for default methods and 2437 // redefine classes. 2438 2439 // Deallocate oop map cache 2440 if (_oop_map_cache != NULL) { 2441 delete _oop_map_cache; 2442 _oop_map_cache = NULL; 2443 } 2444 2445 // Deallocate JNI identifiers for jfieldIDs | 63 #include "oops/symbol.hpp" 64 #include "prims/jvmtiExport.hpp" 65 #include "prims/jvmtiRedefineClasses.hpp" 66 #include "prims/jvmtiThreadState.hpp" 67 #include "prims/methodComparator.hpp" 68 #include "runtime/atomic.hpp" 69 #include "runtime/fieldDescriptor.inline.hpp" 70 #include "runtime/handles.inline.hpp" 71 #include "runtime/javaCalls.hpp" 72 #include "runtime/mutexLocker.hpp" 73 #include "runtime/orderAccess.hpp" 74 #include "runtime/thread.inline.hpp" 75 #include "services/classLoadingService.hpp" 76 #include "services/threadService.hpp" 77 #include "utilities/dtrace.hpp" 78 #include "utilities/macros.hpp" 79 #include "utilities/stringUtils.hpp" 80 #ifdef COMPILER1 81 #include "c1/c1_Compiler.hpp" 82 #endif 83 #if INCLUDE_JFR 84 #include "utilities/ticks.hpp" 85 #include "jfr/jfr.hpp" 86 #include "jfr/jfrEvents.hpp" 87 Ticks InstanceKlass::_class_unload_time; 88 #endif 89 90 91 #ifdef DTRACE_ENABLED 92 93 94 #define HOTSPOT_CLASS_INITIALIZATION_required HOTSPOT_CLASS_INITIALIZATION_REQUIRED 95 #define HOTSPOT_CLASS_INITIALIZATION_recursive HOTSPOT_CLASS_INITIALIZATION_RECURSIVE 96 #define HOTSPOT_CLASS_INITIALIZATION_concurrent HOTSPOT_CLASS_INITIALIZATION_CONCURRENT 97 #define HOTSPOT_CLASS_INITIALIZATION_erroneous HOTSPOT_CLASS_INITIALIZATION_ERRONEOUS 98 #define HOTSPOT_CLASS_INITIALIZATION_super__failed HOTSPOT_CLASS_INITIALIZATION_SUPER_FAILED 99 #define HOTSPOT_CLASS_INITIALIZATION_clinit HOTSPOT_CLASS_INITIALIZATION_CLINIT 100 #define HOTSPOT_CLASS_INITIALIZATION_error HOTSPOT_CLASS_INITIALIZATION_ERROR 101 #define HOTSPOT_CLASS_INITIALIZATION_end HOTSPOT_CLASS_INITIALIZATION_END 102 #define DTRACE_CLASSINIT_PROBE(type, thread_type) \ 103 { \ 104 char* data = NULL; \ 105 int len = 0; \ 106 Symbol* clss_name = name(); \ 107 if (clss_name != NULL) { \ 108 data = (char*)clss_name->bytes(); \ 109 len = clss_name->utf8_length(); \ 2413 } 2414 } 2415 2416 return (old_state != is_in_error_state()); 2417 } 2418 2419 #if INCLUDE_JVMTI 2420 static void clear_all_breakpoints(Method* m) { 2421 m->clear_all_breakpoints(); 2422 } 2423 #endif 2424 2425 void InstanceKlass::notify_unload_class(InstanceKlass* ik) { 2426 // notify the debugger 2427 if (JvmtiExport::should_post_class_unload()) { 2428 JvmtiExport::post_class_unload(ik); 2429 } 2430 2431 // notify ClassLoadingService of class unload 2432 ClassLoadingService::notify_class_unloaded(ik); 2433 2434 #if INCLUDE_JFR 2435 if (Jfr::is_enabled()) { 2436 assert(ik != NULL, "invariant"); 2437 EventClassUnload event(UNTIMED); 2438 event.set_endtime(class_unload_time()); 2439 event.set_unloadedClass(ik); 2440 event.set_definingClassLoader(ik->class_loader_data()); 2441 event.commit(); 2442 } 2443 #endif 2444 2445 } 2446 2447 void InstanceKlass::release_C_heap_structures(InstanceKlass* ik) { 2448 // Clean up C heap 2449 ik->release_C_heap_structures(); 2450 ik->constants()->release_C_heap_structures(); 2451 } 2452 2453 void InstanceKlass::release_C_heap_structures() { 2454 // Can't release the constant pool here because the constant pool can be 2455 // deallocated separately from the InstanceKlass for default methods and 2456 // redefine classes. 2457 2458 // Deallocate oop map cache 2459 if (_oop_map_cache != NULL) { 2460 delete _oop_map_cache; 2461 _oop_map_cache = NULL; 2462 } 2463 2464 // Deallocate JNI identifiers for jfieldIDs |