hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
author hseigel
Thu, 15 Aug 2013 20:04:10 -0400
changeset 19319 0ad35be0733a
parent 18446 635eae7b22fc
child 31849 92ca49fa9fa7
permissions -rw-r--r--
8003424: Enable Class Data Sharing for CompressedOops 8016729: ObjectAlignmentInBytes=16 now forces the use of heap based compressed oops 8005933: The -Xshare:auto option is ignored for -server Summary: Move klass metaspace above the heap and support CDS with compressed klass ptrs. Reviewed-by: coleenp, kvn, mgerdin, tschatzl, stefank
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
19319
0ad35be0733a 8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents: 18446
diff changeset
     2
 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1066
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1066
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1066
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 13728
diff changeset
    26
#include "asm/macroAssembler.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "code/relocInfo.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "nativeInst_x86.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "runtime/safepoint.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    33
void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#ifdef AMD64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  x += o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  typedef Assembler::WhichOperand WhichOperand;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    37
  WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm, call32, narrow oop
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  assert(which == Assembler::disp32_operand ||
590
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
    39
         which == Assembler::narrow_oop_operand ||
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    40
         which == Assembler::imm_operand, "format unpacks ok");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
    41
  if (which == Assembler::imm_operand) {
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    42
    if (verify_only) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    43
      assert(*pd_address_in_code() == x, "instructions must match");
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    44
    } else {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    45
      *pd_address_in_code() = x;
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    46
    }
