void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen) { Untested("pd_swap_out_breakpoint"); #if 0 /* excise for now */ assert(NativeIllegalInstruction::instruction_size == sizeof(short), "right address unit for update"); NativeInstruction* ni = nativeInstruction_at(x); *(short*)ni->addr_at(0) = instrs[0]; #endif /* excise for now */ }
void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) { NativeInstruction* ip = nativeInstruction_at(addr()); jint inst = ip->long_at(0); assert(inst != NativeInstruction::illegal_instruction(), "no breakpoint"); switch (Assembler::inv_op(inst)) { case Assembler::ldst_op: #ifdef ASSERT switch (Assembler::inv_op3(inst)) { case Assembler::lduw_op3: case Assembler::ldub_op3: case Assembler::lduh_op3: case Assembler::ldd_op3: case Assembler::ldsw_op3: case Assembler::ldsb_op3: case Assembler::ldsh_op3: case Assembler::ldx_op3: case Assembler::ldf_op3: case Assembler::lddf_op3: case Assembler::stw_op3: case Assembler::stb_op3: case Assembler::sth_op3: case Assembler::std_op3: case Assembler::stx_op3: case Assembler::stf_op3: case Assembler::stdf_op3: case Assembler::casa_op3: case Assembler::casxa_op3: break; default: ShouldNotReachHere(); } goto do_non_sethi; #endif case Assembler::arith_op: #ifdef ASSERT switch (Assembler::inv_op3(inst)) { case Assembler::or_op3: case Assembler::add_op3: case Assembler::jmpl_op3: break; default: ShouldNotReachHere(); } do_non_sethi:; #endif { guarantee(Assembler::inv_immed(inst), "must have a simm13 field"); int simm13 = Assembler::low10((intptr_t)x) + o; guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13"); inst &= ~Assembler::simm( -1, 13); inst |= Assembler::simm(simm13, 13); if (verify_only) { assert(ip->long_at(0) == inst, "instructions must match"); } else { ip->set_long_at(0, inst); } } break; case Assembler::branch_op: { #ifdef _LP64 jint inst2; guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi"); if (format() != 0) { assert(type() == relocInfo::oop_type || type() == relocInfo::metadata_type, "only narrow oops or klasses case"); jint np = type() == relocInfo::oop_type ? oopDesc::encode_heap_oop((oop)x) : oopDesc::encode_klass((Klass*)x); inst &= ~Assembler::hi22(-1); inst |= Assembler::hi22((intptr_t)np); if (verify_only) { assert(ip->long_at(0) == inst, "instructions must match"); } else { ip->set_long_at(0, inst); } inst2 = ip->long_at( NativeInstruction::nop_instruction_size ); guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op"); if (verify_only) { assert(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np), "instructions must match"); } else { ip->set_long_at(NativeInstruction::nop_instruction_size, NativeInstruction::set_data32_simm13( inst2, (intptr_t)np)); } break; } if (verify_only) { ip->verify_data64_sethi( ip->addr_at(0), (intptr_t)x ); } else { ip->set_data64_sethi( ip->addr_at(0), (intptr_t)x ); } #else guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi"); inst &= ~Assembler::hi22( -1); inst |= Assembler::hi22((intptr_t)x); // (ignore offset; it doesn't play into the sethi) if (verify_only) { assert(ip->long_at(0) == inst, "instructions must match"); } else { ip->set_long_at(0, inst); } #endif } break; default: guarantee(false, "instruction must perform arithmetic or memory access"); } }