1.1 --- a/src/cpu/x86/vm/relocInfo_x86.cpp Fri Mar 18 09:03:43 2011 -0700 1.2 +++ b/src/cpu/x86/vm/relocInfo_x86.cpp Fri Mar 18 15:52:42 2011 -0700 1.3 @@ -31,7 +31,7 @@ 1.4 #include "runtime/safepoint.hpp" 1.5 1.6 1.7 -void Relocation::pd_set_data_value(address x, intptr_t o) { 1.8 +void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) { 1.9 #ifdef AMD64 1.10 x += o; 1.11 typedef Assembler::WhichOperand WhichOperand; 1.12 @@ -40,19 +40,35 @@ 1.13 which == Assembler::narrow_oop_operand || 1.14 which == Assembler::imm_operand, "format unpacks ok"); 1.15 if (which == Assembler::imm_operand) { 1.16 - *pd_address_in_code() = x; 1.17 + if (verify_only) { 1.18 + assert(*pd_address_in_code() == x, "instructions must match"); 1.19 + } else { 1.20 + *pd_address_in_code() = x; 1.21 + } 1.22 } else if (which == Assembler::narrow_oop_operand) { 1.23 address disp = Assembler::locate_operand(addr(), which); 1.24 - *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x); 1.25 + if (verify_only) { 1.26 + assert(*(uint32_t*) disp == oopDesc::encode_heap_oop((oop)x), "instructions must match"); 1.27 + } else { 1.28 + *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x); 1.29 + } 1.30 } else { 1.31 // Note: Use runtime_call_type relocations for call32_operand. 1.32 address ip = addr(); 1.33 address disp = Assembler::locate_operand(ip, which); 1.34 address next_ip = Assembler::locate_next_instruction(ip); 1.35 - *(int32_t*) disp = x - next_ip; 1.36 + if (verify_only) { 1.37 + assert(*(int32_t*) disp == (x - next_ip), "instructions must match"); 1.38 + } else { 1.39 + *(int32_t*) disp = x - next_ip; 1.40 + } 1.41 } 1.42 #else 1.43 - *pd_address_in_code() = x + o; 1.44 + if (verify_only) { 1.45 + assert(*pd_address_in_code() == (x + o), "instructions must match"); 1.46 + } else { 1.47 + *pd_address_in_code() = x + o; 1.48 + } 1.49 #endif // AMD64 1.50 } 1.51