780 // Remove OopStorage roots
781 if (_objects_are_handles) {
782 size_t num_handles = _num_archived_objects;
783 // Skip the null entry
784 oop** handles = ((oop**)_object_index_to_heap_object_table) + 1;
785 // Sort the handles so that oop storage can release them faster
786 qsort(handles, num_handles, sizeof(oop*), (int (*)(const void*, const void*))oop_handle_cmp);
787 size_t num_null_handles = 0;
788 for (size_t handles_remaining = num_handles; handles_remaining != 0; --handles_remaining) {
789 oop* handle = handles[handles_remaining - 1];
790 if (handle == nullptr) {
791 num_null_handles = handles_remaining;
792 break;
793 }
794 NativeAccess<>::oop_store(handle, nullptr);
795 }
796 Universe::vm_global()->release(&handles[num_null_handles], num_handles - num_null_handles);
797 }
798
799 FREE_C_HEAP_ARRAY(void*, _object_index_to_heap_object_table);
800
801 // Unmap regions
802 FileMapInfo::current_info()->unmap_region(AOTMetaspace::hp);
803 FileMapInfo::current_info()->unmap_region(AOTMetaspace::bm);
804
805 _cleanup_materialization_time_ns = (Ticks::now() - start).nanoseconds();
806
807 log_statistics();
808 }
809
810 void AOTStreamedHeapLoader::log_statistics() {
811 uint64_t total_duration_us = (Ticks::now() - _materialization_start_ticks).microseconds();
812 const bool is_async = _loading_all_objects && !AOTEagerlyLoadObjects;
813 const char* const async_or_sync = is_async ? "async" : "sync";
814 log_info(aot, heap)("start to finish materialization time: " UINT64_FORMAT "us",
815 total_duration_us);
816 log_info(aot, heap)("early object materialization time (%s): " UINT64_FORMAT "us",
817 async_or_sync, _early_materialization_time_ns / 1000);
818 log_info(aot, heap)("late object materialization time (%s): " UINT64_FORMAT "us",
819 async_or_sync, _late_materialization_time_ns / 1000);
|
780 // Remove OopStorage roots
781 if (_objects_are_handles) {
782 size_t num_handles = _num_archived_objects;
783 // Skip the null entry
784 oop** handles = ((oop**)_object_index_to_heap_object_table) + 1;
785 // Sort the handles so that oop storage can release them faster
786 qsort(handles, num_handles, sizeof(oop*), (int (*)(const void*, const void*))oop_handle_cmp);
787 size_t num_null_handles = 0;
788 for (size_t handles_remaining = num_handles; handles_remaining != 0; --handles_remaining) {
789 oop* handle = handles[handles_remaining - 1];
790 if (handle == nullptr) {
791 num_null_handles = handles_remaining;
792 break;
793 }
794 NativeAccess<>::oop_store(handle, nullptr);
795 }
796 Universe::vm_global()->release(&handles[num_null_handles], num_handles - num_null_handles);
797 }
798
799 FREE_C_HEAP_ARRAY(void*, _object_index_to_heap_object_table);
800 _object_index_to_heap_object_table = nullptr;
801 _roots_archive = nullptr;
802
803 // Unmap regions
804 FileMapInfo::current_info()->unmap_region(AOTMetaspace::hp);
805 FileMapInfo::current_info()->unmap_region(AOTMetaspace::bm);
806
807 _cleanup_materialization_time_ns = (Ticks::now() - start).nanoseconds();
808
809 log_statistics();
810 }
811
812 void AOTStreamedHeapLoader::log_statistics() {
813 uint64_t total_duration_us = (Ticks::now() - _materialization_start_ticks).microseconds();
814 const bool is_async = _loading_all_objects && !AOTEagerlyLoadObjects;
815 const char* const async_or_sync = is_async ? "async" : "sync";
816 log_info(aot, heap)("start to finish materialization time: " UINT64_FORMAT "us",
817 total_duration_us);
818 log_info(aot, heap)("early object materialization time (%s): " UINT64_FORMAT "us",
819 async_or_sync, _early_materialization_time_ns / 1000);
820 log_info(aot, heap)("late object materialization time (%s): " UINT64_FORMAT "us",
821 async_or_sync, _late_materialization_time_ns / 1000);
|