543 requested_region_bottom = _requested_bottom;
544
545 // Mark the pointer in the oopmap
546 T* region_bottom = (T*)requested_region_bottom;
547 assert(request_p >= region_bottom, "must be");
548 BitMap::idx_t idx = request_p - region_bottom;
549 assert(idx < oopmap->size(), "overflow");
550 oopmap->set_bit(idx);
551 }
552
553 void ArchiveHeapWriter::update_header_for_requested_obj(oop requested_obj, oop src_obj, Klass* src_klass) {
554 assert(UseCompressedClassPointers, "Archived heap only supported for compressed klasses");
555 narrowKlass nk = ArchiveBuilder::current()->get_requested_narrow_klass(src_klass);
556 address buffered_addr = requested_addr_to_buffered_addr(cast_from_oop<address>(requested_obj));
557
558 oop fake_oop = cast_to_oop(buffered_addr);
559 fake_oop->set_narrow_klass(nk);
560
561 // We need to retain the identity_hash, because it may have been used by some hashtables
562 // in the shared heap.
563 if (src_obj != nullptr && !src_obj->fast_no_hash_check()) {
564 intptr_t src_hash = src_obj->identity_hash();
565 fake_oop->set_mark(markWord::prototype().copy_set_hash(src_hash));
566 assert(fake_oop->mark().is_unlocked(), "sanity");
567
568 DEBUG_ONLY(intptr_t archived_hash = fake_oop->identity_hash());
569 assert(src_hash == archived_hash, "Different hash codes: original " INTPTR_FORMAT ", archived " INTPTR_FORMAT, src_hash, archived_hash);
570 }
571 }
572
573 class ArchiveHeapWriter::EmbeddedOopRelocator: public BasicOopIterateClosure {
574 oop _src_obj;
575 address _buffered_obj;
576 CHeapBitMap* _oopmap;
577
578 public:
579 EmbeddedOopRelocator(oop src_obj, address buffered_obj, CHeapBitMap* oopmap) :
580 _src_obj(src_obj), _buffered_obj(buffered_obj), _oopmap(oopmap) {}
581
582 void do_oop(narrowOop *p) { EmbeddedOopRelocator::do_oop_work(p); }
583 void do_oop( oop *p) { EmbeddedOopRelocator::do_oop_work(p); }
584
585 private:
|
543 requested_region_bottom = _requested_bottom;
544
545 // Mark the pointer in the oopmap
546 T* region_bottom = (T*)requested_region_bottom;
547 assert(request_p >= region_bottom, "must be");
548 BitMap::idx_t idx = request_p - region_bottom;
549 assert(idx < oopmap->size(), "overflow");
550 oopmap->set_bit(idx);
551 }
552
553 void ArchiveHeapWriter::update_header_for_requested_obj(oop requested_obj, oop src_obj, Klass* src_klass) {
554 assert(UseCompressedClassPointers, "Archived heap only supported for compressed klasses");
555 narrowKlass nk = ArchiveBuilder::current()->get_requested_narrow_klass(src_klass);
556 address buffered_addr = requested_addr_to_buffered_addr(cast_from_oop<address>(requested_obj));
557
558 oop fake_oop = cast_to_oop(buffered_addr);
559 fake_oop->set_narrow_klass(nk);
560
561 // We need to retain the identity_hash, because it may have been used by some hashtables
562 // in the shared heap.
563 if (src_obj != nullptr && !src_obj->fast_no_hash_check() && (!(EnableValhalla && src_obj->mark().is_inline_type()))) {
564 intptr_t src_hash = src_obj->identity_hash();
565 fake_oop->set_mark(src_klass->prototype_header().copy_set_hash(src_hash));
566 assert(fake_oop->mark().is_unlocked(), "sanity");
567
568 DEBUG_ONLY(intptr_t archived_hash = fake_oop->identity_hash());
569 assert(src_hash == archived_hash, "Different hash codes: original " INTPTR_FORMAT ", archived " INTPTR_FORMAT, src_hash, archived_hash);
570 }
571 }
572
573 class ArchiveHeapWriter::EmbeddedOopRelocator: public BasicOopIterateClosure {
574 oop _src_obj;
575 address _buffered_obj;
576 CHeapBitMap* _oopmap;
577
578 public:
579 EmbeddedOopRelocator(oop src_obj, address buffered_obj, CHeapBitMap* oopmap) :
580 _src_obj(src_obj), _buffered_obj(buffered_obj), _oopmap(oopmap) {}
581
582 void do_oop(narrowOop *p) { EmbeddedOopRelocator::do_oop_work(p); }
583 void do_oop( oop *p) { EmbeddedOopRelocator::do_oop_work(p); }
584
585 private:
|