< prev index next >

src/hotspot/share/cds/archiveHeapWriter.cpp

Print this page

 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "cds/archiveHeapWriter.hpp"
 27 #include "cds/cdsConfig.hpp"
 28 #include "cds/filemap.hpp"
 29 #include "cds/heapShared.hpp"

 30 #include "classfile/javaClasses.hpp"
 31 #include "classfile/systemDictionary.hpp"
 32 #include "gc/shared/collectedHeap.hpp"
 33 #include "memory/iterator.inline.hpp"
 34 #include "memory/oopFactory.hpp"
 35 #include "memory/universe.hpp"
 36 #include "oops/compressedOops.hpp"
 37 #include "oops/objArrayOop.inline.hpp"
 38 #include "oops/oop.inline.hpp"
 39 #include "oops/oopHandle.inline.hpp"
 40 #include "oops/typeArrayKlass.hpp"
 41 #include "oops/typeArrayOop.hpp"
 42 #include "runtime/java.hpp"
 43 #include "runtime/mutexLocker.hpp"
 44 #include "utilities/bitMap.inline.hpp"
 45 #if INCLUDE_G1GC
 46 #include "gc/g1/g1CollectedHeap.hpp"
 47 #include "gc/g1/g1HeapRegion.hpp"
 48 #endif
 49 
 50 #if INCLUDE_CDS_JAVA_HEAP
 51 
 52 GrowableArrayCHeap<u1, mtClassShared>* ArchiveHeapWriter::_buffer = nullptr;
 53 
 54 // The following are offsets from buffer_bottom()
 55 size_t ArchiveHeapWriter::_buffer_used;
 56 
 57 // Heap root segments
 58 HeapRootSegments ArchiveHeapWriter::_heap_root_segments;
 59 
 60 address ArchiveHeapWriter::_requested_bottom;
 61 address ArchiveHeapWriter::_requested_top;
 62 





 63 GrowableArrayCHeap<ArchiveHeapWriter::NativePointerInfo, mtClassShared>* ArchiveHeapWriter::_native_pointers;
 64 GrowableArrayCHeap<oop, mtClassShared>* ArchiveHeapWriter::_source_objs;
 65 GrowableArrayCHeap<ArchiveHeapWriter::HeapObjOrder, mtClassShared>* ArchiveHeapWriter::_source_objs_order;
 66 
 67 ArchiveHeapWriter::BufferOffsetToSourceObjectTable*
 68   ArchiveHeapWriter::_buffer_offset_to_source_obj_table = nullptr;
 69 
 70 
 71 typedef ResourceHashtable<
 72       size_t,    // offset of a filler from ArchiveHeapWriter::buffer_bottom()
 73       size_t,    // size of this filler (in bytes)
 74       127,       // prime number
 75       AnyObj::C_HEAP,
 76       mtClassShared> FillersTable;
 77 static FillersTable* _fillers;
 78 static int _num_native_ptrs = 0;
 79 
 80 void ArchiveHeapWriter::init() {
 81   if (HeapShared::can_write()) {
 82     Universe::heap()->collect(GCCause::_java_lang_system_gc);

303     _source_objs_order->append(os);
304   }
305   log_info(cds)("computed ranks");
306   _source_objs_order->sort(compare_objs_by_oop_fields);
307   log_info(cds)("sorting heap objects done");
308 }
309 
310 void ArchiveHeapWriter::copy_source_objs_to_buffer(GrowableArrayCHeap<oop, mtClassShared>* roots) {
311   // There could be multiple root segments, which we want to be aligned by region.
312   // Putting them ahead of objects makes sure we waste no space.
313   copy_roots_to_buffer(roots);
314 
315   sort_source_objs();
316   for (int i = 0; i < _source_objs_order->length(); i++) {
317     int src_obj_index = _source_objs_order->at(i)._index;
318     oop src_obj = _source_objs->at(src_obj_index);
319     HeapShared::CachedOopInfo* info = HeapShared::archived_object_cache()->get(src_obj);
320     assert(info != nullptr, "must be");
321     size_t buffer_offset = copy_one_source_obj_to_buffer(src_obj);
322     info->set_buffer_offset(buffer_offset);


323 
324     _buffer_offset_to_source_obj_table->put_when_absent(buffer_offset, src_obj);
325     _buffer_offset_to_source_obj_table->maybe_grow();
326   }
327 
328   log_info(cds)("Size of heap region = " SIZE_FORMAT " bytes, %d objects, %d roots, %d native ptrs",
329                 _buffer_used, _source_objs->length() + 1, roots->length(), _num_native_ptrs);



330 }
331 
332 size_t ArchiveHeapWriter::filler_array_byte_size(int length) {
333   size_t byte_size = objArrayOopDesc::object_size(length) * HeapWordSize;
334   return byte_size;
335 }
336 
337 int ArchiveHeapWriter::filler_array_length(size_t fill_bytes) {
338   assert(is_object_aligned(fill_bytes), "must be");
339   size_t elemSize = (UseCompressedOops ? sizeof(narrowOop) : sizeof(oop));
340 
341   int initial_length = to_array_length(fill_bytes / elemSize);
342   for (int length = initial_length; length >= 0; length --) {
343     size_t array_byte_size = filler_array_byte_size(length);
344     if (array_byte_size == fill_bytes) {
345       return length;
346     }
347   }
348 
349   ShouldNotReachHere();

398     _fillers->put(buffered_address_to_offset((address)filler), fill_bytes);
399   }
400 }
401 
402 size_t ArchiveHeapWriter::get_filler_size_at(address buffered_addr) {
403   size_t* p = _fillers->get(buffered_address_to_offset(buffered_addr));
404   if (p != nullptr) {
405     assert(*p > 0, "filler must be larger than zero bytes");
406     return *p;
407   } else {
408     return 0; // buffered_addr is not a filler
409   }
410 }
411 
412 template <typename T>
413 void update_buffered_object_field(address buffered_obj, int field_offset, T value) {
414   T* field_addr = cast_to_oop(buffered_obj)->field_addr<T>(field_offset);
415   *field_addr = value;
416 }
417 
















