< prev index next >

src/share/vm/c1/c1_Runtime1.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1103               r->fix_oop_relocation();
1104               found = true;
1105             } else if (mds.type() == relocInfo::metadata_type) {
1106               assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
1107               metadata_Relocation* r = mds.metadata_reloc();
1108               Metadata** metadata_adr = r->metadata_addr();
1109               *metadata_adr = load_klass();
1110               r->fix_metadata_relocation();
1111               found = true;
1112             }
1113           }
1114           assert(found, "the metadata must exist!");
1115         }
1116 #endif
1117         if (do_patch) {
1118           // replace instructions
1119           // first replace the tail, then the call
1120 #ifdef ARM
1121           if((load_klass_or_mirror_patch_id ||
1122               stub_id == Runtime1::load_appendix_patching_id) &&
1123              !VM_Version::supports_movw()) {
1124             nmethod* nm = CodeCache::find_nmethod(instr_pc);
1125             address addr = NULL;
1126             assert(nm != NULL, "invalid nmethod_pc");
1127             RelocIterator mds(nm, copy_buff, copy_buff + 1);
1128             while (mds.next()) {
1129               if (mds.type() == relocInfo::oop_type) {
1130                 assert(stub_id == Runtime1::load_mirror_patching_id ||
1131                        stub_id == Runtime1::load_appendix_patching_id, "wrong stub id");
1132                 oop_Relocation* r = mds.oop_reloc();
1133                 addr = (address)r->oop_addr();
1134                 break;
1135               } else if (mds.type() == relocInfo::metadata_type) {
1136                 assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
1137                 metadata_Relocation* r = mds.metadata_reloc();
1138                 addr = (address)r->metadata_addr();
1139                 break;
1140               }
1141             }
1142             assert(addr != NULL, "metadata relocation must exist");
1143             copy_buff -= *byte_count;


   1 /*
   2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1103               r->fix_oop_relocation();
1104               found = true;
1105             } else if (mds.type() == relocInfo::metadata_type) {
1106               assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
1107               metadata_Relocation* r = mds.metadata_reloc();
1108               Metadata** metadata_adr = r->metadata_addr();
1109               *metadata_adr = load_klass();
1110               r->fix_metadata_relocation();
1111               found = true;
1112             }
1113           }
1114           assert(found, "the metadata must exist!");
1115         }
1116 #endif
1117         if (do_patch) {
1118           // replace instructions
1119           // first replace the tail, then the call
1120 #ifdef ARM
1121           if((load_klass_or_mirror_patch_id ||
1122               stub_id == Runtime1::load_appendix_patching_id) &&
1123               nativeMovConstReg_at(copy_buff)->is_pc_relative()) {
1124             nmethod* nm = CodeCache::find_nmethod(instr_pc);
1125             address addr = NULL;
1126             assert(nm != NULL, "invalid nmethod_pc");
1127             RelocIterator mds(nm, copy_buff, copy_buff + 1);
1128             while (mds.next()) {
1129               if (mds.type() == relocInfo::oop_type) {
1130                 assert(stub_id == Runtime1::load_mirror_patching_id ||
1131                        stub_id == Runtime1::load_appendix_patching_id, "wrong stub id");
1132                 oop_Relocation* r = mds.oop_reloc();
1133                 addr = (address)r->oop_addr();
1134                 break;
1135               } else if (mds.type() == relocInfo::metadata_type) {
1136                 assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
1137                 metadata_Relocation* r = mds.metadata_reloc();
1138                 addr = (address)r->metadata_addr();
1139                 break;
1140               }
1141             }
1142             assert(addr != NULL, "metadata relocation must exist");
1143             copy_buff -= *byte_count;


< prev index next >