src/cpu/sparc/vm/relocInfo_sparc.cpp

Tue, 24 Dec 2013 11:48:39 -0800

author
mikael
date
Tue, 24 Dec 2013 11:48:39 -0800
changeset 6198
55fb97c4c58d
parent 5528
740e263c80c6
child 6876
710a3c8b516e
child 8647
0b611970fa8b
permissions
-rw-r--r--

8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
Summary: Copyright year updated for files modified during 2013
Reviewed-by: twisti, iveresov

duke@435 1 /*
hseigel@5528 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
twisti@4323 26 #include "asm/assembler.hpp"
stefank@2314 27 #include "code/relocInfo.hpp"
stefank@2314 28 #include "nativeInst_sparc.hpp"
stefank@2314 29 #include "oops/oop.inline.hpp"
stefank@2314 30 #include "runtime/safepoint.hpp"
duke@435 31
never@2657 32 void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
duke@435 33 NativeInstruction* ip = nativeInstruction_at(addr());
duke@435 34 jint inst = ip->long_at(0);
duke@435 35 assert(inst != NativeInstruction::illegal_instruction(), "no breakpoint");
duke@435 36 switch (Assembler::inv_op(inst)) {
duke@435 37
duke@435 38 case Assembler::ldst_op:
duke@435 39 #ifdef ASSERT
duke@435 40 switch (Assembler::inv_op3(inst)) {
duke@435 41 case Assembler::lduw_op3:
duke@435 42 case Assembler::ldub_op3:
duke@435 43 case Assembler::lduh_op3:
duke@435 44 case Assembler::ldd_op3:
duke@435 45 case Assembler::ldsw_op3:
duke@435 46 case Assembler::ldsb_op3:
duke@435 47 case Assembler::ldsh_op3:
duke@435 48 case Assembler::ldx_op3:
duke@435 49 case Assembler::ldf_op3:
duke@435 50 case Assembler::lddf_op3:
duke@435 51 case Assembler::stw_op3:
duke@435 52 case Assembler::stb_op3:
duke@435 53 case Assembler::sth_op3:
duke@435 54 case Assembler::std_op3:
duke@435 55 case Assembler::stx_op3:
duke@435 56 case Assembler::stf_op3:
duke@435 57 case Assembler::stdf_op3:
duke@435 58 case Assembler::casa_op3:
duke@435 59 case Assembler::casxa_op3:
duke@435 60 break;
duke@435 61 default:
duke@435 62 ShouldNotReachHere();
duke@435 63 }
duke@435 64 goto do_non_sethi;
duke@435 65 #endif
duke@435 66
duke@435 67 case Assembler::arith_op:
duke@435 68 #ifdef ASSERT
duke@435 69 switch (Assembler::inv_op3(inst)) {
duke@435 70 case Assembler::or_op3:
duke@435 71 case Assembler::add_op3:
duke@435 72 case Assembler::jmpl_op3:
duke@435 73 break;
duke@435 74 default:
duke@435 75 ShouldNotReachHere();
duke@435 76 }
duke@435 77 do_non_sethi:;
duke@435 78 #endif
duke@435 79 {
duke@435 80 guarantee(Assembler::inv_immed(inst), "must have a simm13 field");
duke@435 81 int simm13 = Assembler::low10((intptr_t)x) + o;
duke@435 82 guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13");
duke@435 83 inst &= ~Assembler::simm( -1, 13);
duke@435 84 inst |= Assembler::simm(simm13, 13);
never@2657 85 if (verify_only) {
never@2657 86 assert(ip->long_at(0) == inst, "instructions must match");
never@2657 87 } else {
never@2657 88 ip->set_long_at(0, inst);
never@2657 89 }
duke@435 90 }
duke@435 91 break;
duke@435 92
duke@435 93 case Assembler::branch_op:
duke@435 94 {
duke@435 95 #ifdef _LP64
duke@435 96 jint inst2;
duke@435 97 guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi");
kvn@599 98 if (format() != 0) {
roland@4159 99 assert(type() == relocInfo::oop_type || type() == relocInfo::metadata_type, "only narrow oops or klasses case");
hseigel@5528 100 jint np = type() == relocInfo::oop_type ? oopDesc::encode_heap_oop((oop)x) : Klass::encode_klass((Klass*)x);
kvn@599 101 inst &= ~Assembler::hi22(-1);
kvn@599 102 inst |= Assembler::hi22((intptr_t)np);
never@2657 103 if (verify_only) {
never@2657 104 assert(ip->long_at(0) == inst, "instructions must match");
never@2657 105 } else {
never@2657 106 ip->set_long_at(0, inst);
never@2657 107 }
kvn@599 108 inst2 = ip->long_at( NativeInstruction::nop_instruction_size );
kvn@599 109 guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op");
never@2657 110 if (verify_only) {
never@2657 111 assert(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np),
never@2657 112 "instructions must match");
never@2657 113 } else {
never@2657 114 ip->set_long_at(NativeInstruction::nop_instruction_size, NativeInstruction::set_data32_simm13( inst2, (intptr_t)np));
never@2657 115 }
kvn@599 116 break;
kvn@599 117 }
never@2657 118 if (verify_only) {
never@2657 119 ip->verify_data64_sethi( ip->addr_at(0), (intptr_t)x );
never@2657 120 } else {
never@2657 121 ip->set_data64_sethi( ip->addr_at(0), (intptr_t)x );
never@2657 122 }
duke@435 123 #else
duke@435 124 guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi");
duke@435 125 inst &= ~Assembler::hi22( -1);
duke@435 126 inst |= Assembler::hi22((intptr_t)x);
duke@435 127 // (ignore offset; it doesn't play into the sethi)
never@2657 128 if (verify_only) {
never@2657 129 assert(ip->long_at(0) == inst, "instructions must match");
never@2657 130 } else {
never@2657 131 ip->set_long_at(0, inst);
never@2657 132 }
duke@435 133 #endif
duke@435 134 }
duke@435 135 break;
duke@435 136
duke@435 137 default:
duke@435 138 guarantee(false, "instruction must perform arithmetic or memory access");
duke@435 139 }
duke@435 140 }
duke@435 141
duke@435 142
duke@435 143 address Relocation::pd_call_destination(address orig_addr) {
duke@435 144 intptr_t adj = 0;
duke@435 145 if (orig_addr != NULL) {
duke@435 146 // We just moved this call instruction from orig_addr to addr().
duke@435 147 // This means its target will appear to have grown by addr() - orig_addr.
duke@435 148 adj = -( addr() - orig_addr );
duke@435 149 }
duke@435 150 if (NativeCall::is_call_at(addr())) {
duke@435 151 NativeCall* call = nativeCall_at(addr());
duke@435 152 return call->destination() + adj;
duke@435 153 }
duke@435 154 if (NativeFarCall::is_call_at(addr())) {
duke@435 155 NativeFarCall* call = nativeFarCall_at(addr());
duke@435 156 return call->destination() + adj;
duke@435 157 }
duke@435 158 // Special case: Patchable branch local to the code cache.
duke@435 159 // This will break badly if the code cache grows larger than a few Mb.
duke@435 160 NativeGeneralJump* br = nativeGeneralJump_at(addr());
duke@435 161 return br->jump_destination() + adj;
duke@435 162 }
duke@435 163
duke@435 164
duke@435 165 void Relocation::pd_set_call_destination(address x) {
duke@435 166 if (NativeCall::is_call_at(addr())) {
duke@435 167 NativeCall* call = nativeCall_at(addr());
duke@435 168 call->set_destination(x);
duke@435 169 return;
duke@435 170 }
duke@435 171 if (NativeFarCall::is_call_at(addr())) {
duke@435 172 NativeFarCall* call = nativeFarCall_at(addr());
duke@435 173 call->set_destination(x);
duke@435 174 return;
duke@435 175 }
duke@435 176 // Special case: Patchable branch local to the code cache.
duke@435 177 // This will break badly if the code cache grows larger than a few Mb.
duke@435 178 NativeGeneralJump* br = nativeGeneralJump_at(addr());
duke@435 179 br->set_jump_destination(x);
duke@435 180 }
duke@435 181
duke@435 182
duke@435 183 address* Relocation::pd_address_in_code() {
duke@435 184 // SPARC never embeds addresses in code, at present.
duke@435 185 //assert(type() == relocInfo::oop_type, "only oops are inlined at present");
duke@435 186 return (address*)addr();
duke@435 187 }
duke@435 188
duke@435 189
duke@435 190 address Relocation::pd_get_address_from_code() {
duke@435 191 // SPARC never embeds addresses in code, at present.
duke@435 192 //assert(type() == relocInfo::oop_type, "only oops are inlined at present");
duke@435 193 return *(address*)addr();
duke@435 194 }
duke@435 195
never@739 196 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
never@739 197 }
never@739 198
never@739 199 void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
never@739 200 }
coleenp@4037 201
coleenp@4037 202 void metadata_Relocation::pd_fix_value(address x) {
coleenp@4037 203 }

mercurial