equal
deleted
inserted
replaced
3567 |
3567 |
3568 void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) { |
3568 void Metaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_class) { |
3569 assert(!SafepointSynchronize::is_at_safepoint() |
3569 assert(!SafepointSynchronize::is_at_safepoint() |
3570 || Thread::current()->is_VM_thread(), "should be the VM thread"); |
3570 || Thread::current()->is_VM_thread(), "should be the VM thread"); |
3571 |
3571 |
3572 if (DumpSharedSpaces && PrintSharedSpaces) { |
3572 if (DumpSharedSpaces && log_is_enabled(Info, cds)) { |
3573 record_deallocation(ptr, vsm()->get_allocation_word_size(word_size)); |
3573 record_deallocation(ptr, vsm()->get_allocation_word_size(word_size)); |
3574 } |
3574 } |
3575 |
3575 |
3576 MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag); |
3576 MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag); |
3577 |
3577 |
3601 Metaspace* space = read_only ? loader_data->ro_metaspace() : loader_data->rw_metaspace(); |
3601 Metaspace* space = read_only ? loader_data->ro_metaspace() : loader_data->rw_metaspace(); |
3602 MetaWord* result = space->allocate(word_size, NonClassType); |
3602 MetaWord* result = space->allocate(word_size, NonClassType); |
3603 if (result == NULL) { |
3603 if (result == NULL) { |
3604 report_out_of_shared_space(read_only ? SharedReadOnly : SharedReadWrite); |
3604 report_out_of_shared_space(read_only ? SharedReadOnly : SharedReadWrite); |
3605 } |
3605 } |
3606 if (PrintSharedSpaces) { |
3606 if (log_is_enabled(Info, cds)) { |
3607 space->record_allocation(result, type, space->vsm()->get_allocation_word_size(word_size)); |
3607 space->record_allocation(result, type, space->vsm()->get_allocation_word_size(word_size)); |
3608 } |
3608 } |
3609 |
3609 |
3610 // Zero initialize. |
3610 // Zero initialize. |
3611 Copy::fill_to_words((HeapWord*)result, word_size, 0); |
3611 Copy::fill_to_words((HeapWord*)result, word_size, 0); |