418 size_t ArchiveHeapWriter::copy_one_source_obj_to_buffer(oop src_obj) {


419   assert(!is_too_large_to_archive(src_obj), "already checked");
420   size_t byte_size = src_obj->size() * HeapWordSize;
421   assert(byte_size > 0, "no zero-size objects");
422 
423   // For region-based collectors such as G1, the archive heap may be mapped into
424   // multiple regions. We need to make sure that we don't have an object that can possible
425   // span across two regions.
426   maybe_fill_gc_region_gap(byte_size);
427 
428   size_t new_used = _buffer_used + byte_size;
429   assert(new_used > _buffer_used, "no wrap around");
430 
431   size_t cur_min_region_bottom = align_down(_buffer_used, MIN_GC_REGION_ALIGNMENT);
432   size_t next_min_region_bottom = align_down(new_used, MIN_GC_REGION_ALIGNMENT);
433   assert(cur_min_region_bottom == next_min_region_bottom, "no object should cross minimal GC region boundaries");
434 
435   ensure_buffer_space(new_used);
436 
437   address from = cast_from_oop<address>(src_obj);
438   address to = offset_to_buffered_address<address>(_buffer_used);

668         oop* addr = (oop*)(buffered_obj + objArrayOopDesc::obj_at_offset<oop>(i));
669         relocate_field_in_buffer<oop>(addr, heap_info->oopmap());
670       }
671     }
672   }
673 
674   compute_ptrmap(heap_info);
675 
676   size_t total_bytes = (size_t)_buffer->length();
677   log_bitmap_usage("oopmap", heap_info->oopmap(), total_bytes / (UseCompressedOops ? sizeof(narrowOop) : sizeof(oop)));
678   log_bitmap_usage("ptrmap", heap_info->ptrmap(), total_bytes / sizeof(address));
679 }
680 
681 void ArchiveHeapWriter::mark_native_pointer(oop src_obj, int field_offset) {
682   Metadata* ptr = src_obj->metadata_field_acquire(field_offset);
683   if (ptr != nullptr) {
684     NativePointerInfo info;
685     info._src_obj = src_obj;
686     info._field_offset = field_offset;
687     _native_pointers->append(info);













688     HeapShared::set_has_native_pointers(src_obj);
689     _num_native_ptrs ++;
690   }
691 }
692 
693 // Do we have a jlong/jint field that's actually a pointer to a MetaspaceObj?
694 bool ArchiveHeapWriter::is_marked_as_native_pointer(ArchiveHeapInfo* heap_info, oop src_obj, int field_offset) {
695   HeapShared::CachedOopInfo* p = HeapShared::archived_object_cache()->get(src_obj);
696   assert(p != nullptr, "must be");
697 
698   // requested_field_addr = the address of this field in the requested space
699   oop requested_obj = requested_obj_from_buffer_offset(p->buffer_offset());
700   Metadata** requested_field_addr = (Metadata**)(cast_from_oop<address>(requested_obj) + field_offset);
701   assert((Metadata**)_requested_bottom <= requested_field_addr && requested_field_addr < (Metadata**) _requested_top, "range check");
702 
703   BitMap::idx_t idx = requested_field_addr - (Metadata**) _requested_bottom;
704   // Leading zeros have been removed so some addresses may not be in the ptrmap
705   size_t start_pos = FileMapInfo::current_info()->heap_ptrmap_start_pos();
706   if (idx < start_pos) {
707     return false;

726     // requested_field_addr = the address of this field in the requested space
727     oop requested_obj = requested_obj_from_buffer_offset(p->buffer_offset());
728     Metadata** requested_field_addr = (Metadata**)(cast_from_oop<address>(requested_obj) + field_offset);
729     assert(bottom <= requested_field_addr && requested_field_addr < top, "range check");
730 
731     // Mark this field in the bitmap
732     BitMap::idx_t idx = requested_field_addr - bottom;
733     heap_info->ptrmap()->set_bit(idx);
734     num_non_null_ptrs ++;
735     max_idx = MAX2(max_idx, idx);
736 
737     // Set the native pointer to the requested address of the metadata (at runtime, the metadata will have
738     // this address if the RO/RW regions are mapped at the default location).
739 
740     Metadata** buffered_field_addr = requested_addr_to_buffered_addr(requested_field_addr);
741     Metadata* native_ptr = *buffered_field_addr;
742     guarantee(native_ptr != nullptr, "sanity");
743     guarantee(ArchiveBuilder::current()->has_been_buffered((address)native_ptr),
744               "Metadata %p should have been archived", native_ptr);
745 




746     address buffered_native_ptr = ArchiveBuilder::current()->get_buffered_addr((address)native_ptr);
747     address requested_native_ptr = ArchiveBuilder::current()->to_requested(buffered_native_ptr);
748     *buffered_field_addr = (Metadata*)requested_native_ptr;
749   }
750 
751   heap_info->ptrmap()->resize(max_idx + 1);
752   log_info(cds, heap)("calculate_ptrmap: marked %d non-null native pointers for heap region (" SIZE_FORMAT " bits)",
753                       num_non_null_ptrs, size_t(heap_info->ptrmap()->size()));
754 }
755 
756 #endif // INCLUDE_CDS_JAVA_HEAP

 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "cds/archiveHeapWriter.hpp"
 27 #include "cds/cdsConfig.hpp"
 28 #include "cds/filemap.hpp"
 29 #include "cds/heapShared.hpp"
 30 #include "cds/regeneratedClasses.hpp"
 31 #include "classfile/javaClasses.hpp"
 32 #include "classfile/systemDictionary.hpp"
 33 #include "gc/shared/collectedHeap.hpp"
 34 #include "memory/iterator.inline.hpp"
 35 #include "memory/oopFactory.hpp"
 36 #include "memory/universe.hpp"
 37 #include "oops/compressedOops.hpp"
 38 #include "oops/objArrayOop.inline.hpp"
 39 #include "oops/oop.inline.hpp"
 40 #include "oops/oopHandle.inline.hpp"
 41 #include "oops/typeArrayKlass.hpp"
 42 #include "oops/typeArrayOop.hpp"
 43 #include "runtime/java.hpp"
 44 #include "runtime/mutexLocker.hpp"
 45 #include "utilities/bitMap.inline.hpp"
 46 #if INCLUDE_G1GC
 47 #include "gc/g1/g1CollectedHeap.hpp"
 48 #include "gc/g1/g1HeapRegion.hpp"
 49 #endif
 50 
 51 #if INCLUDE_CDS_JAVA_HEAP
 52 
 53 GrowableArrayCHeap<u1, mtClassShared>* ArchiveHeapWriter::_buffer = nullptr;
 54 
 55 // The following are offsets from buffer_bottom()
 56 size_t ArchiveHeapWriter::_buffer_used;
 57 
 58 // Heap root segments
 59 HeapRootSegments ArchiveHeapWriter::_heap_root_segments;
 60 
 61 address ArchiveHeapWriter::_requested_bottom;
 62 address ArchiveHeapWriter::_requested_top;
 63 
 64 static size_t _num_strings = 0;
 65 static size_t _string_bytes = 0; 
 66 static size_t _num_packages = 0;
 67 static size_t _num_protection_domains = 0;
 68 
 69 GrowableArrayCHeap<ArchiveHeapWriter::NativePointerInfo, mtClassShared>* ArchiveHeapWriter::_native_pointers;
 70 GrowableArrayCHeap<oop, mtClassShared>* ArchiveHeapWriter::_source_objs;
 71 GrowableArrayCHeap<ArchiveHeapWriter::HeapObjOrder, mtClassShared>* ArchiveHeapWriter::_source_objs_order;
 72 
 73 ArchiveHeapWriter::BufferOffsetToSourceObjectTable*
 74   ArchiveHeapWriter::_buffer_offset_to_source_obj_table = nullptr;
 75 
 76 
 77 typedef ResourceHashtable<
 78       size_t,    // offset of a filler from ArchiveHeapWriter::buffer_bottom()
 79       size_t,    // size of this filler (in bytes)
 80       127,       // prime number
 81       AnyObj::C_HEAP,
 82       mtClassShared> FillersTable;
 83 static FillersTable* _fillers;
 84 static int _num_native_ptrs = 0;
 85 
 86 void ArchiveHeapWriter::init() {
 87   if (HeapShared::can_write()) {
 88     Universe::heap()->collect(GCCause::_java_lang_system_gc);

309     _source_objs_order->append(os);
310   }
311   log_info(cds)("computed ranks");
312   _source_objs_order->sort(compare_objs_by_oop_fields);
313   log_info(cds)("sorting heap objects done");
314 }
315 
316 void ArchiveHeapWriter::copy_source_objs_to_buffer(GrowableArrayCHeap<oop, mtClassShared>* roots) {
317   // There could be multiple root segments, which we want to be aligned by region.
318   // Putting them ahead of objects makes sure we waste no space.
319   copy_roots_to_buffer(roots);
320 
321   sort_source_objs();
322   for (int i = 0; i < _source_objs_order->length(); i++) {
323     int src_obj_index = _source_objs_order->at(i)._index;
324     oop src_obj = _source_objs->at(src_obj_index);
325     HeapShared::CachedOopInfo* info = HeapShared::archived_object_cache()->get(src_obj);
326     assert(info != nullptr, "must be");
327     size_t buffer_offset = copy_one_source_obj_to_buffer(src_obj);
328     info->set_buffer_offset(buffer_offset);
329     assert(buffer_offset <= 0x7fffffff, "sanity");
330     HeapShared::add_to_permanent_oop_table(src_obj, (int)buffer_offset);
331 
332     _buffer_offset_to_source_obj_table->put_when_absent(buffer_offset, src_obj);
333     _buffer_offset_to_source_obj_table->maybe_grow();
334   }
335 
336   log_info(cds)("Size of heap region = " SIZE_FORMAT " bytes, %d objects, %d roots, %d native ptrs",
337                 _buffer_used, _source_objs->length() + 1, roots->length(), _num_native_ptrs);
338   log_info(cds)("   strings            = " SIZE_FORMAT_W(8) " (" SIZE_FORMAT " bytes)", _num_strings, _string_bytes);
339   log_info(cds)("   packages           = " SIZE_FORMAT_W(8), _num_packages);
340   log_info(cds)("   protection domains = " SIZE_FORMAT_W(8),_num_protection_domains);
341 }
342 
343 size_t ArchiveHeapWriter::filler_array_byte_size(int length) {
344   size_t byte_size = objArrayOopDesc::object_size(length) * HeapWordSize;
345   return byte_size;
346 }
347 
348 int ArchiveHeapWriter::filler_array_length(size_t fill_bytes) {
349   assert(is_object_aligned(fill_bytes), "must be");
350   size_t elemSize = (UseCompressedOops ? sizeof(narrowOop) : sizeof(oop));
351 
352   int initial_length = to_array_length(fill_bytes / elemSize);
353   for (int length = initial_length; length >= 0; length --) {
354     size_t array_byte_size = filler_array_byte_size(length);
355     if (array_byte_size == fill_bytes) {
356       return length;
357     }
358   }
359 
360   ShouldNotReachHere();

409     _fillers->put(buffered_address_to_offset((address)filler), fill_bytes);
410   }
411 }
412 
413 size_t ArchiveHeapWriter::get_filler_size_at(address buffered_addr) {
414   size_t* p = _fillers->get(buffered_address_to_offset(buffered_addr));
415   if (p != nullptr) {
416     assert(*p > 0, "filler must be larger than zero bytes");
417     return *p;
418   } else {
419     return 0; // buffered_addr is not a filler
420   }
421 }
422 
423 template <typename T>
424 void update_buffered_object_field(address buffered_obj, int field_offset, T value) {
425   T* field_addr = cast_to_oop(buffered_obj)->field_addr<T>(field_offset);
426   *field_addr = value;
427 }
428 
429 void ArchiveHeapWriter::update_stats(oop src_obj) {
430   if (java_lang_String::is_instance(src_obj)) {
431     _num_strings ++;
432     _string_bytes += src_obj->size() * HeapWordSize;
433     _string_bytes += java_lang_String::value(src_obj)->size() * HeapWordSize;
434   } else {
435     Klass* k = src_obj->klass();
436     Symbol* name = k->name();
437     if (name->equals("java/lang/NamedPackage") || name->equals("java/lang/Package")) {
438       _num_packages ++;
439     } else if (name->equals("java/security/ProtectionDomain")) {
440       _num_protection_domains ++;
441     }
442   }
443 }
444 
445 size_t ArchiveHeapWriter::copy_one_source_obj_to_buffer(oop src_obj) {
446   update_stats(src_obj);
447 
448   assert(!is_too_large_to_archive(src_obj), "already checked");
449   size_t byte_size = src_obj->size() * HeapWordSize;
450   assert(byte_size > 0, "no zero-size objects");
451 
452   // For region-based collectors such as G1, the archive heap may be mapped into
453   // multiple regions. We need to make sure that we don't have an object that can possible
454   // span across two regions.
455   maybe_fill_gc_region_gap(byte_size);
456 
457   size_t new_used = _buffer_used + byte_size;
458   assert(new_used > _buffer_used, "no wrap around");
459 
460   size_t cur_min_region_bottom = align_down(_buffer_used, MIN_GC_REGION_ALIGNMENT);
461   size_t next_min_region_bottom = align_down(new_used, MIN_GC_REGION_ALIGNMENT);
462   assert(cur_min_region_bottom == next_min_region_bottom, "no object should cross minimal GC region boundaries");
463 
464   ensure_buffer_space(new_used);
465 
466   address from = cast_from_oop<address>(src_obj);
467   address to = offset_to_buffered_address<address>(_buffer_used);

697         oop* addr = (oop*)(buffered_obj + objArrayOopDesc::obj_at_offset<oop>(i));
698         relocate_field_in_buffer<oop>(addr, heap_info->oopmap());
699       }
700     }
701   }
702 
703   compute_ptrmap(heap_info);
704 
705   size_t total_bytes = (size_t)_buffer->length();
706   log_bitmap_usage("oopmap", heap_info->oopmap(), total_bytes / (UseCompressedOops ? sizeof(narrowOop) : sizeof(oop)));
707   log_bitmap_usage("ptrmap", heap_info->ptrmap(), total_bytes / sizeof(address));
708 }
709 
710 void ArchiveHeapWriter::mark_native_pointer(oop src_obj, int field_offset) {
711   Metadata* ptr = src_obj->metadata_field_acquire(field_offset);
712   if (ptr != nullptr) {
713     NativePointerInfo info;
714     info._src_obj = src_obj;
715     info._field_offset = field_offset;
716     _native_pointers->append(info);
717     if (!ArchiveBuilder::current()->has_been_archived((address)ptr)) {
718       // Currently we supporting marking of only Method and Klass, both of which are
719       // subtypes of MetaData.
720       ResourceMark rm;
721       log_error(cds, heap)("Native pointer %p is not archived", ptr);
722       if (((Metadata*)ptr)->is_method()) {
723         log_error(cds, heap)("Method: %s", ((Method*)ptr)->external_name());
724       } else {
725         assert(((Metadata*)ptr)->is_klass(), "must be");
726         log_error(cds, heap)("Klass: %s", ((Klass*)ptr)->external_name());
727       }
728       HeapShared::exit_on_error();
729     }
730     HeapShared::set_has_native_pointers(src_obj);
731     _num_native_ptrs ++;
732   }
733 }
734 
735 // Do we have a jlong/jint field that's actually a pointer to a MetaspaceObj?
736 bool ArchiveHeapWriter::is_marked_as_native_pointer(ArchiveHeapInfo* heap_info, oop src_obj, int field_offset) {
737   HeapShared::CachedOopInfo* p = HeapShared::archived_object_cache()->get(src_obj);
738   assert(p != nullptr, "must be");
739 
740   // requested_field_addr = the address of this field in the requested space
741   oop requested_obj = requested_obj_from_buffer_offset(p->buffer_offset());
742   Metadata** requested_field_addr = (Metadata**)(cast_from_oop<address>(requested_obj) + field_offset);
743   assert((Metadata**)_requested_bottom <= requested_field_addr && requested_field_addr < (Metadata**) _requested_top, "range check");
744 
745   BitMap::idx_t idx = requested_field_addr - (Metadata**) _requested_bottom;
746   // Leading zeros have been removed so some addresses may not be in the ptrmap
747   size_t start_pos = FileMapInfo::current_info()->heap_ptrmap_start_pos();
748   if (idx < start_pos) {
749     return false;

768     // requested_field_addr = the address of this field in the requested space
769     oop requested_obj = requested_obj_from_buffer_offset(p->buffer_offset());
770     Metadata** requested_field_addr = (Metadata**)(cast_from_oop<address>(requested_obj) + field_offset);
771     assert(bottom <= requested_field_addr && requested_field_addr < top, "range check");
772 
773     // Mark this field in the bitmap
774     BitMap::idx_t idx = requested_field_addr - bottom;
775     heap_info->ptrmap()->set_bit(idx);
776     num_non_null_ptrs ++;
777     max_idx = MAX2(max_idx, idx);
778 
779     // Set the native pointer to the requested address of the metadata (at runtime, the metadata will have
780     // this address if the RO/RW regions are mapped at the default location).
781 
782     Metadata** buffered_field_addr = requested_addr_to_buffered_addr(requested_field_addr);
783     Metadata* native_ptr = *buffered_field_addr;
784     guarantee(native_ptr != nullptr, "sanity");
785     guarantee(ArchiveBuilder::current()->has_been_buffered((address)native_ptr),
786               "Metadata %p should have been archived", native_ptr);
787 
788     if (RegeneratedClasses::has_been_regenerated((address)native_ptr)) {
789       native_ptr = (Metadata*)RegeneratedClasses::get_regenerated_object((address)native_ptr);
790     }
791 
792     address buffered_native_ptr = ArchiveBuilder::current()->get_buffered_addr((address)native_ptr);
793     address requested_native_ptr = ArchiveBuilder::current()->to_requested(buffered_native_ptr);
794     *buffered_field_addr = (Metadata*)requested_native_ptr;
795   }
796 
797   heap_info->ptrmap()->resize(max_idx + 1);
798   log_info(cds, heap)("calculate_ptrmap: marked %d non-null native pointers for heap region (" SIZE_FORMAT " bits)",
799                       num_non_null_ptrs, size_t(heap_info->ptrmap()->size()));
800 }
801 
802 #endif // INCLUDE_CDS_JAVA_HEAP
< prev index next >