author | prr |
Wed, 15 Apr 2015 14:28:43 -0700 | |
changeset 30465 | a77083748efc |
parent 19319 | 0ad35be0733a |
child 31849 | 92ca49fa9fa7 |
permissions | -rw-r--r-- |
1 | 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 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
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 |
* |
|
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 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
14631
526804361522
8003250: SPARC: move MacroAssembler into separate file
twisti
parents:
13969
diff
changeset
|
26 |
#include "asm/assembler.hpp" |
7397 | 27 |
#include "code/relocInfo.hpp" |
28 |
#include "nativeInst_sparc.hpp" |
|
29 |
#include "oops/oop.inline.hpp" |
|
30 |
#include "runtime/safepoint.hpp" |
|
1 | 31 |
|
8724
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
32 |
void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) { |
1 | 33 |
NativeInstruction* ip = nativeInstruction_at(addr()); |
34 |
jint inst = ip->long_at(0); |
|
35 |
assert(inst != NativeInstruction::illegal_instruction(), "no breakpoint"); |
|
36 |
switch (Assembler::inv_op(inst)) { |
|
37 |
||
38 |
case Assembler::ldst_op: |
|
39 |
#ifdef ASSERT |
|
40 |
switch (Assembler::inv_op3(inst)) { |
|
41 |
case Assembler::lduw_op3: |
|
42 |
case Assembler::ldub_op3: |
|
43 |
case Assembler::lduh_op3: |
|
44 |
case Assembler::ldd_op3: |
|
45 |
case Assembler::ldsw_op3: |
|
46 |
case Assembler::ldsb_op3: |
|
47 |
case Assembler::ldsh_op3: |
|
48 |
case Assembler::ldx_op3: |
|
49 |
case Assembler::ldf_op3: |
|
50 |
case Assembler::lddf_op3: |
|
51 |
case Assembler::stw_op3: |
|
52 |
case Assembler::stb_op3: |
|
53 |
case Assembler::sth_op3: |
|
54 |
case Assembler::std_op3: |
|
55 |
case Assembler::stx_op3: |
|
56 |
case Assembler::stf_op3: |
|
57 |
case Assembler::stdf_op3: |
|
58 |
case Assembler::casa_op3: |
|
59 |
case Assembler::casxa_op3: |
|
60 |
break; |
|
61 |
default: |
|
62 |
ShouldNotReachHere(); |
|
63 |
} |
|
64 |
goto do_non_sethi; |
|
65 |
#endif |
|
66 |
||
67 |
case Assembler::arith_op: |
|
68 |
#ifdef ASSERT |
|
69 |
switch (Assembler::inv_op3(inst)) { |
|
70 |
case Assembler::or_op3: |
|
71 |
case Assembler::add_op3: |
|
72 |
case Assembler::jmpl_op3: |
|
73 |
break; |
|
74 |
default: |
|
75 |
ShouldNotReachHere(); |
|
76 |
} |
|
77 |
do_non_sethi:; |
|
78 |
#endif |
|
79 |
{ |
|
80 |
guarantee(Assembler::inv_immed(inst), "must have a simm13 field"); |
|
81 |
int simm13 = Assembler::low10((intptr_t)x) + o; |
|
82 |
guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13"); |
|
83 |
inst &= ~Assembler::simm( -1, 13); |
|
84 |
inst |= Assembler::simm(simm13, 13); |
|
8724
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
85 |
if (verify_only) { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
86 |
assert(ip->long_at(0) == inst, "instructions must match"); |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
87 |
} else { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
88 |
ip->set_long_at(0, inst); |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
89 |
} |
1 | 90 |
} |
91 |
break; |
|
92 |
||
93 |
case Assembler::branch_op: |
|
94 |
{ |
|
95 |
#ifdef _LP64 |
|
96 |
jint inst2; |
|
97 |
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
|
98 |
if (format() != 0) { |
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13728
diff
changeset
|
99 |
assert(type() == relocInfo::oop_type || type() == relocInfo::metadata_type, "only narrow oops or klasses case"); |
19319
0ad35be0733a
8003424: Enable Class Data Sharing for CompressedOops
hseigel
parents:
18446
diff
changeset
|
100 |
jint np = type() == relocInfo::oop_type ? oopDesc::encode_heap_oop((oop)x) : Klass::encode_klass((Klass*)x); |
590
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
1
diff
changeset
|
101 |
inst &= ~Assembler::hi22(-1); |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
1
diff
changeset
|
102 |
inst |= Assembler::hi22((intptr_t)np); |
8724
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
103 |
if (verify_only) { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
104 |
assert(ip->long_at(0) == inst, "instructions must match"); |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
105 |
} else { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
106 |
ip->set_long_at(0, inst); |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
107 |
} |
590
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
1
diff
changeset
|
108 |
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
|
109 |
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
|
110 |
if (verify_only) { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
111 |
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
|
112 |
"instructions must match"); |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
113 |
} else { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
114 |
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
|
115 |
} |
590
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
1
diff
changeset
|
116 |
break; |
2954744d7bba
6703890: Compressed Oops: add LoadNKlass node to generate narrow oops (32-bits) compare instructions
kvn
parents:
1
diff
changeset
|
117 |
} |
8724
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
118 |
if (verify_only) { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
119 |
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
|
120 |
} else { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
121 |
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
|
122 |
} |
1 | 123 |
#else |
124 |
guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi"); |
|
125 |
inst &= ~Assembler::hi22( -1); |
|
126 |
inst |= Assembler::hi22((intptr_t)x); |
|
127 |
// (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
|
128 |
if (verify_only) { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
129 |
assert(ip->long_at(0) == inst, "instructions must match"); |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
130 |
} else { |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
131 |
ip->set_long_at(0, inst); |
693c6b883b54
7028374: race in fix_oop_relocations for scavengeable nmethods
never
parents:
7397
diff
changeset
|
132 |
} |
1 | 133 |
#endif |
134 |
} |
|
135 |
break; |
|
136 |
||
137 |
default: |
|
138 |
guarantee(false, "instruction must perform arithmetic or memory access"); |
|
139 |
} |
|
140 |
} |
|
141 |
||
142 |
||
143 |
address Relocation::pd_call_destination(address orig_addr) { |
|
144 |
intptr_t adj = 0; |
|
145 |
if (orig_addr != NULL) { |
|
146 |
// We just moved this call instruction from orig_addr to addr(). |
|
147 |
// This means its target will appear to have grown by addr() - orig_addr. |
|
148 |
adj = -( addr() - orig_addr ); |
|
149 |
} |
|
150 |
if (NativeCall::is_call_at(addr())) { |
|
151 |
NativeCall* call = nativeCall_at(addr()); |
|
152 |
return call->destination() + adj; |
|
153 |
} |
|
154 |
if (NativeFarCall::is_call_at(addr())) { |
|
155 |
NativeFarCall* call = nativeFarCall_at(addr()); |
|
156 |
return call->destination() + adj; |
|
157 |
} |
|
158 |
// Special case: Patchable branch local to the code cache. |
|
159 |
// This will break badly if the code cache grows larger than a few Mb. |
|
160 |
NativeGeneralJump* br = nativeGeneralJump_at(addr()); |
|
161 |
return br->jump_destination() + adj; |
|
162 |
} |
|
163 |
||
164 |
||
165 |
void Relocation::pd_set_call_destination(address x) { |
|
166 |
if (NativeCall::is_call_at(addr())) { |
|
167 |
NativeCall* call = nativeCall_at(addr()); |
|
168 |
call->set_destination(x); |
|
169 |
return; |
|
170 |
} |
|
171 |
if (NativeFarCall::is_call_at(addr())) { |
|
172 |
NativeFarCall* call = nativeFarCall_at(addr()); |
|
173 |
call->set_destination(x); |
|
174 |
return; |
|
175 |
} |
|
176 |
// Special case: Patchable branch local to the code cache. |
|
177 |
// This will break badly if the code cache grows larger than a few Mb. |
|
178 |
NativeGeneralJump* br = nativeGeneralJump_at(addr()); |
|
179 |
br->set_jump_destination(x); |
|
180 |
} |
|
181 |
||
182 |
||
183 |
address* Relocation::pd_address_in_code() { |
|
184 |
// SPARC never embeds addresses in code, at present. |
|
185 |
//assert(type() == relocInfo::oop_type, "only oops are inlined at present"); |
|
186 |
return (address*)addr(); |
|
187 |
} |
|
188 |
||
189 |
||
190 |
address Relocation::pd_get_address_from_code() { |
|
191 |
// SPARC never embeds addresses in code, at present. |
|
192 |
//assert(type() == relocInfo::oop_type, "only oops are inlined at present"); |
|
193 |
return *(address*)addr(); |
|
194 |
} |
|
195 |
||
1066 | 196 |
void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { |
197 |
} |
|
198 |
||
199 |
void poll_return_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { |
|
200 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
201 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
202 |
void metadata_Relocation::pd_fix_value(address x) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
203 |
} |