Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/relocInfo_x86.cpp @ 2375:d673ef06fe96
7028374: race in fix_oop_relocations for scavengeable nmethods
Reviewed-by: kvn
author | never |
---|---|
date | Fri, 18 Mar 2011 15:52:42 -0700 |
parents | f95d63e2154a |
children | b40d4fa697bf |
comparison
equal
deleted
inserted
replaced
2370:048f98400b8e | 2375:d673ef06fe96 |
---|---|
29 #include "nativeInst_x86.hpp" | 29 #include "nativeInst_x86.hpp" |
30 #include "oops/oop.inline.hpp" | 30 #include "oops/oop.inline.hpp" |
31 #include "runtime/safepoint.hpp" | 31 #include "runtime/safepoint.hpp" |
32 | 32 |
33 | 33 |
34 void Relocation::pd_set_data_value(address x, intptr_t o) { | 34 void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) { |
35 #ifdef AMD64 | 35 #ifdef AMD64 |
36 x += o; | 36 x += o; |
37 typedef Assembler::WhichOperand WhichOperand; | 37 typedef Assembler::WhichOperand WhichOperand; |
38 WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm, call32, narrow oop | 38 WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm, call32, narrow oop |
39 assert(which == Assembler::disp32_operand || | 39 assert(which == Assembler::disp32_operand || |
40 which == Assembler::narrow_oop_operand || | 40 which == Assembler::narrow_oop_operand || |
41 which == Assembler::imm_operand, "format unpacks ok"); | 41 which == Assembler::imm_operand, "format unpacks ok"); |
42 if (which == Assembler::imm_operand) { | 42 if (which == Assembler::imm_operand) { |
43 *pd_address_in_code() = x; | 43 if (verify_only) { |
44 assert(*pd_address_in_code() == x, "instructions must match"); | |
45 } else { | |
46 *pd_address_in_code() = x; | |
47 } | |
44 } else if (which == Assembler::narrow_oop_operand) { | 48 } else if (which == Assembler::narrow_oop_operand) { |
45 address disp = Assembler::locate_operand(addr(), which); | 49 address disp = Assembler::locate_operand(addr(), which); |
46 *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x); | 50 if (verify_only) { |
51 assert(*(uint32_t*) disp == oopDesc::encode_heap_oop((oop)x), "instructions must match"); | |
52 } else { | |
53 *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x); | |
54 } | |
47 } else { | 55 } else { |
48 // Note: Use runtime_call_type relocations for call32_operand. | 56 // Note: Use runtime_call_type relocations for call32_operand. |
49 address ip = addr(); | 57 address ip = addr(); |
50 address disp = Assembler::locate_operand(ip, which); | 58 address disp = Assembler::locate_operand(ip, which); |
51 address next_ip = Assembler::locate_next_instruction(ip); | 59 address next_ip = Assembler::locate_next_instruction(ip); |
52 *(int32_t*) disp = x - next_ip; | 60 if (verify_only) { |
61 assert(*(int32_t*) disp == (x - next_ip), "instructions must match"); | |
62 } else { | |
63 *(int32_t*) disp = x - next_ip; | |
64 } | |
53 } | 65 } |
54 #else | 66 #else |
55 *pd_address_in_code() = x + o; | 67 if (verify_only) { |
68 assert(*pd_address_in_code() == (x + o), "instructions must match"); | |
69 } else { | |
70 *pd_address_in_code() = x + o; | |
71 } | |
56 #endif // AMD64 | 72 #endif // AMD64 |
57 } | 73 } |
58 | 74 |
59 | 75 |
60 address Relocation::pd_call_destination(address orig_addr) { | 76 address Relocation::pd_call_destination(address orig_addr) { |