Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/relocInfo_x86.cpp @ 2404:b40d4fa697bf
6964776: c2 should ensure the polling page is reachable on 64 bit
Summary: Materialize the pointer to the polling page in a register instead of using rip-relative addressing when the distance from the code cache is larger than disp32.
Reviewed-by: never, kvn
author | iveresov |
---|---|
date | Sun, 27 Mar 2011 13:17:37 -0700 |
parents | d673ef06fe96 |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
2403:1927db75dd85 | 2404:b40d4fa697bf |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
196 *(short*)ni->addr_at(0) = instrs[0]; | 196 *(short*)ni->addr_at(0) = instrs[0]; |
197 } | 197 } |
198 | 198 |
199 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { | 199 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { |
200 #ifdef _LP64 | 200 #ifdef _LP64 |
201 typedef Assembler::WhichOperand WhichOperand; | 201 if (!Assembler::is_polling_page_far()) { |
202 WhichOperand which = (WhichOperand) format(); | 202 typedef Assembler::WhichOperand WhichOperand; |
203 // This format is imm but it is really disp32 | 203 WhichOperand which = (WhichOperand) format(); |
204 which = Assembler::disp32_operand; | 204 // This format is imm but it is really disp32 |
205 address orig_addr = old_addr_for(addr(), src, dest); | 205 which = Assembler::disp32_operand; |
206 NativeInstruction* oni = nativeInstruction_at(orig_addr); | 206 address orig_addr = old_addr_for(addr(), src, dest); |
207 int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which); | 207 NativeInstruction* oni = nativeInstruction_at(orig_addr); |
208 // This poll_addr is incorrect by the size of the instruction it is irrelevant | 208 int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which); |
209 intptr_t poll_addr = (intptr_t)oni + *orig_disp; | 209 // This poll_addr is incorrect by the size of the instruction it is irrelevant |
210 | 210 intptr_t poll_addr = (intptr_t)oni + *orig_disp; |
211 NativeInstruction* ni = nativeInstruction_at(addr()); | 211 |
212 intptr_t new_disp = poll_addr - (intptr_t) ni; | 212 NativeInstruction* ni = nativeInstruction_at(addr()); |
213 | 213 intptr_t new_disp = poll_addr - (intptr_t) ni; |
214 int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which); | 214 |
215 * disp = (int32_t)new_disp; | 215 int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which); |
216 | 216 * disp = (int32_t)new_disp; |
217 } | |
217 #endif // _LP64 | 218 #endif // _LP64 |
218 } | 219 } |
219 | 220 |
220 void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { | 221 void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { |
221 #ifdef _LP64 | 222 #ifdef _LP64 |
222 typedef Assembler::WhichOperand WhichOperand; | 223 if (!Assembler::is_polling_page_far()) { |
223 WhichOperand which = (WhichOperand) format(); | 224 typedef Assembler::WhichOperand WhichOperand; |
224 // This format is imm but it is really disp32 | 225 WhichOperand which = (WhichOperand) format(); |
225 which = Assembler::disp32_operand; | 226 // This format is imm but it is really disp32 |
226 address orig_addr = old_addr_for(addr(), src, dest); | 227 which = Assembler::disp32_operand; |
227 NativeInstruction* oni = nativeInstruction_at(orig_addr); | 228 address orig_addr = old_addr_for(addr(), src, dest); |
228 int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which); | 229 NativeInstruction* oni = nativeInstruction_at(orig_addr); |
229 // This poll_addr is incorrect by the size of the instruction it is irrelevant | 230 int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which); |
230 intptr_t poll_addr = (intptr_t)oni + *orig_disp; | 231 // This poll_addr is incorrect by the size of the instruction it is irrelevant |
231 | 232 intptr_t poll_addr = (intptr_t)oni + *orig_disp; |
232 NativeInstruction* ni = nativeInstruction_at(addr()); | 233 |
233 intptr_t new_disp = poll_addr - (intptr_t) ni; | 234 NativeInstruction* ni = nativeInstruction_at(addr()); |
234 | 235 intptr_t new_disp = poll_addr - (intptr_t) ni; |
235 int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which); | 236 |
236 * disp = (int32_t)new_disp; | 237 int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which); |
238 * disp = (int32_t)new_disp; | |
239 } | |
237 #endif // _LP64 | 240 #endif // _LP64 |
238 } | 241 } |