hotspot/src/share/vm/code/relocInfo.cpp
changeset 35086 bbf32241d851
parent 33807 9f8b0f8a3f29
child 36301 cb578d8c6cba
equal deleted inserted replaced
35085:839c8ba29724 35086:bbf32241d851
   579   short*  p     = (short*) dest->locs_end();
   579   short*  p     = (short*) dest->locs_end();
   580   address point =          dest->locs_point();
   580   address point =          dest->locs_point();
   581 
   581 
   582   normalize_address(_cached_value, dest);
   582   normalize_address(_cached_value, dest);
   583   jint x0 = scaled_offset_null_special(_cached_value, point);
   583   jint x0 = scaled_offset_null_special(_cached_value, point);
   584   p = pack_1_int_to(p, x0);
   584   p = pack_2_ints_to(p, x0, _method_index);
   585   dest->set_locs_end((relocInfo*) p);
   585   dest->set_locs_end((relocInfo*) p);
   586 }
   586 }
   587 
   587 
   588 
   588 
   589 void virtual_call_Relocation::unpack_data() {
   589 void virtual_call_Relocation::unpack_data() {
   590   jint x0 = unpack_1_int();
   590   jint x0 = 0;
       
   591   unpack_2_ints(x0, _method_index);
   591   address point = addr();
   592   address point = addr();
   592   _cached_value = x0==0? NULL: address_from_scaled_offset(x0, point);
   593   _cached_value = x0==0? NULL: address_from_scaled_offset(x0, point);
   593 }
   594 }
   594 
   595 
   595 
   596 
   791 address virtual_call_Relocation::cached_value() {
   792 address virtual_call_Relocation::cached_value() {
   792   assert(_cached_value != NULL && _cached_value < addr(), "must precede ic_call");
   793   assert(_cached_value != NULL && _cached_value < addr(), "must precede ic_call");
   793   return _cached_value;
   794   return _cached_value;
   794 }
   795 }
   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 }
   796 
   803 
   797 void virtual_call_Relocation::clear_inline_cache() {
   804 void virtual_call_Relocation::clear_inline_cache() {
   798   // No stubs for ICs
   805   // No stubs for ICs
   799   // Clean IC
   806   // Clean IC
   800   ResourceMark rm;
   807   ResourceMark rm;
   801   CompiledIC* icache = CompiledIC_at(this);
   808   CompiledIC* icache = CompiledIC_at(this);
   802   icache->set_to_clean();
   809   icache->set_to_clean();
   803 }
   810 }
   804 
   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 }
   805 
   829 
   806 void opt_virtual_call_Relocation::clear_inline_cache() {
   830 void opt_virtual_call_Relocation::clear_inline_cache() {
   807   // No stubs for ICs
   831   // No stubs for ICs
   808   // Clean IC
   832   // Clean IC
   809   ResourceMark rm;
   833   ResourceMark rm;
   825     }
   849     }
   826   }
   850   }
   827   return NULL;
   851   return NULL;
   828 }
   852 }
   829 
   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 }
   830 
   870 
   831 void static_call_Relocation::clear_inline_cache() {
   871 void static_call_Relocation::clear_inline_cache() {
   832   // Safe call site info
   872   // Safe call site info
   833   CompiledStaticCall* handler = compiledStaticCall_at(this);
   873   CompiledStaticCall* handler = compiledStaticCall_at(this);
   834   handler->set_to_clean();
   874   handler->set_to_clean();
  1012       DataRelocation* r = (DataRelocation*) reloc();
  1052       DataRelocation* r = (DataRelocation*) reloc();
  1013       tty->print(" | [target=" INTPTR_FORMAT "]", p2i(r->value())); //value==target
  1053       tty->print(" | [target=" INTPTR_FORMAT "]", p2i(r->value())); //value==target
  1014       break;
  1054       break;
  1015     }
  1055     }
  1016   case relocInfo::static_call_type:
  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     }
  1017   case relocInfo::runtime_call_type:
  1063   case relocInfo::runtime_call_type:
  1018     {
  1064     {
  1019       CallRelocation* r = (CallRelocation*) reloc();
  1065       CallRelocation* r = (CallRelocation*) reloc();
  1020       tty->print(" | [destination=" INTPTR_FORMAT "]", p2i(r->destination()));
  1066       tty->print(" | [destination=" INTPTR_FORMAT "]", p2i(r->destination()));
  1021       break;
  1067       break;
  1022     }
  1068     }
  1023   case relocInfo::virtual_call_type:
  1069   case relocInfo::virtual_call_type:
  1024     {
  1070     {
  1025       virtual_call_Relocation* r = (virtual_call_Relocation*) reloc();
  1071       virtual_call_Relocation* r = (virtual_call_Relocation*) reloc();
  1026       tty->print(" | [destination=" INTPTR_FORMAT " cached_value=" INTPTR_FORMAT "]",
  1072       tty->print(" | [destination=" INTPTR_FORMAT " cached_value=" INTPTR_FORMAT " metadata=" INTPTR_FORMAT "]",
  1027                  p2i(r->destination()), p2i(r->cached_value()));
  1073                  p2i(r->destination()), p2i(r->cached_value()), p2i(r->method_value()));
  1028       break;
  1074       break;
  1029     }
  1075     }
  1030   case relocInfo::static_stub_type:
  1076   case relocInfo::static_stub_type:
  1031     {
  1077     {
  1032       static_stub_Relocation* r = (static_stub_Relocation*) reloc();
  1078       static_stub_Relocation* r = (static_stub_Relocation*) reloc();
  1035     }
  1081     }
  1036   case relocInfo::trampoline_stub_type:
  1082   case relocInfo::trampoline_stub_type:
  1037     {
  1083     {
  1038       trampoline_stub_Relocation* r = (trampoline_stub_Relocation*) reloc();
  1084       trampoline_stub_Relocation* r = (trampoline_stub_Relocation*) reloc();
  1039       tty->print(" | [trampoline owner=" INTPTR_FORMAT "]", p2i(r->owner()));
  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()));
  1040       break;
  1093       break;
  1041     }
  1094     }
  1042   }
  1095   }
  1043   tty->cr();
  1096   tty->cr();
  1044 }
  1097 }