src/share/vm/code/relocInfo.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/code

src/share/vm/code/relocInfo.cpp

Print this page




 564 }
 565 
 566 void metadata_Relocation::pack_data_to(CodeSection* dest) {
 567   short* p = (short*) dest->locs_end();
 568   p = pack_2_ints_to(p, _metadata_index, _offset);
 569   dest->set_locs_end((relocInfo*) p);
 570 }
 571 
 572 
 573 void metadata_Relocation::unpack_data() {
 574   unpack_2_ints(_metadata_index, _offset);
 575 }
 576 
 577 
 578 void virtual_call_Relocation::pack_data_to(CodeSection* dest) {
 579   short*  p     = (short*) dest->locs_end();
 580   address point =          dest->locs_point();
 581 
 582   normalize_address(_cached_value, dest);
 583   jint x0 = scaled_offset_null_special(_cached_value, point);
 584   p = pack_1_int_to(p, x0);
 585   dest->set_locs_end((relocInfo*) p);
 586 }
 587 
 588 
 589 void virtual_call_Relocation::unpack_data() {
 590   jint x0 = unpack_1_int();

 591   address point = addr();
 592   _cached_value = x0==0? NULL: address_from_scaled_offset(x0, point);
 593 }
 594 
 595 
 596 void static_stub_Relocation::pack_data_to(CodeSection* dest) {
 597   short* p = (short*) dest->locs_end();
 598   CodeSection* insts = dest->outer()->insts();
 599   normalize_address(_static_call, insts);
 600   p = pack_1_int_to(p, scaled_offset(_static_call, insts->start()));
 601   dest->set_locs_end((relocInfo*) p);
 602 }
 603 
 604 void static_stub_Relocation::unpack_data() {
 605   address base = binding()->section_start(CodeBuffer::SECT_INSTS);
 606   jint offset = unpack_1_int();
 607   _static_call = address_from_scaled_offset(offset, base);
 608 }
 609 
 610 void trampoline_stub_Relocation::pack_data_to(CodeSection* dest ) {


 776 void metadata_Relocation::fix_metadata_relocation() {
 777   if (!metadata_is_immediate()) {
 778     // get the metadata from the pool, and re-insert it into the instruction:
 779     pd_fix_value(value());
 780   }
 781 }
 782 
 783 
 784 void metadata_Relocation::verify_metadata_relocation() {
 785   if (!metadata_is_immediate()) {
 786     // get the metadata from the pool, and re-insert it into the instruction:
 787     verify_value(value());
 788   }
 789 }
 790 
 791 address virtual_call_Relocation::cached_value() {
 792   assert(_cached_value != NULL && _cached_value < addr(), "must precede ic_call");
 793   return _cached_value;
 794 }
 795 






 796 
 797 void virtual_call_Relocation::clear_inline_cache() {
 798   // No stubs for ICs
 799   // Clean IC
 800   ResourceMark rm;
 801   CompiledIC* icache = CompiledIC_at(this);
 802   icache->set_to_clean();
 803 }
 804 
 805 

















 806 void opt_virtual_call_Relocation::clear_inline_cache() {
 807   // No stubs for ICs
 808   // Clean IC
 809   ResourceMark rm;
 810   CompiledIC* icache = CompiledIC_at(this);
 811   icache->set_to_clean();
 812 }
 813 
 814 
 815 address opt_virtual_call_Relocation::static_stub() {
 816   // search for the static stub who points back to this static call
 817   address static_call_addr = addr();
 818   RelocIterator iter(code());
 819   while (iter.next()) {
 820     if (iter.type() == relocInfo::static_stub_type) {
 821       static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
 822       if (stub_reloc->static_call() == static_call_addr) {
 823         return iter.addr();
 824       }
 825     }
 826   }
 827   return NULL;
 828 }
 829 
















 830 
 831 void static_call_Relocation::clear_inline_cache() {
 832   // Safe call site info
 833   CompiledStaticCall* handler = compiledStaticCall_at(this);
 834   handler->set_to_clean();
 835 }
 836 
 837 
 838 address static_call_Relocation::static_stub() {
 839   // search for the static stub who points back to this static call
 840   address static_call_addr = addr();
 841   RelocIterator iter(code());
 842   while (iter.next()) {
 843     if (iter.type() == relocInfo::static_stub_type) {
 844       static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
 845       if (stub_reloc->static_call() == static_call_addr) {
 846         return iter.addr();
 847       }
 848     }
 849   }


 997         raw_metadata   = *metadata_addr;
 998         metadata_value = r->metadata_value();
 999       }
1000       tty->print(" | [metadata_addr=" INTPTR_FORMAT " *=" INTPTR_FORMAT " offset=%d]",
1001                  p2i(metadata_addr), p2i(raw_metadata), r->offset());
1002       if (metadata_value != NULL) {
1003         tty->print("metadata_value=" INTPTR_FORMAT ": ", p2i(metadata_value));
1004         metadata_value->print_value_on(tty);
1005       }
1006       break;
1007     }
1008   case relocInfo::external_word_type:
1009   case relocInfo::internal_word_type:
1010   case relocInfo::section_word_type:
1011     {
1012       DataRelocation* r = (DataRelocation*) reloc();
1013       tty->print(" | [target=" INTPTR_FORMAT "]", p2i(r->value())); //value==target
1014       break;
1015     }
1016   case relocInfo::static_call_type:






