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(_metadata);
575 *p++ = relocInfo::data1_from_int(_metadata);
576 *p++ = relocInfo::data0_from_int(_target_offset);
577 *p++ = relocInfo::data1_from_int(_target_offset);
578 dest->set_locs_end((relocInfo*)p);
579 }
580
581 void patchable_barrier_Relocation::unpack_data() {
582 assert(datalen() == 4, "Should be two int fields");
583 short* d = data();
584 _metadata = relocInfo::jint_from_data(&d[0]);
585 _target_offset = relocInfo::jint_from_data(&d[2]);
586 }
587
588 void patchable_barrier_Relocation::set_target_offset(jint target_offset) {
589 assert(datalen() == 4, "Should be two int fields");
590 short* d = data();
591 d[2] = relocInfo::data0_from_int(target_offset);
592 d[3] = relocInfo::data1_from_int(target_offset);
593 }
594
595 //// miscellaneous methods
596 oop* oop_Relocation::oop_addr() {
597 int n = _oop_index;
598 if (n == 0) {
599 // oop is stored in the code stream
600 return (oop*) pd_address_in_code();
601 } else {
602 // oop is stored in table at nmethod::oops_begin
603 return code()->oop_addr_at(n);
604 }
605 }
606
607
608 oop oop_Relocation::oop_value() {
609 // clean inline caches store a special pseudo-null
610 if (Universe::contains_non_oop_word(oop_addr())) {
611 return nullptr;
612 }
613 return *oop_addr();
614 }
|