44 // corresponding set-hi instructions. The "o" arguments for the
45 // set-hi instructions are ignored, and must not affect the high-half
46 // immediate constant. The "o" arguments for the set-lo instructions are
47 // added into the low-half immediate constant, and must not overflow it."
48 //
49 // Currently we don't support splitting of relocations, so o must be
50 // zero:
51 assert(o == 0, "tried to split relocations");
52
53 if (!verify_only) {
54 if (format() != 1) {
55 nativeMovConstReg_at(addr())->set_data_plain(((intptr_t)x), code());
56 } else {
57 assert(type() == relocInfo::oop_type || type() == relocInfo::metadata_type,
58 "how to encode else?");
59 narrowOop no = (type() == relocInfo::oop_type) ?
60 oopDesc::encode_heap_oop((oop)x) : Klass::encode_klass((Klass*)x);
61 nativeMovConstReg_at(addr())->set_narrow_oop(no, code());
62 }
63 } else {
64 assert((address) (nativeMovConstReg_at(addr())->data()) == x, "data must match");
65 }
66 }
67
68 address Relocation::pd_call_destination(address orig_addr) {
69 intptr_t adj = 0;
70 address inst_loc = addr();
71
72 if (orig_addr != NULL) {
73 // We just moved this call instruction from orig_addr to addr().
74 // This means its target will appear to have grown by addr() - orig_addr.
75 adj = -(inst_loc - orig_addr);
76 }
77 if (NativeFarCall::is_far_call_at(inst_loc)) {
78 NativeFarCall* call = nativeFarCall_at(inst_loc);
79 return call->destination() + (intptr_t)(call->is_pcrelative() ? adj : 0);
80 } else if (NativeJump::is_jump_at(inst_loc)) {
81 NativeJump* jump = nativeJump_at(inst_loc);
82 return jump->jump_destination() + (intptr_t)(jump->is_pcrelative() ? adj : 0);
83 } else if (NativeConditionalFarBranch::is_conditional_far_branch_at(inst_loc)) {
84 NativeConditionalFarBranch* branch = NativeConditionalFarBranch_at(inst_loc);
|
44 // corresponding set-hi instructions. The "o" arguments for the
45 // set-hi instructions are ignored, and must not affect the high-half
46 // immediate constant. The "o" arguments for the set-lo instructions are
47 // added into the low-half immediate constant, and must not overflow it."
48 //
49 // Currently we don't support splitting of relocations, so o must be
50 // zero:
51 assert(o == 0, "tried to split relocations");
52
53 if (!verify_only) {
54 if (format() != 1) {
55 nativeMovConstReg_at(addr())->set_data_plain(((intptr_t)x), code());
56 } else {
57 assert(type() == relocInfo::oop_type || type() == relocInfo::metadata_type,
58 "how to encode else?");
59 narrowOop no = (type() == relocInfo::oop_type) ?
60 oopDesc::encode_heap_oop((oop)x) : Klass::encode_klass((Klass*)x);
61 nativeMovConstReg_at(addr())->set_narrow_oop(no, code());
62 }
63 } else {
64 guarantee((address) (nativeMovConstReg_at(addr())->data()) == x, "data must match");
65 }
66 }
67
68 address Relocation::pd_call_destination(address orig_addr) {
69 intptr_t adj = 0;
70 address inst_loc = addr();
71
72 if (orig_addr != NULL) {
73 // We just moved this call instruction from orig_addr to addr().
74 // This means its target will appear to have grown by addr() - orig_addr.
75 adj = -(inst_loc - orig_addr);
76 }
77 if (NativeFarCall::is_far_call_at(inst_loc)) {
78 NativeFarCall* call = nativeFarCall_at(inst_loc);
79 return call->destination() + (intptr_t)(call->is_pcrelative() ? adj : 0);
80 } else if (NativeJump::is_jump_at(inst_loc)) {
81 NativeJump* jump = nativeJump_at(inst_loc);
82 return jump->jump_destination() + (intptr_t)(jump->is_pcrelative() ? adj : 0);
83 } else if (NativeConditionalFarBranch::is_conditional_far_branch_at(inst_loc)) {
84 NativeConditionalFarBranch* branch = NativeConditionalFarBranch_at(inst_loc);
|