31 #include "runtime/safepoint.hpp"
32
33
34 void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
35 #ifdef AMD64
36 x += o;
37 typedef Assembler::WhichOperand WhichOperand;
38 WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm, call32, narrow oop
39 assert(which == Assembler::disp32_operand ||
40 which == Assembler::narrow_oop_operand ||
41 which == Assembler::imm_operand, "format unpacks ok");
42 if (which == Assembler::imm_operand) {
43 if (verify_only) {
44 guarantee(*pd_address_in_code() == x, "instructions must match");
45 } else {
46 *pd_address_in_code() = x;
47 }
48 } else if (which == Assembler::narrow_oop_operand) {
49 address disp = Assembler::locate_operand(addr(), which);
50 // both compressed oops and compressed classes look the same
51 if (Universe::heap()->is_in_reserved((oop)x)) {
52 if (verify_only) {
53 guarantee(*(uint32_t*) disp == oopDesc::encode_heap_oop((oop)x), "instructions must match");
54 } else {
55 *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x);
56 }
57 } else {
58 if (verify_only) {
59 guarantee(*(uint32_t*) disp == Klass::encode_klass((Klass*)x), "instructions must match");
60 } else {
61 *(int32_t*) disp = Klass::encode_klass((Klass*)x);
62 }
63 }
64 } else {
65 // Note: Use runtime_call_type relocations for call32_operand.
66 address ip = addr();
67 address disp = Assembler::locate_operand(ip, which);
68 address next_ip = Assembler::locate_next_instruction(ip);
69 if (verify_only) {
70 guarantee(*(int32_t*) disp == (x - next_ip), "instructions must match");
71 } else {
|
31 #include "runtime/safepoint.hpp"
32
33
34 void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
35 #ifdef AMD64
36 x += o;
37 typedef Assembler::WhichOperand WhichOperand;
38 WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm, call32, narrow oop
39 assert(which == Assembler::disp32_operand ||
40 which == Assembler::narrow_oop_operand ||
41 which == Assembler::imm_operand, "format unpacks ok");
42 if (which == Assembler::imm_operand) {
43 if (verify_only) {
44 guarantee(*pd_address_in_code() == x, "instructions must match");
45 } else {
46 *pd_address_in_code() = x;
47 }
48 } else if (which == Assembler::narrow_oop_operand) {
49 address disp = Assembler::locate_operand(addr(), which);
50 // both compressed oops and compressed classes look the same
51 if (GC::gc()->heap()->is_in_reserved((oop)x)) {
52 if (verify_only) {
53 guarantee(*(uint32_t*) disp == oopDesc::encode_heap_oop((oop)x), "instructions must match");
54 } else {
55 *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x);
56 }
57 } else {
58 if (verify_only) {
59 guarantee(*(uint32_t*) disp == Klass::encode_klass((Klass*)x), "instructions must match");
60 } else {
61 *(int32_t*) disp = Klass::encode_klass((Klass*)x);
62 }
63 }
64 } else {
65 // Note: Use runtime_call_type relocations for call32_operand.
66 address ip = addr();
67 address disp = Assembler::locate_operand(ip, which);
68 address next_ip = Assembler::locate_next_instruction(ip);
69 if (verify_only) {
70 guarantee(*(int32_t*) disp == (x - next_ip), "instructions must match");
71 } else {
|