hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp
author never
Fri, 18 Mar 2011 15:52:42 -0700
changeset 8724 693c6b883b54
parent 7397 5b173b4ca846
child 8921 14bfe81f2a9d
permissions -rw-r--r--
7028374: race in fix_oop_relocations for scavengeable nmethods Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 1998, 2010, 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: 2571
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2571
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: 2571
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"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "asm/assembler.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "assembler_sparc.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "code/relocInfo.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "nativeInst_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "runtime/safepoint.hpp"
1
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
  NativeInstruction* ip = nativeInstruction_at(addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  jint inst = ip->long_at(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  assert(inst != NativeInstruction::illegal_instruction(), "no breakpoint");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  switch (Assembler::inv_op(inst)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  case Assembler::ldst_op:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    #ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
      switch (Assembler::inv_op3(inst)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
        case Assembler::lduw_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
        case Assembler::ldub_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
        case Assembler::lduh_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
        case Assembler::ldd_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
        case Assembler::ldsw_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
        case Assembler::ldsb_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
        case Assembler::ldsh_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
        case Assembler::ldx_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
        case Assembler::ldf_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
        case Assembler::lddf_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
        case Assembler::stw_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
        case Assembler::stb_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
        case Assembler::sth_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
        case Assembler::std_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
        case Assembler::stx_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
        case Assembler::stf_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
        case Assembler::stdf_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
        case Assembler::casa_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
        case Assembler::casxa_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
          break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
        default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
          ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
      goto do_non_sethi;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    #endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  case Assembler::arith_op:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    #ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
      switch (Assembler::inv_op3(inst)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
        case Assembler::or_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
        case Assembler::add_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
        case Assembler::jmpl_op3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
          break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
        default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
          ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    do_non_sethi:;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    #endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    guarantee(Assembler::inv_immed(inst), "must have a simm13 field");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    int simm13 = Assembler::low10((intptr_t)x) + o;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    inst &= ~Assembler::simm(    -1, 13);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    inst |=  Assembler::simm(simm13, 13);
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    86
    if (verify_only) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    87
      assert(ip->long_at(0) == inst, "instructions must match");
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    88
    } else {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    89
      ip->set_long_at(0, inst);
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
    90
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  case Assembler::branch_op:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    jint inst2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi");
590
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
    99
    if (format() != 0) {
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
   100
      assert(type() == relocInfo::oop_type, "only narrow oops case");
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
   101
      jint np = oopDesc::encode_heap_oop((oop)x);
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
   102
      inst &= ~Assembler::hi22(-1);
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
   103
      inst |=  Assembler::hi22((intptr_t)np);
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   104
      if (verify_only) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   105
        assert(ip->long_at(0) == inst, "instructions must match");
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   106
      } else {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   107
        ip->set_long_at(0, inst);
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   108
      }
590
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
   109
      inst2 = ip->long_at( NativeInstruction::nop_instruction_size );
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
   110
      guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op");
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   111
      if (verify_only) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   112
        assert(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np),
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   113
               "instructions must match");
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   114
      } else {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   115
        ip->set_long_at(NativeInstruction::nop_instruction_size, NativeInstruction::set_data32_simm13( inst2, (intptr_t)np));
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   116
      }
590
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
   117
      break;
2954744d7bba 6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents: 1
diff changeset
   118
    }
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   119
    if (verify_only) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   120
      ip->verify_data64_sethi( ip->addr_at(0), (intptr_t)x );
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   121
    } else {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   122
      ip->set_data64_sethi( ip->addr_at(0), (intptr_t)x );
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   123
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    inst &= ~Assembler::hi22(     -1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    inst |=  Assembler::hi22((intptr_t)x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    // (ignore offset; it doesn't play into the sethi)
8724
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   129
    if (verify_only) {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   130
      assert(ip->long_at(0) == inst, "instructions must match");
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   131
    } else {
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   132
      ip->set_long_at(0, inst);
693c6b883b54 7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents: 7397
diff changeset
   133
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    guarantee(false, "instruction must perform arithmetic or memory access");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
address Relocation::pd_call_destination(address orig_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  intptr_t adj = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  if (orig_addr != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    // We just moved this call instruction from orig_addr to addr().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    // This means its target will appear to have grown by addr() - orig_addr.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    adj = -( addr() - orig_addr );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  if (NativeCall::is_call_at(addr())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    NativeCall* call = nativeCall_at(addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    return call->destination() + adj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  if (NativeFarCall::is_call_at(addr())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    NativeFarCall* call = nativeFarCall_at(addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    return call->destination() + adj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  // Special case:  Patchable branch local to the code cache.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  // This will break badly if the code cache grows larger than a few Mb.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  NativeGeneralJump* br = nativeGeneralJump_at(addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  return br->jump_destination() + adj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
void Relocation::pd_set_call_destination(address x) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  if (NativeCall::is_call_at(addr())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    NativeCall* call = nativeCall_at(addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    call->set_destination(x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  if (NativeFarCall::is_call_at(addr())) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    NativeFarCall* call = nativeFarCall_at(addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    call->set_destination(x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  // Special case:  Patchable branch local to the code cache.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  // This will break badly if the code cache grows larger than a few Mb.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  NativeGeneralJump* br = nativeGeneralJump_at(addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  br->set_jump_destination(x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
address* Relocation::pd_address_in_code() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  // SPARC never embeds addresses in code, at present.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  //assert(type() == relocInfo::oop_type, "only oops are inlined at present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  return (address*)addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
address Relocation::pd_get_address_from_code() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  // SPARC never embeds addresses in code, at present.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  //assert(type() == relocInfo::oop_type, "only oops are inlined at present");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  return *(address*)addr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
int Relocation::pd_breakpoint_size() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  // minimum breakpoint size, in short words
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  return NativeIllegalInstruction::instruction_size / sizeof(short);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
void Relocation::pd_swap_in_breakpoint(address x, short* instrs, int instrlen) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  Untested("pd_swap_in_breakpoint");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  // %%% probably do not need a general instrlen; just use the trap size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  if (instrs != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    assert(instrlen * sizeof(short) == NativeIllegalInstruction::instruction_size, "enough instrlen in reloc. data");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    for (int i = 0; i < instrlen; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
      instrs[i] = ((short*)x)[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  NativeIllegalInstruction::insert(x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  Untested("pd_swap_out_breakpoint");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  assert(instrlen * sizeof(short) == sizeof(int), "enough buf");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  union { int l; short s[1]; } u;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  for (int i = 0; i < instrlen; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
    u.s[i] = instrs[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  NativeInstruction* ni = nativeInstruction_at(x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  ni->set_long_at(0, u.l);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
}
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   226
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   227
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
   228
}
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   229
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 670
diff changeset
   230
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
   231
}