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
|
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
|