1017   case relocInfo::runtime_call_type:
1018     {
1019       CallRelocation* r = (CallRelocation*) reloc();
1020       tty->print(" | [destination=" INTPTR_FORMAT "]", p2i(r->destination()));
1021       break;
1022     }
1023   case relocInfo::virtual_call_type:
1024     {
1025       virtual_call_Relocation* r = (virtual_call_Relocation*) reloc();
1026       tty->print(" | [destination=" INTPTR_FORMAT " cached_value=" INTPTR_FORMAT "]",
1027                  p2i(r->destination()), p2i(r->cached_value()));
1028       break;
1029     }
1030   case relocInfo::static_stub_type:
1031     {
1032       static_stub_Relocation* r = (static_stub_Relocation*) reloc();
1033       tty->print(" | [static_call=" INTPTR_FORMAT "]", p2i(r->static_call()));
1034       break;
1035     }
1036   case relocInfo::trampoline_stub_type:
1037     {
1038       trampoline_stub_Relocation* r = (trampoline_stub_Relocation*) reloc();
1039       tty->print(" | [trampoline owner=" INTPTR_FORMAT "]", p2i(r->owner()));
1040       break;
1041     }







1042   }
1043   tty->cr();
1044 }
1045 
1046 
1047 void RelocIterator::print() {
1048   RelocIterator save_this = (*this);
1049   relocInfo* scan = _current;
1050   if (!has_current())  scan += 1;  // nothing to scan here!
1051 
1052   bool skip_next = has_current();
1053   bool got_next;
1054   while (true) {
1055     got_next = (skip_next || next());
1056     skip_next = false;
1057 
1058     tty->print("         @" INTPTR_FORMAT ": ", p2i(scan));
1059     relocInfo* newscan = _current+1;
1060     if (!has_current())  newscan -= 1;  // nothing to scan here!
1061     while (scan < newscan) {




 564 }
 565 
 566 void metadata_Relocation::pack_data_to(CodeSection* dest) {
 567   short* p = (short*) dest->locs_end();
 568   p = pack_2_ints_to(p, _metadata_index, _offset);
 569   dest->set_locs_end((relocInfo*) p);
 570 }
 571 
 572 
 573 void metadata_Relocation::unpack_data() {
 574   unpack_2_ints(_metadata_index, _offset);
 575 }
 576 
 577 
 578 void virtual_call_Relocation::pack_data_to(CodeSection* dest) {
 579   short*  p     = (short*) dest->locs_end();
 580   address point =          dest->locs_point();
 581 
 582   normalize_address(_cached_value, dest);
 583   jint x0 = scaled_offset_null_special(_cached_value, point);
 584   p = pack_2_ints_to(p, x0, _method_index);
 585   dest->set_locs_end((relocInfo*) p);
 586 }
 587 
 588 
 589 void virtual_call_Relocation::unpack_data() {
 590   jint x0 = 0;
 591   unpack_2_ints(x0, _method_index);
 592   address point = addr();
 593   _cached_value = x0==0? NULL: address_from_scaled_offset(x0, point);
 594 }
 595 
 596 
 597 void static_stub_Relocation::pack_data_to(CodeSection* dest) {
 598   short* p = (short*) dest->locs_end();
 599   CodeSection* insts = dest->outer()->insts();
 600   normalize_address(_static_call, insts);
 601   p = pack_1_int_to(p, scaled_offset(_static_call, insts->start()));
 602   dest->set_locs_end((relocInfo*) p);
 603 }
 604 
 605 void static_stub_Relocation::unpack_data() {
 606   address base = binding()->section_start(CodeBuffer::SECT_INSTS);
 607   jint offset = unpack_1_int();
 608   _static_call = address_from_scaled_offset(offset, base);
 609 }
 610 
 611 void trampoline_stub_Relocation::pack_data_to(CodeSection* dest ) {


 777 void metadata_Relocation::fix_metadata_relocation() {
 778   if (!metadata_is_immediate()) {
 779     // get the metadata from the pool, and re-insert it into the instruction:
 780     pd_fix_value(value());
 781   }
 782 }
 783 
 784 
 785 void metadata_Relocation::verify_metadata_relocation() {
 786   if (!metadata_is_immediate()) {
 787     // get the metadata from the pool, and re-insert it into the instruction:
 788     verify_value(value());
 789   }
 790 }
 791 
 792 address virtual_call_Relocation::cached_value() {
 793   assert(_cached_value != NULL && _cached_value < addr(), "must precede ic_call");
 794   return _cached_value;
 795 }
 796 
 797 Method* virtual_call_Relocation::method_value() {
 798   Metadata* m = code()->metadata_at(_method_index);
 799   assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
 800   assert(m == NULL || m->is_method(), "not a method");
 801   return (Method*)m;
 802 }
 803 
 804 void virtual_call_Relocation::clear_inline_cache() {
 805   // No stubs for ICs
 806   // Clean IC
 807   ResourceMark rm;
 808   CompiledIC* icache = CompiledIC_at(this);
 809   icache->set_to_clean();
 810 }
 811 
 812 
 813 void opt_virtual_call_Relocation::pack_data_to(CodeSection* dest) {
 814   short* p = (short*) dest->locs_end();
 815   p = pack_1_int_to(p, _method_index);
 816   dest->set_locs_end((relocInfo*) p);
 817 }
 818 
 819 void opt_virtual_call_Relocation::unpack_data() {
 820   _method_index = unpack_1_int();
 821 }
 822 
 823 Method* opt_virtual_call_Relocation::method_value() {
 824   Metadata* m = code()->metadata_at(_method_index);
 825   assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
 826   assert(m == NULL || m->is_method(), "not a method");
 827   return (Method*)m;
 828 }
 829 
 830 void opt_virtual_call_Relocation::clear_inline_cache() {
 831   // No stubs for ICs
 832   // Clean IC
 833   ResourceMark rm;
 834   CompiledIC* icache = CompiledIC_at(this);
 835   icache->set_to_clean();
 836 }
 837 
 838 
 839 address opt_virtual_call_Relocation::static_stub() {
 840   // search for the static stub who points back to this static call
 841   address static_call_addr = addr();
 842   RelocIterator iter(code());
 843   while (iter.next()) {
 844     if (iter.type() == relocInfo::static_stub_type) {
 845       static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
 846       if (stub_reloc->static_call() == static_call_addr) {
 847         return iter.addr();
 848       }
 849     }
 850   }
 851   return NULL;
 852 }
 853 
 854 Method* static_call_Relocation::method_value() {
 855   Metadata* m = code()->metadata_at(_method_index);
 856   assert(m != NULL || _method_index == 0, "should be non-null for non-zero index");
 857   assert(m == NULL || m->is_method(), "not a method");
 858   return (Method*)m;
 859 }
 860 
 861 void static_call_Relocation::pack_data_to(CodeSection* dest) {
 862   short* p = (short*) dest->locs_end();
 863   p = pack_1_int_to(p, _method_index);
 864   dest->set_locs_end((relocInfo*) p);
 865 }
 866 
 867 void static_call_Relocation::unpack_data() {
 868   _method_index = unpack_1_int();
 869 }
 870 
 871 void static_call_Relocation::clear_inline_cache() {
 872   // Safe call site info
 873   CompiledStaticCall* handler = compiledStaticCall_at(this);
 874   handler->set_to_clean();
 875 }
 876 
 877 
 878 address static_call_Relocation::static_stub() {
 879   // search for the static stub who points back to this static call
 880   address static_call_addr = addr();
 881   RelocIterator iter(code());
 882   while (iter.next()) {
 883     if (iter.type() == relocInfo::static_stub_type) {
 884       static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
 885       if (stub_reloc->static_call() == static_call_addr) {
 886         return iter.addr();
 887       }
 888     }
 889   }


1037         raw_metadata   = *metadata_addr;
1038         metadata_value = r->metadata_value();
1039       }
1040       tty->print(" | [metadata_addr=" INTPTR_FORMAT " *=" INTPTR_FORMAT " offset=%d]",
1041                  p2i(metadata_addr), p2i(raw_metadata), r->offset());
1042       if (metadata_value != NULL) {
1043         tty->print("metadata_value=" INTPTR_FORMAT ": ", p2i(metadata_value));
1044         metadata_value->print_value_on(tty);
1045       }
1046       break;
1047     }
1048   case relocInfo::external_word_type:
1049   case relocInfo::internal_word_type:
1050   case relocInfo::section_word_type:
1051     {
1052       DataRelocation* r = (DataRelocation*) reloc();
1053       tty->print(" | [target=" INTPTR_FORMAT "]", p2i(r->value())); //value==target
1054       break;
1055     }
1056   case relocInfo::static_call_type:
1057     {
1058       static_call_Relocation* r = (static_call_Relocation*) reloc();
1059       tty->print(" | [destination=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
1060                  p2i(r->destination()), p2i(r->method_value()));
1061       break;
1062     }
1063   case relocInfo::runtime_call_type:
1064     {
1065       CallRelocation* r = (CallRelocation*) reloc();
1066       tty->print(" | [destination=" INTPTR_FORMAT "]", p2i(r->destination()));
1067       break;
1068     }
1069   case relocInfo::virtual_call_type:
1070     {
1071       virtual_call_Relocation* r = (virtual_call_Relocation*) reloc();
1072       tty->print(" | [destination=" INTPTR_FORMAT " cached_value=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
1073                  p2i(r->destination()), p2i(r->cached_value()), p2i(r->method_value()));
1074       break;
1075     }
1076   case relocInfo::static_stub_type:
1077     {
1078       static_stub_Relocation* r = (static_stub_Relocation*) reloc();
1079       tty->print(" | [static_call=" INTPTR_FORMAT "]", p2i(r->static_call()));
1080       break;
1081     }
1082   case relocInfo::trampoline_stub_type:
1083     {
1084       trampoline_stub_Relocation* r = (trampoline_stub_Relocation*) reloc();
1085       tty->print(" | [trampoline owner=" INTPTR_FORMAT "]", p2i(r->owner()));
1086       break;
1087     }
1088   case relocInfo::opt_virtual_call_type:
1089     {
1090       opt_virtual_call_Relocation* r = (opt_virtual_call_Relocation*) reloc();
1091       tty->print(" | [destination=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
1092                  p2i(r->destination()), p2i(r->method_value()));
1093       break;
1094     }
1095   }
1096   tty->cr();
1097 }
1098 
1099 
1100 void RelocIterator::print() {
1101   RelocIterator save_this = (*this);
1102   relocInfo* scan = _current;
1103   if (!has_current())  scan += 1;  // nothing to scan here!
1104 
1105   bool skip_next = has_current();
1106   bool got_next;
1107   while (true) {
1108     got_next = (skip_next || next());
1109     skip_next = false;
1110 
1111     tty->print("         @" INTPTR_FORMAT ": ", p2i(scan));
1112     relocInfo* newscan = _current+1;
1113     if (!has_current())  newscan -= 1;  // nothing to scan here!
1114     while (scan < newscan) {


src/share/vm/code/relocInfo.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File