590
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
    47
  } else if (which == Assembler::narrow_oop_operand) {
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
    48
    address disp = Assembler::locate_operand(addr(), which);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
    49
    // both compressed oops and compressed classes look the same
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
    50
    if (Universe::heap()->is_in_reserved((oop)x)) {
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    51
    if (verify_only) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    52
      assert(*(uint32_t*) disp == oopDesc::encode_heap_oop((oop)x), "instructions must match");
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    53
    } else {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    54
      *(int32_t*) disp = oopDesc::encode_heap_oop((oop)x);
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    55
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  } else {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
    57
      if (verify_only) {
19319
0ad35be0733a 8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents: 18446
diff changeset
    58
        assert(*(uint32_t*) disp == Klass::encode_klass((Klass*)x), "instructions must match");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
    59
      } else {
19319
0ad35be0733a 8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents: 18446
diff changeset
    60
        *(int32_t*) disp = Klass::encode_klass((Klass*)x);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
    61
      }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
    62
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
    63
  } else {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    // Note:  Use runtime_call_type relocations for call32_operand.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    address ip = addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    address disp = Assembler::locate_operand(ip, which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    address next_ip = Assembler::locate_next_instruction(ip);
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    68
    if (verify_only) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    69
      assert(*(int32_t*) disp == (x - next_ip), "instructions must match");
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    70
    } else {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    71
      *(int32_t*) disp = x - next_ip;
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    72
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
#else
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    75
  if (verify_only) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    76
    assert(*pd_address_in_code() == (x + o), "instructions must match");
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    77
  } else {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    78
    *pd_address_in_code() = x + o;
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    79
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
#endif // AMD64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
address Relocation::pd_call_destination(address orig_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  intptr_t adj = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  if (orig_addr != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    // We just moved this call instruction from orig_addr to addr().
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    // This means its target will appear to have grown by addr() - orig_addr.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    adj = -( addr() - orig_addr );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  NativeInstruction* ni = nativeInstruction_at(addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  if (ni->is_call()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    return nativeCall_at(addr())->destination() + adj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  } else if (ni->is_jump()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    return nativeJump_at(addr())->jump_destination() + adj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  } else if (ni->is_cond_jump()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    return nativeGeneralJump_at(addr())->jump_destination() + adj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  } else if (ni->is_mov_literal64()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    return (address) ((NativeMovConstReg*)ni)->data();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
void Relocation::pd_set_call_destination(address x) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  NativeInstruction* ni = nativeInstruction_at(addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  if (ni->is_call()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    nativeCall_at(addr())->set_destination(x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  } else if (ni->is_jump()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    NativeJump* nj = nativeJump_at(addr());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   113
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   114
    // Unresolved jumps are recognized by a destination of -1
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   115
    // However 64bit can't actually produce such an address
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   116
    // and encodes a jump to self but jump_destination will
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   117
    // return a -1 as the signal. We must not relocate this
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   118
    // jmp or the ic code will not see it as unresolved.
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   119
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    if (nj->jump_destination() == (address) -1) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   121
      x = addr(); // jump to self
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    nj->set_jump_destination(x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  } else if (ni->is_cond_jump()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    // %%%% kludge this, for now, until we get a jump_destination method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    address old_dest = nativeGeneralJump_at(addr())->jump_destination();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    address disp = Assembler::locate_operand(addr(), Assembler::call32_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    *(jint*)disp += (x - old_dest);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  } else if (ni->is_mov_literal64()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    ((NativeMovConstReg*)ni)->set_data((intptr_t)x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
address* Relocation::pd_address_in_code() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  // All embedded Intel addresses are stored in 32-bit words.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // Since the addr points at the start of the instruction,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // we must parse the instruction a bit to find the embedded word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  assert(is_data(), "must be a DataRelocation");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  typedef Assembler::WhichOperand WhichOperand;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   143
  WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm/imm32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
#ifdef AMD64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  assert(which == Assembler::disp32_operand ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
         which == Assembler::call32_operand ||
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   147
         which == Assembler::imm_operand, "format unpacks ok");
16382
6d063103018a 8009584: [parfait] Null pointer deference in hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
morris
parents: 14626
diff changeset
   148
  // The "address" in the code is a displacement can't return it as
6d063103018a 8009584: [parfait] Null pointer deference in hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
morris
parents: 14626
diff changeset
   149
  // and address* since it is really a jint*
6d063103018a 8009584: [parfait] Null pointer deference in hotspot/src/cpu/x86/vm/relocInfo_x86.cpp
morris
parents: 14626
diff changeset
   150
  guarantee(which == Assembler::imm_operand, "must be immediate operand");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
#else
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   152
  assert(which == Assembler::disp32_operand || which == Assembler::imm_operand, "format unpacks ok");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
#endif // AMD64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  return (address*) Assembler::locate_operand(addr(), which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
address Relocation::pd_get_address_from_code() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
#ifdef AMD64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  // All embedded Intel addresses are stored in 32-bit words.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  // Since the addr points at the start of the instruction,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  // we must parse the instruction a bit to find the embedded word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  assert(is_data(), "must be a DataRelocation");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  typedef Assembler::WhichOperand WhichOperand;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   165
  WhichOperand which = (WhichOperand) format(); // that is, disp32 or imm/imm32
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  assert(which == Assembler::disp32_operand ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
         which == Assembler::call32_operand ||
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   168
         which == Assembler::imm_operand, "format unpacks ok");
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   169
  if (which != Assembler::imm_operand) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    address ip = addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    address disp = Assembler::locate_operand(ip, which);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    address next_ip = Assembler::locate_next_instruction(ip);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    address a = next_ip + *(int32_t*) disp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    return a;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
#endif // AMD64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  return *pd_address_in_code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   180
void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   181
#ifdef _LP64
8871
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   182
  if (!Assembler::is_polling_page_far()) {
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   183
    typedef Assembler::WhichOperand WhichOperand;
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   184
    WhichOperand which = (WhichOperand) format();
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   185
    // This format is imm but it is really disp32
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   186
    which = Assembler::disp32_operand;
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   187
    address orig_addr = old_addr_for(addr(), src, dest);
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   188
    NativeInstruction* oni = nativeInstruction_at(orig_addr);
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   189
    int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   190
    // This poll_addr is incorrect by the size of the instruction it is irrelevant
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   191
    intptr_t poll_addr = (intptr_t)oni + *orig_disp;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   192
8871
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   193
    NativeInstruction* ni = nativeInstruction_at(addr());
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   194
    intptr_t new_disp = poll_addr - (intptr_t) ni;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   195
8871
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   196
    int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   197
    * disp = (int32_t)new_disp;
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   198
  }
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   199
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   200
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   201
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   202
void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   203
#ifdef _LP64
8871
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   204
  if (!Assembler::is_polling_page_far()) {
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   205
    typedef Assembler::WhichOperand WhichOperand;
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   206
    WhichOperand which = (WhichOperand) format();
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   207
    // This format is imm but it is really disp32
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   208
    which = Assembler::disp32_operand;
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   209
    address orig_addr = old_addr_for(addr(), src, dest);
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   210
    NativeInstruction* oni = nativeInstruction_at(orig_addr);
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   211
    int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   212
    // This poll_addr is incorrect by the size of the instruction it is irrelevant
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   213
    intptr_t poll_addr = (intptr_t)oni + *orig_disp;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   214
8871
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   215
    NativeInstruction* ni = nativeInstruction_at(addr());
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   216
    intptr_t new_disp = poll_addr - (intptr_t) ni;
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   217
8871
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   218
    int32_t* disp = (int32_t*) Assembler::locate_operand(addr(), which);
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   219
    * disp = (int32_t)new_disp;
5c3b26c4119e 6964776: c2 should ensure the polling page is reachable on 64 bit
iveresov
parents: 8724
diff changeset
   220
  }
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   221
#endif // _LP64
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   222
}
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
   223
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
   224
void metadata_Relocation::pd_fix_value(address x) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8871
diff changeset
   225
}