13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 # include "incls/_precompiled.incl"
26 # include "incls/_relocInfo_x86.cpp.incl"
27
28
29 void Relocation::pd_set_data_value(address x, intptr_t o) {
30 #ifdef AMD64
31 x += o;
32 typedef Assembler::WhichOperand WhichOperand;
33 WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm64, call32
34 assert(which == Assembler::disp32_operand ||
35 which == Assembler::imm64_operand, "format unpacks ok");
36 if (which == Assembler::imm64_operand) {
37 *pd_address_in_code() = x;
38 } else {
39 // Note: Use runtime_call_type relocations for call32_operand.
40 address ip = addr();
41 address disp = Assembler::locate_operand(ip, which);
42 address next_ip = Assembler::locate_next_instruction(ip);
43 *(int32_t*) disp = x - next_ip;
44 }
45 #else
46 *pd_address_in_code() = x + o;
47 #endif // AMD64
48 }
49
50
51 address Relocation::pd_call_destination(address orig_addr) {
52 intptr_t adj = 0;
53 if (orig_addr != NULL) {
54 // We just moved this call instruction from orig_addr to addr().
55 // This means its target will appear to have grown by addr() - orig_addr.
56 adj = -( addr() - orig_addr );
57 }
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 # include "incls/_precompiled.incl"
26 # include "incls/_relocInfo_x86.cpp.incl"
27
28
29 void Relocation::pd_set_data_value(address x, intptr_t o) {
30 #ifdef AMD64
31 x += o;
32 typedef Assembler::WhichOperand WhichOperand;
33 WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm64, call32, narrow oop
34 assert(which == Assembler::disp32_operand ||
35 which == Assembler::narrow_oop_operand ||
36 which == Assembler::imm64_operand, "format unpacks ok");
37 if (which == Assembler::imm64_operand) {
38 *pd_address_in_code() = x;
39 } else if (which == Assembler::narrow_oop_operand) {
40 address disp = Assembler::locate_operand(addr(), which);
41 *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x);
42 } else {
43 // Note: Use runtime_call_type relocations for call32_operand.
44 address ip = addr();
45 address disp = Assembler::locate_operand(ip, which);
46 address next_ip = Assembler::locate_next_instruction(ip);
47 *(int32_t*) disp = x - next_ip;
48 }
49 #else
50 *pd_address_in_code() = x + o;
51 #endif // AMD64
52 }
53
54
55 address Relocation::pd_call_destination(address orig_addr) {
56 intptr_t adj = 0;
57 if (orig_addr != NULL) {
58 // We just moved this call instruction from orig_addr to addr().
59 // This means its target will appear to have grown by addr() - orig_addr.
60 adj = -( addr() - orig_addr );
61 }
|