< prev index next >

src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp

Print this page
@@ -189,12 +189,22 @@
    assert(obj_addr.rspec().type() == relocInfo::oop_type, "must be an oop reloc");
    load_const(d, obj_addr);
  }
  
  inline void MacroAssembler::pd_patch_instruction(address branch, address target, const char* file, int line) {
-   jint& stub_inst = *(jint*) branch;
-   stub_inst = patched_branch(target - branch, stub_inst, 0);
+   if (is_branch(branch)) {
+     jint& stub_inst = *(jint*) branch;
+     stub_inst = patched_branch(target - branch, stub_inst, 0);
+   } else if (is_calculate_address_from_global_toc_at(branch + BytesPerInstWord, branch)) {
+     const address inst1_addr = branch;
+     const address inst2_addr = branch + BytesPerInstWord;
+     patch_calculate_address_from_global_toc_at(inst2_addr, inst1_addr, target);
+   } else if (is_load_const_at(branch)) {
+     patch_const(branch, (long)target);
+   } else {
+     assert(false, "instruction at " PTR_FORMAT " not recognized", p2i(branch));
+   }
  }
  
  // Relocation of conditional far branches.
  inline bool MacroAssembler::is_bc_far_variant1_at(address instruction_addr) {
    // Variant 1, the 1st instruction contains the destination address:
< prev index next >