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 template<typename CompiledICorStaticCall>
675 static bool set_to_clean_no_ic_refill(CompiledICorStaticCall* ic) {
676 guarantee(ic->set_to_clean(), "Should not need transition stubs");
677 return true;
678 }
679
680 bool opt_virtual_call_Relocation::clear_inline_cache() {
681 // No stubs for ICs
682 // Clean IC
683 ResourceMark rm;
684 CompiledIC* icache = CompiledIC_at(this);
685 return set_to_clean_no_ic_refill(icache);
686 }
687
688 address opt_virtual_call_Relocation::static_stub(bool is_aot) {
689 // search for the static stub who points back to this static call
690 address static_call_addr = addr();
691 RelocIterator iter(code());
692 while (iter.next()) {
693 if (iter.type() == relocInfo::static_stub_type) {
694 static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
695 if (stub_reloc->static_call() == static_call_addr && stub_reloc->is_aot() == is_aot) {
696 return iter.addr();
697 }
698 }
699 }
700 return NULL;
701 }
702
703 Method* static_call_Relocation::method_value() {
704 CompiledMethod* cm = code();
705 if (cm == NULL) return (Method*)NULL;
706 Metadata* m = cm->metadata_at(_method_index);
707 assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
708 assert(m == NULL || m->is_method(), "not a method");
709 return (Method*)m;
710 }
711
712 void static_call_Relocation::pack_data_to(CodeSection* dest) {
713 short* p = (short*) dest->locs_end();
714 p = pack_1_int_to(p, _method_index);
715 dest->set_locs_end((relocInfo*) p);
716 }
717
718 void static_call_Relocation::unpack_data() {
719 _method_index = unpack_1_int();
720 }
721
722 bool static_call_Relocation::clear_inline_cache() {
723 // Safe call site info
724 CompiledStaticCall* handler = this->code()->compiledStaticCall_at(this);
725 return set_to_clean_no_ic_refill(handler);
726 }
727
728
729 address static_call_Relocation::static_stub(bool is_aot) {
730 // search for the static stub who points back to this static call
731 address static_call_addr = addr();
732 RelocIterator iter(code());
733 while (iter.next()) {
734 if (iter.type() == relocInfo::static_stub_type) {
735 static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
736 if (stub_reloc->static_call() == static_call_addr && stub_reloc->is_aot() == is_aot) {
737 return iter.addr();
738 }
739 }
740 }
741 return NULL;
742 }
743
744 // Finds the trampoline address for a call. If no trampoline stub is
745 // found NULL is returned which can be handled by the caller.
746 address trampoline_stub_Relocation::get_trampoline_for(address call, nmethod* code) {
747 // There are no relocations available when the code gets relocated
748 // because of CodeBuffer expansion.
749 if (code->relocation_size() == 0)
750 return NULL;
751
752 RelocIterator iter(code, call);
753 while (iter.next()) {
754 if (iter.type() == relocInfo::trampoline_stub_type) {
755 if (iter.trampoline_stub_reloc()->owner() == call) {
756 return iter.addr();
757 }
758 }
759 }
760
761 return NULL;
762 }
763
764 bool static_stub_Relocation::clear_inline_cache() {
765 // Call stub is only used when calling the interpreted code.
766 // It does not really need to be cleared, except that we want to clean out the methodoop.
767 CompiledDirectStaticCall::set_stub_to_clean(this);
768 return true;
769 }
770
771
772 void external_word_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
773 address target = _target;
774 if (target == NULL) {
775 // An absolute embedded reference to an external location,
776 // which means there is nothing to fix here.
777 return;
778 }
779 // Probably this reference is absolute, not relative, so the
780 // following is probably a no-op.
781 assert(src->section_index_of(target) == CodeBuffer::SECT_NONE, "sanity");
782 set_value(target);
783 }
784
785
786 address external_word_Relocation::target() {
787 address target = _target;
|