552 }
553
554
555 void internal_word_Relocation::unpack_data() {
556 jint x0 = unpack_1_int();
557 _target = x0==0? nullptr: address_from_scaled_offset(x0, addr());
558 _section = CodeBuffer::SECT_NONE;
559 }
560
561
562 void section_word_Relocation::unpack_data() {
563 jint x = unpack_1_int();
564 jint offset = (x >> section_width);
565 int sindex = (x & ((1<<section_width)-1));
566 address base = binding()->section_start(sindex);
567
568 _section = sindex;
569 _target = address_from_scaled_offset(offset, base);
570 }
571
572 //// miscellaneous methods
573 oop* oop_Relocation::oop_addr() {
574 int n = _oop_index;
575 if (n == 0) {
576 // oop is stored in the code stream
577 return (oop*) pd_address_in_code();
578 } else {
579 // oop is stored in table at nmethod::oops_begin
580 return code()->oop_addr_at(n);
581 }
582 }
583
584
585 oop oop_Relocation::oop_value() {
586 // clean inline caches store a special pseudo-null
587 if (Universe::contains_non_oop_word(oop_addr())) {
588 return nullptr;
589 }
590 return *oop_addr();
591 }
|
552 }
553
554
555 void internal_word_Relocation::unpack_data() {
556 jint x0 = unpack_1_int();
557 _target = x0==0? nullptr: address_from_scaled_offset(x0, addr());
558 _section = CodeBuffer::SECT_NONE;
559 }
560
561
562 void section_word_Relocation::unpack_data() {
563 jint x = unpack_1_int();
564 jint offset = (x >> section_width);
565 int sindex = (x & ((1<<section_width)-1));
566 address base = binding()->section_start(sindex);
567
568 _section = sindex;
569 _target = address_from_scaled_offset(offset, base);
570 }
571
572 void patchable_barrier_Relocation::pack_data_to(CodeSection* dest) {
573 short* p = (short*) dest->locs_end();
574 *p++ = relocInfo::data0_from_int(_target_offset);
575 *p++ = relocInfo::data1_from_int(_target_offset);
576 *p++ = checked_cast<short>(_metadata);
577 dest->set_locs_end((relocInfo*)p);
578 }
579
580 void patchable_barrier_Relocation::unpack_data() {
581 assert(datalen() == 3, "Should be int+short fields");
582 short* d = data();
583 _target_offset = relocInfo::jint_from_data(&d[0]);
584 _metadata = checked_cast<uint16_t>(d[2]);
585 }
586
587 void patchable_barrier_Relocation::set_target_offset(int32_t target_offset) {
588 assert(!is_target_offset_resolved(), "Should be");
589 assert(datalen() == 3, "Should be int+short fields");
590 short* d = data();
591 d[0] = relocInfo::data0_from_int(target_offset);
592 d[1] = relocInfo::data1_from_int(target_offset);
593 _target_offset = target_offset;
594 assert(is_target_offset_resolved(), "Should be");
595 }
596
597 //// miscellaneous methods
598 oop* oop_Relocation::oop_addr() {
599 int n = _oop_index;
600 if (n == 0) {
601 // oop is stored in the code stream
602 return (oop*) pd_address_in_code();
603 } else {
604 // oop is stored in table at nmethod::oops_begin
605 return code()->oop_addr_at(n);
606 }
607 }
608
609
610 oop oop_Relocation::oop_value() {
611 // clean inline caches store a special pseudo-null
612 if (Universe::contains_non_oop_word(oop_addr())) {
613 return nullptr;
614 }
615 return *oop_addr();
616 }
|