src/share/vm/c1/c1_Runtime1.cpp

Print this page




1061               oop* oop_adr = r->oop_addr();
1062               *oop_adr = stub_id == Runtime1::load_mirror_patching_id ? mirror() : appendix();
1063               r->fix_oop_relocation();
1064               found = true;
1065             } else if (mds.type() == relocInfo::metadata_type) {
1066               assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
1067               metadata_Relocation* r = mds.metadata_reloc();
1068               Metadata** metadata_adr = r->metadata_addr();
1069               *metadata_adr = load_klass();
1070               r->fix_metadata_relocation();
1071               found = true;
1072             }
1073           }
1074           assert(found, "the metadata must exist!");
1075         }
1076 #endif
1077         if (do_patch) {
1078           // replace instructions
1079           // first replace the tail, then the call
1080 #ifdef ARM
1081           if(load_klass_or_mirror_patch_id && !VM_Version::supports_movw()) {


1082             nmethod* nm = CodeCache::find_nmethod(instr_pc);
1083             address addr = NULL;
1084             assert(nm != NULL, "invalid nmethod_pc");
1085             RelocIterator mds(nm, copy_buff, copy_buff + 1);
1086             while (mds.next()) {
1087               if (mds.type() == relocInfo::oop_type) {
1088                 assert(stub_id == Runtime1::load_mirror_patching_id, "wrong stub id");

1089                 oop_Relocation* r = mds.oop_reloc();
1090                 addr = (address)r->oop_addr();
1091                 break;
1092               } else if (mds.type() == relocInfo::metadata_type) {
1093                 assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
1094                 metadata_Relocation* r = mds.metadata_reloc();
1095                 addr = (address)r->metadata_addr();
1096                 break;
1097               }
1098             }
1099             assert(addr != NULL, "metadata relocation must exist");
1100             copy_buff -= *byte_count;
1101             NativeMovConstReg* n_copy2 = nativeMovConstReg_at(copy_buff);
1102             n_copy2->set_pc_relative_offset(addr, instr_pc);
1103           }
1104 #endif
1105 
1106           for (int i = NativeCall::instruction_size; i < *byte_count; i++) {
1107             address ptr = copy_buff + i;
1108             int a_byte = (*ptr) & 0xFF;




1061               oop* oop_adr = r->oop_addr();
1062               *oop_adr = stub_id == Runtime1::load_mirror_patching_id ? mirror() : appendix();
1063               r->fix_oop_relocation();
1064               found = true;
1065             } else if (mds.type() == relocInfo::metadata_type) {
1066               assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
1067               metadata_Relocation* r = mds.metadata_reloc();
1068               Metadata** metadata_adr = r->metadata_addr();
1069               *metadata_adr = load_klass();
1070               r->fix_metadata_relocation();
1071               found = true;
1072             }
1073           }
1074           assert(found, "the metadata must exist!");
1075         }
1076 #endif
1077         if (do_patch) {
1078           // replace instructions
1079           // first replace the tail, then the call
1080 #ifdef ARM
1081           if((load_klass_or_mirror_patch_id ||
1082               stub_id == Runtime1::load_appendix_patching_id) &&
1083              !VM_Version::supports_movw()) {
1084             nmethod* nm = CodeCache::find_nmethod(instr_pc);
1085             address addr = NULL;
1086             assert(nm != NULL, "invalid nmethod_pc");
1087             RelocIterator mds(nm, copy_buff, copy_buff + 1);
1088             while (mds.next()) {
1089               if (mds.type() == relocInfo::oop_type) {
1090                 assert(stub_id == Runtime1::load_mirror_patching_id ||
1091                        stub_id == Runtime1::load_appendix_patching_id, "wrong stub id");
1092                 oop_Relocation* r = mds.oop_reloc();
1093                 addr = (address)r->oop_addr();
1094                 break;
1095               } else if (mds.type() == relocInfo::metadata_type) {
1096                 assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
1097                 metadata_Relocation* r = mds.metadata_reloc();
1098                 addr = (address)r->metadata_addr();
1099                 break;
1100               }
1101             }
1102             assert(addr != NULL, "metadata relocation must exist");
1103             copy_buff -= *byte_count;
1104             NativeMovConstReg* n_copy2 = nativeMovConstReg_at(copy_buff);
1105             n_copy2->set_pc_relative_offset(addr, instr_pc);
1106           }
1107 #endif
1108 
1109           for (int i = NativeCall::instruction_size; i < *byte_count; i++) {
1110             address ptr = copy_buff + i;
1111             int a_byte = (*ptr) & 0xFF;