< prev index next >

src/hotspot/share/oops/instanceKlass.cpp

Print this page

2529 
2530 #if INCLUDE_JVMTI
2531   // Deallocate breakpoint records
2532   if (breakpoints() != 0x0) {
2533     methods_do(clear_all_breakpoints);
2534     assert(breakpoints() == 0x0, "should have cleared breakpoints");
2535   }
2536 
2537   // deallocate the cached class file
2538   if (_cached_class_file != NULL) {
2539     os::free(_cached_class_file);
2540     _cached_class_file = NULL;
2541   }
2542 #endif
2543 
2544   // Decrement symbol reference counts associated with the unloaded class.
2545   if (_name != NULL) _name->decrement_refcount();
2546   // unreference array name derived from this class name (arrays of an unloaded
2547   // class can't be referenced anymore).
2548   if (_array_name != NULL)  _array_name->decrement_refcount();
2549   if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension);
2550 }
2551 
2552 void InstanceKlass::set_source_debug_extension(const char* array, int length) {
2553   if (array == NULL) {
2554     _source_debug_extension = NULL;
2555   } else {
2556     // Adding one to the attribute length in order to store a null terminator
2557     // character could cause an overflow because the attribute length is
2558     // already coded with an u4 in the classfile, but in practice, it's
2559     // unlikely to happen.
2560     assert((length+1) > length, "Overflow checking");
2561     char* sde = NEW_C_HEAP_ARRAY(char, (length + 1), mtClass);
2562     for (int i = 0; i < length; i++) {
2563       sde[i] = array[i];
2564     }
2565     sde[length] = '\0';
2566     _source_debug_extension = sde;
2567   }
2568 }
2569 

2529 
2530 #if INCLUDE_JVMTI
2531   // Deallocate breakpoint records
2532   if (breakpoints() != 0x0) {
2533     methods_do(clear_all_breakpoints);
2534     assert(breakpoints() == 0x0, "should have cleared breakpoints");
2535   }
2536 
2537   // deallocate the cached class file
2538   if (_cached_class_file != NULL) {
2539     os::free(_cached_class_file);
2540     _cached_class_file = NULL;
2541   }
2542 #endif
2543 
2544   // Decrement symbol reference counts associated with the unloaded class.
2545   if (_name != NULL) _name->decrement_refcount();
2546   // unreference array name derived from this class name (arrays of an unloaded
2547   // class can't be referenced anymore).
2548   if (_array_name != NULL)  _array_name->decrement_refcount();
2549   FREE_C_HEAP_ARRAY(char, _source_debug_extension);
2550 }
2551 
2552 void InstanceKlass::set_source_debug_extension(const char* array, int length) {
2553   if (array == NULL) {
2554     _source_debug_extension = NULL;
2555   } else {
2556     // Adding one to the attribute length in order to store a null terminator
2557     // character could cause an overflow because the attribute length is
2558     // already coded with an u4 in the classfile, but in practice, it's
2559     // unlikely to happen.
2560     assert((length+1) > length, "Overflow checking");
2561     char* sde = NEW_C_HEAP_ARRAY(char, (length + 1), mtClass);
2562     for (int i = 0; i < length; i++) {
2563       sde[i] = array[i];
2564     }
2565     sde[length] = '\0';
2566     _source_debug_extension = sde;
2567   }
2568 }
2569 
< prev index next >