626 if (!metadata_is_immediate()) {
627 // get the metadata from the pool, and re-insert it into the instruction:
628 verify_value(value());
629 }
630 }
631
632 address virtual_call_Relocation::cached_value() {
633 assert(_cached_value != NULL && _cached_value < addr(), "must precede ic_call");
634 return _cached_value;
635 }
636
637 Method* virtual_call_Relocation::method_value() {
638 CompiledMethod* cm = code();
639 if (cm == NULL) return (Method*)NULL;
640 Metadata* m = cm->metadata_at(_method_index);
641 assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
642 assert(m == NULL || m->is_method(), "not a method");
643 return (Method*)m;
644 }
645
646 void virtual_call_Relocation::clear_inline_cache() {
647 // No stubs for ICs
648 // Clean IC
649 ResourceMark rm;
650 CompiledIC* icache = CompiledIC_at(this);
651 icache->set_to_clean();
652 }
653
654
655 void opt_virtual_call_Relocation::pack_data_to(CodeSection* dest) {
656 short* p = (short*) dest->locs_end();
657 p = pack_1_int_to(p, _method_index);
658 dest->set_locs_end((relocInfo*) p);
659 }
660
661 void opt_virtual_call_Relocation::unpack_data() {
662 _method_index = unpack_1_int();
663 }
664
665 Method* opt_virtual_call_Relocation::method_value() {
666 CompiledMethod* cm = code();
667 if (cm == NULL) return (Method*)NULL;
668 Metadata* m = cm->metadata_at(_method_index);
669 assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
670 assert(m == NULL || m->is_method(), "not a method");
671 return (Method*)m;
672 }
673
674 void opt_virtual_call_Relocation::clear_inline_cache() {
675 // No stubs for ICs
676 // Clean IC
677 ResourceMark rm;
678 CompiledIC* icache = CompiledIC_at(this);
679 icache->set_to_clean();
680 }
681
682
683 address opt_virtual_call_Relocation::static_stub(bool is_aot) {
684 // search for the static stub who points back to this static call
685 address static_call_addr = addr();
686 RelocIterator iter(code());
687 while (iter.next()) {
688 if (iter.type() == relocInfo::static_stub_type) {
689 static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
690 if (stub_reloc->static_call() == static_call_addr && stub_reloc->is_aot() == is_aot) {
691 return iter.addr();
692 }
693 }
694 }
695 return NULL;
696 }
697
698 Method* static_call_Relocation::method_value() {
699 CompiledMethod* cm = code();
700 if (cm == NULL) return (Method*)NULL;
701 Metadata* m = cm->metadata_at(_method_index);
702 assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
703 assert(m == NULL || m->is_method(), "not a method");
704 return (Method*)m;
705 }
706
707 void static_call_Relocation::pack_data_to(CodeSection* dest) {
708 short* p = (short*) dest->locs_end();
709 p = pack_1_int_to(p, _method_index);
710 dest->set_locs_end((relocInfo*) p);
711 }
712
713 void static_call_Relocation::unpack_data() {
714 _method_index = unpack_1_int();
715 }
716
717 void static_call_Relocation::clear_inline_cache() {
718 // Safe call site info
719 CompiledStaticCall* handler = this->code()->compiledStaticCall_at(this);
720 handler->set_to_clean();
721 }
722
723
724 address static_call_Relocation::static_stub(bool is_aot) {
725 // search for the static stub who points back to this static call
726 address static_call_addr = addr();
727 RelocIterator iter(code());
728 while (iter.next()) {
729 if (iter.type() == relocInfo::static_stub_type) {
730 static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
731 if (stub_reloc->static_call() == static_call_addr && stub_reloc->is_aot() == is_aot) {
732 return iter.addr();
733 }
734 }
735 }
736 return NULL;
737 }
738
739 // Finds the trampoline address for a call. If no trampoline stub is
740 // found NULL is returned which can be handled by the caller.
741 address trampoline_stub_Relocation::get_trampoline_for(address call, nmethod* code) {
742 // There are no relocations available when the code gets relocated
743 // because of CodeBuffer expansion.
744 if (code->relocation_size() == 0)
745 return NULL;
746
747 RelocIterator iter(code, call);
748 while (iter.next()) {
749 if (iter.type() == relocInfo::trampoline_stub_type) {
750 if (iter.trampoline_stub_reloc()->owner() == call) {
751 return iter.addr();
752 }
753 }
754 }
755
756 return NULL;
757 }
758
759 void static_stub_Relocation::clear_inline_cache() {
760 // Call stub is only used when calling the interpreted code.
761 // It does not really need to be cleared, except that we want to clean out the methodoop.
762 CompiledDirectStaticCall::set_stub_to_clean(this);
763 }
764
765
766 void external_word_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
767 address target = _target;
768 if (target == NULL) {
769 // An absolute embedded reference to an external location,
770 // which means there is nothing to fix here.
771 return;
772 }
773 // Probably this reference is absolute, not relative, so the
774 // following is probably a no-op.
775 assert(src->section_index_of(target) == CodeBuffer::SECT_NONE, "sanity");
776 set_value(target);
777 }
778
779
780 address external_word_Relocation::target() {
781 address target = _target;
|
626 if (!metadata_is_immediate()) {
627 // get the metadata from the pool, and re-insert it into the instruction:
628 verify_value(value());
629 }
630 }
631
632 address virtual_call_Relocation::cached_value() {
633 assert(_cached_value != NULL && _cached_value < addr(), "must precede ic_call");
634 return _cached_value;
635 }
636
637 Method* virtual_call_Relocation::method_value() {
638 CompiledMethod* cm = code();
639 if (cm == NULL) return (Method*)NULL;
640 Metadata* m = cm->metadata_at(_method_index);
641 assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
642 assert(m == NULL || m->is_method(), "not a method");
643 return (Method*)m;
644 }
645
646 bool virtual_call_Relocation::clear_inline_cache() {
647 // No stubs for ICs
648 // Clean IC
649 ResourceMark rm;
650 CompiledIC* icache = CompiledIC_at(this);
651 return icache->set_to_clean();
652 }
653
654
655 void opt_virtual_call_Relocation::pack_data_to(CodeSection* dest) {
656 short* p = (short*) dest->locs_end();
657 p = pack_1_int_to(p, _method_index);
658 dest->set_locs_end((relocInfo*) p);
659 }
660
661 void opt_virtual_call_Relocation::unpack_data() {
662 _method_index = unpack_1_int();
663 }
664
665 Method* opt_virtual_call_Relocation::method_value() {
666 CompiledMethod* cm = code();
667 if (cm == NULL) return (Method*)NULL;
668 Metadata* m = cm->metadata_at(_method_index);
669 assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
670 assert(m == NULL || m->is_method(), "not a method");
671 return (Method*)m;
672 }
673
674 bool opt_virtual_call_Relocation::clear_inline_cache() {
675 // No stubs for ICs
676 // Clean IC
677 ResourceMark rm;
678 CompiledIC* icache = CompiledIC_at(this);
679 guarantee(icache->set_to_clean(),
680 "Should not need transition stubs");
681 return true;
682 }
683
684
685 address opt_virtual_call_Relocation::static_stub(bool is_aot) {
686 // search for the static stub who points back to this static call
687 address static_call_addr = addr();
688 RelocIterator iter(code());
689 while (iter.next()) {
690 if (iter.type() == relocInfo::static_stub_type) {
691 static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
692 if (stub_reloc->static_call() == static_call_addr && stub_reloc->is_aot() == is_aot) {
693 return iter.addr();
694 }
695 }
696 }
697 return NULL;
698 }
699
700 Method* static_call_Relocation::method_value() {
701 CompiledMethod* cm = code();
702 if (cm == NULL) return (Method*)NULL;
703 Metadata* m = cm->metadata_at(_method_index);
704 assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
705 assert(m == NULL || m->is_method(), "not a method");
706 return (Method*)m;
707 }
708
709 void static_call_Relocation::pack_data_to(CodeSection* dest) {
710 short* p = (short*) dest->locs_end();
711 p = pack_1_int_to(p, _method_index);
712 dest->set_locs_end((relocInfo*) p);
713 }
714
715 void static_call_Relocation::unpack_data() {
716 _method_index = unpack_1_int();
717 }
718
719 bool static_call_Relocation::clear_inline_cache() {
720 // Safe call site info
721 CompiledStaticCall* handler = this->code()->compiledStaticCall_at(this);
722 guarantee(handler->set_to_clean(),
723 "Should not need transition stubs");
724 return true;
725 }
726
727
728 address static_call_Relocation::static_stub(bool is_aot) {
729 // search for the static stub who points back to this static call
730 address static_call_addr = addr();
731 RelocIterator iter(code());
732 while (iter.next()) {
733 if (iter.type() == relocInfo::static_stub_type) {
734 static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
735 if (stub_reloc->static_call() == static_call_addr && stub_reloc->is_aot() == is_aot) {
736 return iter.addr();
737 }
738 }
739 }
740 return NULL;
741 }
742
743 // Finds the trampoline address for a call. If no trampoline stub is
744 // found NULL is returned which can be handled by the caller.
745 address trampoline_stub_Relocation::get_trampoline_for(address call, nmethod* code) {
746 // There are no relocations available when the code gets relocated
747 // because of CodeBuffer expansion.
748 if (code->relocation_size() == 0)
749 return NULL;
750
751 RelocIterator iter(code, call);
752 while (iter.next()) {
753 if (iter.type() == relocInfo::trampoline_stub_type) {
754 if (iter.trampoline_stub_reloc()->owner() == call) {
755 return iter.addr();
756 }
757 }
758 }
759
760 return NULL;
761 }
762
763 bool static_stub_Relocation::clear_inline_cache() {
764 // Call stub is only used when calling the interpreted code.
765 // It does not really need to be cleared, except that we want to clean out the methodoop.
766 CompiledDirectStaticCall::set_stub_to_clean(this);
767 return true;
768 }
769
770
771 void external_word_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
772 address target = _target;
773 if (target == NULL) {
774 // An absolute embedded reference to an external location,
775 // which means there is nothing to fix here.
776 return;
777 }
778 // Probably this reference is absolute, not relative, so the
779 // following is probably a no-op.
780 assert(src->section_index_of(target) == CodeBuffer::SECT_NONE, "sanity");
781 set_value(target);
782 }
783
784
785 address external_word_Relocation::target() {
786 address target = _target;
|