annotate src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp @ 3249:e1162778c1c8

7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error Summary: A referent object that is only weakly reachable at the start of concurrent marking but is re-attached to the strongly reachable object graph during marking may not be marked as live. This can cause the reference object to be processed prematurely and leave dangling pointers to the referent object. Implement a read barrier for the java.lang.ref.Reference::referent field by intrinsifying the Reference.get() method, and intercepting accesses though JNI, reflection, and Unsafe, so that when a non-null referent object is read it is also logged in an SATB buffer. Reviewed-by: kvn, iveresov, never, tonyp, dholmes
author johnc
date Thu, 07 Apr 2011 09:53:20 -0700
parents 32f7097f9d8f
children 59766fd005ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
2168
e4fee0bdaa85 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 2002
diff changeset
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1295
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1295
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1295
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
26 #include "c1/c1_CodeStubs.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
27 #include "c1/c1_FrameMap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
28 #include "c1/c1_LIRAssembler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
29 #include "c1/c1_MacroAssembler.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
30 #include "c1/c1_Runtime1.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
31 #include "nativeInst_sparc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
32 #include "runtime/sharedRuntime.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
33 #include "vmreg_sparc.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
34 #ifndef SERIALGC
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
35 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1848
diff changeset
36 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 #define __ ce->masm()->
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index,
a61af66fc99e Initial load
duke
parents:
diff changeset
41 bool throw_index_out_of_bounds_exception)
a61af66fc99e Initial load
duke
parents:
diff changeset
42 : _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception)
a61af66fc99e Initial load
duke
parents:
diff changeset
43 , _index(index)
a61af66fc99e Initial load
duke
parents:
diff changeset
44 {
1819
f02a8bbe6ed4 6986046: C1 valuestack cleanup
roland
parents: 1783
diff changeset
45 assert(info != NULL, "must have info");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
46 _info = new CodeEmitInfo(info);
a61af66fc99e Initial load
duke
parents:
diff changeset
47 }
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 void RangeCheckStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 if (_index->is_register()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 __ mov(_index->as_register(), G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
56 __ set(_index->as_jint(), G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
57 }
a61af66fc99e Initial load
duke
parents:
diff changeset
58 if (_throw_index_out_of_bounds_exception) {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 __ call(Runtime1::entry_for(Runtime1::throw_index_exception_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
60 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 __ call(Runtime1::entry_for(Runtime1::throw_range_check_failed_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
62 }
a61af66fc99e Initial load
duke
parents:
diff changeset
63 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
64 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
65 ce->verify_oop_map(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
66 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
67 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
68 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
73 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 __ set(_bci, G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 __ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type);
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1552
diff changeset
76 __ delayed()->mov_or_nop(_method->as_register(), G5);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
77 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 ce->verify_oop_map(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 __ br(Assembler::always, true, Assembler::pt, _continuation);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 void DivByZeroStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 if (_offset != -1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 __ call(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
91 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
92 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
93 ce->verify_oop_map(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
94 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
95 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
96 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
a61af66fc99e Initial load
duke
parents:
diff changeset
102 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
103 __ call(Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id),
a61af66fc99e Initial load
duke
parents:
diff changeset
104 relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
105 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
106 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 ce->verify_oop_map(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
108 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
109 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
110 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // Implementation of SimpleExceptionStub
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // Note: %g1 and %g3 are already in use
a61af66fc99e Initial load
duke
parents:
diff changeset
116 void SimpleExceptionStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
117 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
118 __ call(Runtime1::entry_for(_stub), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 if (_obj->is_valid()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
121 __ delayed()->mov(_obj->as_register(), G4); // _obj contains the optional argument to the stub
a61af66fc99e Initial load
duke
parents:
diff changeset
122 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 __ delayed()->mov(G0, G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
126 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
127 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
128 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
129 }
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // Implementation of NewInstanceStub
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 _result = result;
a61af66fc99e Initial load
duke
parents:
diff changeset
136 _klass = klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
137 _klass_reg = klass_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
138 _info = new CodeEmitInfo(info);
a61af66fc99e Initial load
duke
parents:
diff changeset
139 assert(stub_id == Runtime1::new_instance_id ||
a61af66fc99e Initial load
duke
parents:
diff changeset
140 stub_id == Runtime1::fast_new_instance_id ||
a61af66fc99e Initial load
duke
parents:
diff changeset
141 stub_id == Runtime1::fast_new_instance_init_check_id,
a61af66fc99e Initial load
duke
parents:
diff changeset
142 "need new_instance id");
a61af66fc99e Initial load
duke
parents:
diff changeset
143 _stub_id = stub_id;
a61af66fc99e Initial load
duke
parents:
diff changeset
144 }
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 void NewInstanceStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
148 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
149 __ call(Runtime1::entry_for(_stub_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
150 __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
a61af66fc99e Initial load
duke
parents:
diff changeset
151 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
152 ce->verify_oop_map(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
153 __ br(Assembler::always, false, Assembler::pt, _continuation);
a61af66fc99e Initial load
duke
parents:
diff changeset
154 __ delayed()->mov_or_nop(O0, _result->as_register());
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157
a61af66fc99e Initial load
duke
parents:
diff changeset
158 // Implementation of NewTypeArrayStub
a61af66fc99e Initial load
duke
parents:
diff changeset
159 NewTypeArrayStub::NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
a61af66fc99e Initial load
duke
parents:
diff changeset
160 _klass_reg = klass_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
161 _length = length;
a61af66fc99e Initial load
duke
parents:
diff changeset
162 _result = result;
a61af66fc99e Initial load
duke
parents:
diff changeset
163 _info = new CodeEmitInfo(info);
a61af66fc99e Initial load
duke
parents:
diff changeset
164 }
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167 void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 __ mov(_length->as_register(), G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
171 __ call(Runtime1::entry_for(Runtime1::new_type_array_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
172 __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
a61af66fc99e Initial load
duke
parents:
diff changeset
173 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
174 ce->verify_oop_map(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
175 __ br(Assembler::always, false, Assembler::pt, _continuation);
a61af66fc99e Initial load
duke
parents:
diff changeset
176 __ delayed()->mov_or_nop(O0, _result->as_register());
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // Implementation of NewObjectArrayStub
a61af66fc99e Initial load
duke
parents:
diff changeset
181
a61af66fc99e Initial load
duke
parents:
diff changeset
182 NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
a61af66fc99e Initial load
duke
parents:
diff changeset
183 _klass_reg = klass_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
184 _length = length;
a61af66fc99e Initial load
duke
parents:
diff changeset
185 _result = result;
a61af66fc99e Initial load
duke
parents:
diff changeset
186 _info = new CodeEmitInfo(info);
a61af66fc99e Initial load
duke
parents:
diff changeset
187 }
a61af66fc99e Initial load
duke
parents:
diff changeset
188
a61af66fc99e Initial load
duke
parents:
diff changeset
189
a61af66fc99e Initial load
duke
parents:
diff changeset
190 void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
191 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 __ mov(_length->as_register(), G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
194 __ call(Runtime1::entry_for(Runtime1::new_object_array_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
195 __ delayed()->mov_or_nop(_klass_reg->as_register(), G5);
a61af66fc99e Initial load
duke
parents:
diff changeset
196 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
197 ce->verify_oop_map(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
198 __ br(Assembler::always, false, Assembler::pt, _continuation);
a61af66fc99e Initial load
duke
parents:
diff changeset
199 __ delayed()->mov_or_nop(O0, _result->as_register());
a61af66fc99e Initial load
duke
parents:
diff changeset
200 }
a61af66fc99e Initial load
duke
parents:
diff changeset
201
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203 // Implementation of MonitorAccessStubs
a61af66fc99e Initial load
duke
parents:
diff changeset
204 MonitorEnterStub::MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info)
a61af66fc99e Initial load
duke
parents:
diff changeset
205 : MonitorAccessStub(obj_reg, lock_reg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
206 _info = new CodeEmitInfo(info);
a61af66fc99e Initial load
duke
parents:
diff changeset
207 }
a61af66fc99e Initial load
duke
parents:
diff changeset
208
a61af66fc99e Initial load
duke
parents:
diff changeset
209
a61af66fc99e Initial load
duke
parents:
diff changeset
210 void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
211 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
212 __ mov(_obj_reg->as_register(), G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
213 if (ce->compilation()->has_fpu_code()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
214 __ call(Runtime1::entry_for(Runtime1::monitorenter_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
215 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
216 __ call(Runtime1::entry_for(Runtime1::monitorenter_nofpu_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
217 }
a61af66fc99e Initial load
duke
parents:
diff changeset
218 __ delayed()->mov_or_nop(_lock_reg->as_register(), G5);
a61af66fc99e Initial load
duke
parents:
diff changeset
219 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 ce->verify_oop_map(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
221 __ br(Assembler::always, true, Assembler::pt, _continuation);
a61af66fc99e Initial load
duke
parents:
diff changeset
222 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
223 }
a61af66fc99e Initial load
duke
parents:
diff changeset
224
a61af66fc99e Initial load
duke
parents:
diff changeset
225
a61af66fc99e Initial load
duke
parents:
diff changeset
226 void MonitorExitStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
227 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
228 if (_compute_lock) {
a61af66fc99e Initial load
duke
parents:
diff changeset
229 ce->monitor_address(_monitor_ix, _lock_reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
230 }
a61af66fc99e Initial load
duke
parents:
diff changeset
231 if (ce->compilation()->has_fpu_code()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
232 __ call(Runtime1::entry_for(Runtime1::monitorexit_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
233 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
234 __ call(Runtime1::entry_for(Runtime1::monitorexit_nofpu_id), relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
235 }
a61af66fc99e Initial load
duke
parents:
diff changeset
236
a61af66fc99e Initial load
duke
parents:
diff changeset
237 __ delayed()->mov_or_nop(_lock_reg->as_register(), G4);
a61af66fc99e Initial load
duke
parents:
diff changeset
238 __ br(Assembler::always, true, Assembler::pt, _continuation);
a61af66fc99e Initial load
duke
parents:
diff changeset
239 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
240 }
a61af66fc99e Initial load
duke
parents:
diff changeset
241
a61af66fc99e Initial load
duke
parents:
diff changeset
242 // Implementation of patching:
a61af66fc99e Initial load
duke
parents:
diff changeset
243 // - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes)
a61af66fc99e Initial load
duke
parents:
diff changeset
244 // - Replace original code with a call to the stub
a61af66fc99e Initial load
duke
parents:
diff changeset
245 // At Runtime:
a61af66fc99e Initial load
duke
parents:
diff changeset
246 // - call to stub, jump to runtime
a61af66fc99e Initial load
duke
parents:
diff changeset
247 // - in runtime: preserve all registers (especially objects, i.e., source and destination object)
a61af66fc99e Initial load
duke
parents:
diff changeset
248 // - in runtime: after initializing class, restore original code, reexecute instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
249
a61af66fc99e Initial load
duke
parents:
diff changeset
250 int PatchingStub::_patch_info_offset = -NativeGeneralJump::instruction_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
251
a61af66fc99e Initial load
duke
parents:
diff changeset
252 void PatchingStub::align_patch_site(MacroAssembler* ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
253 // patch sites on sparc are always properly aligned.
a61af66fc99e Initial load
duke
parents:
diff changeset
254 }
a61af66fc99e Initial load
duke
parents:
diff changeset
255
a61af66fc99e Initial load
duke
parents:
diff changeset
256 void PatchingStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
257 // copy original code here
a61af66fc99e Initial load
duke
parents:
diff changeset
258 assert(NativeCall::instruction_size <= _bytes_to_copy && _bytes_to_copy <= 0xFF,
a61af66fc99e Initial load
duke
parents:
diff changeset
259 "not enough room for call");
a61af66fc99e Initial load
duke
parents:
diff changeset
260 assert((_bytes_to_copy & 0x3) == 0, "must copy a multiple of four bytes");
a61af66fc99e Initial load
duke
parents:
diff changeset
261
a61af66fc99e Initial load
duke
parents:
diff changeset
262 Label call_patch;
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264 int being_initialized_entry = __ offset();
a61af66fc99e Initial load
duke
parents:
diff changeset
265
a61af66fc99e Initial load
duke
parents:
diff changeset
266 if (_id == load_klass_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
267 // produce a copy of the load klass instruction for use by the being initialized case
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 342
diff changeset
268 #ifdef ASSERT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
269 address start = __ pc();
727
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 342
diff changeset
270 #endif
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 342
diff changeset
271 AddressLiteral addrlit(NULL, oop_Relocation::spec(_oop_index));
6b2273dd6fa9 6822110: Add AddressLiteral class on SPARC
twisti
parents: 342
diff changeset
272 __ patchable_set(addrlit, _obj);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
273
a61af66fc99e Initial load
duke
parents:
diff changeset
274 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
275 for (int i = 0; i < _bytes_to_copy; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
276 address ptr = (address)(_pc_start + i);
a61af66fc99e Initial load
duke
parents:
diff changeset
277 int a_byte = (*ptr) & 0xFF;
a61af66fc99e Initial load
duke
parents:
diff changeset
278 assert(a_byte == *start++, "should be the same code");
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
281 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
282 // make a copy the code which is going to be patched.
a61af66fc99e Initial load
duke
parents:
diff changeset
283 for (int i = 0; i < _bytes_to_copy; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
284 address ptr = (address)(_pc_start + i);
a61af66fc99e Initial load
duke
parents:
diff changeset
285 int a_byte = (*ptr) & 0xFF;
a61af66fc99e Initial load
duke
parents:
diff changeset
286 __ a_byte (a_byte);
a61af66fc99e Initial load
duke
parents:
diff changeset
287 }
a61af66fc99e Initial load
duke
parents:
diff changeset
288 }
a61af66fc99e Initial load
duke
parents:
diff changeset
289
a61af66fc99e Initial load
duke
parents:
diff changeset
290 address end_of_patch = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
291 int bytes_to_skip = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
292 if (_id == load_klass_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
293 int offset = __ offset();
a61af66fc99e Initial load
duke
parents:
diff changeset
294 if (CommentedAssembly) {
a61af66fc99e Initial load
duke
parents:
diff changeset
295 __ block_comment(" being_initialized check");
a61af66fc99e Initial load
duke
parents:
diff changeset
296 }
a61af66fc99e Initial load
duke
parents:
diff changeset
297
a61af66fc99e Initial load
duke
parents:
diff changeset
298 // static field accesses have special semantics while the class
a61af66fc99e Initial load
duke
parents:
diff changeset
299 // initializer is being run so we emit a test which can be used to
a61af66fc99e Initial load
duke
parents:
diff changeset
300 // check that this code is being executed by the initializing
a61af66fc99e Initial load
duke
parents:
diff changeset
301 // thread.
a61af66fc99e Initial load
duke
parents:
diff changeset
302 assert(_obj != noreg, "must be a valid register");
a61af66fc99e Initial load
duke
parents:
diff changeset
303 assert(_oop_index >= 0, "must have oop index");
2380
32f7097f9d8f 7030300: more nightly failures after statics in Class changes
never
parents: 2376
diff changeset
304 __ load_heap_oop(_obj, java_lang_Class::klass_offset_in_bytes(), G3);
2376
c7f3d0b4570f 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 2168
diff changeset
305 __ ld_ptr(G3, instanceKlass::init_thread_offset_in_bytes() + sizeof(klassOopDesc), G3);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
306 __ cmp(G2_thread, G3);
a61af66fc99e Initial load
duke
parents:
diff changeset
307 __ br(Assembler::notEqual, false, Assembler::pn, call_patch);
a61af66fc99e Initial load
duke
parents:
diff changeset
308 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
309
a61af66fc99e Initial load
duke
parents:
diff changeset
310 // load_klass patches may execute the patched code before it's
a61af66fc99e Initial load
duke
parents:
diff changeset
311 // copied back into place so we need to jump back into the main
a61af66fc99e Initial load
duke
parents:
diff changeset
312 // code of the nmethod to continue execution.
a61af66fc99e Initial load
duke
parents:
diff changeset
313 __ br(Assembler::always, false, Assembler::pt, _patch_site_continuation);
a61af66fc99e Initial load
duke
parents:
diff changeset
314 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
315
a61af66fc99e Initial load
duke
parents:
diff changeset
316 // make sure this extra code gets skipped
a61af66fc99e Initial load
duke
parents:
diff changeset
317 bytes_to_skip += __ offset() - offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
318 }
a61af66fc99e Initial load
duke
parents:
diff changeset
319
a61af66fc99e Initial load
duke
parents:
diff changeset
320 // Now emit the patch record telling the runtime how to find the
a61af66fc99e Initial load
duke
parents:
diff changeset
321 // pieces of the patch. We only need 3 bytes but it has to be
a61af66fc99e Initial load
duke
parents:
diff changeset
322 // aligned as an instruction so emit 4 bytes.
a61af66fc99e Initial load
duke
parents:
diff changeset
323 int sizeof_patch_record = 4;
a61af66fc99e Initial load
duke
parents:
diff changeset
324 bytes_to_skip += sizeof_patch_record;
a61af66fc99e Initial load
duke
parents:
diff changeset
325
a61af66fc99e Initial load
duke
parents:
diff changeset
326 // emit the offsets needed to find the code to patch
a61af66fc99e Initial load
duke
parents:
diff changeset
327 int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record;
a61af66fc99e Initial load
duke
parents:
diff changeset
328
a61af66fc99e Initial load
duke
parents:
diff changeset
329 // Emit the patch record. We need to emit a full word, so emit an extra empty byte
a61af66fc99e Initial load
duke
parents:
diff changeset
330 __ a_byte(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
331 __ a_byte(being_initialized_entry_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
332 __ a_byte(bytes_to_skip);
a61af66fc99e Initial load
duke
parents:
diff changeset
333 __ a_byte(_bytes_to_copy);
a61af66fc99e Initial load
duke
parents:
diff changeset
334 address patch_info_pc = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
335 assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
a61af66fc99e Initial load
duke
parents:
diff changeset
336
a61af66fc99e Initial load
duke
parents:
diff changeset
337 address entry = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
338 NativeGeneralJump::insert_unconditional((address)_pc_start, entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
339 address target = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
340 switch (_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
341 case access_field_id: target = Runtime1::entry_for(Runtime1::access_field_patching_id); break;
a61af66fc99e Initial load
duke
parents:
diff changeset
342 case load_klass_id: target = Runtime1::entry_for(Runtime1::load_klass_patching_id); break;
a61af66fc99e Initial load
duke
parents:
diff changeset
343 default: ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
344 }
a61af66fc99e Initial load
duke
parents:
diff changeset
345 __ bind(call_patch);
a61af66fc99e Initial load
duke
parents:
diff changeset
346
a61af66fc99e Initial load
duke
parents:
diff changeset
347 if (CommentedAssembly) {
a61af66fc99e Initial load
duke
parents:
diff changeset
348 __ block_comment("patch entry point");
a61af66fc99e Initial load
duke
parents:
diff changeset
349 }
a61af66fc99e Initial load
duke
parents:
diff changeset
350 __ call(target, relocInfo::runtime_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
351 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
352 assert(_patch_info_offset == (patch_info_pc - __ pc()), "must not change");
a61af66fc99e Initial load
duke
parents:
diff changeset
353 ce->add_call_info_here(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
354 __ br(Assembler::always, false, Assembler::pt, _patch_site_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
355 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
356 if (_id == load_klass_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
357 CodeSection* cs = __ code_section();
a61af66fc99e Initial load
duke
parents:
diff changeset
358 address pc = (address)_pc_start;
a61af66fc99e Initial load
duke
parents:
diff changeset
359 RelocIterator iter(cs, pc, pc + 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
360 relocInfo::change_reloc_info_for_address(&iter, (address) pc, relocInfo::oop_type, relocInfo::none);
a61af66fc99e Initial load
duke
parents:
diff changeset
361
a61af66fc99e Initial load
duke
parents:
diff changeset
362 pc = (address)(_pc_start + NativeMovConstReg::add_offset);
a61af66fc99e Initial load
duke
parents:
diff changeset
363 RelocIterator iter2(cs, pc, pc+1);
a61af66fc99e Initial load
duke
parents:
diff changeset
364 relocInfo::change_reloc_info_for_address(&iter2, (address) pc, relocInfo::oop_type, relocInfo::none);
a61af66fc99e Initial load
duke
parents:
diff changeset
365 }
a61af66fc99e Initial load
duke
parents:
diff changeset
366
a61af66fc99e Initial load
duke
parents:
diff changeset
367 }
a61af66fc99e Initial load
duke
parents:
diff changeset
368
1295
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
369
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
370 void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
371 __ bind(_entry);
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
372 __ call(SharedRuntime::deopt_blob()->unpack_with_reexecution());
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
373 __ delayed()->nop();
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
374 ce->add_call_info_here(_info);
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
375 debug_only(__ should_not_reach_here());
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
376 }
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
377
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 727
diff changeset
378
0
a61af66fc99e Initial load
duke
parents:
diff changeset
379 void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
a61af66fc99e Initial load
duke
parents:
diff changeset
380 //---------------slow case: call to native-----------------
a61af66fc99e Initial load
duke
parents:
diff changeset
381 __ bind(_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
382 __ mov(src()->as_register(), O0);
a61af66fc99e Initial load
duke
parents:
diff changeset
383 __ mov(src_pos()->as_register(), O1);
a61af66fc99e Initial load
duke
parents:
diff changeset
384 __ mov(dst()->as_register(), O2);
a61af66fc99e Initial load
duke
parents:
diff changeset
385 __ mov(dst_pos()->as_register(), O3);
a61af66fc99e Initial load
duke
parents:
diff changeset
386 __ mov(length()->as_register(), O4);
a61af66fc99e Initial load
duke
parents:
diff changeset
387
a61af66fc99e Initial load
duke
parents:
diff changeset
388 ce->emit_static_call_stub();
a61af66fc99e Initial load
duke
parents:
diff changeset
389
a61af66fc99e Initial load
duke
parents:
diff changeset
390 __ call(SharedRuntime::get_resolve_static_call_stub(), relocInfo::static_call_type);
a61af66fc99e Initial load
duke
parents:
diff changeset
391 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
392 ce->add_call_info_here(info());
a61af66fc99e Initial load
duke
parents:
diff changeset
393 ce->verify_oop_map(info());
a61af66fc99e Initial load
duke
parents:
diff changeset
394
a61af66fc99e Initial load
duke
parents:
diff changeset
395 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
396 __ set((intptr_t)&Runtime1::_arraycopy_slowcase_cnt, O0);
a61af66fc99e Initial load
duke
parents:
diff changeset
397 __ ld(O0, 0, O1);
a61af66fc99e Initial load
duke
parents:
diff changeset
398 __ inc(O1);
a61af66fc99e Initial load
duke
parents:
diff changeset
399 __ st(O1, 0, O0);
a61af66fc99e Initial load
duke
parents:
diff changeset
400 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
401
a61af66fc99e Initial load
duke
parents:
diff changeset
402 __ br(Assembler::always, false, Assembler::pt, _continuation);
a61af66fc99e Initial load
duke
parents:
diff changeset
403 __ delayed()->nop();
a61af66fc99e Initial load
duke
parents:
diff changeset
404 }
a61af66fc99e Initial load
duke
parents:
diff changeset
405
a61af66fc99e Initial load
duke
parents:
diff changeset
406
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
407 ///////////////////////////////////////////////////////////////////////////////////
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
408 #ifndef SERIALGC
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
409
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
410 void G1PreBarrierStub::emit_code(LIR_Assembler* ce) {
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
411 // At this point we know that marking is in progress.
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
412 // If do_load() is true then we have to emit the
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
413 // load of the previous value; otherwise it has already
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
414 // been loaded into _pre_val.
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
415
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
416 __ bind(_entry);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
417
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
418 assert(pre_val()->is_register(), "Precondition.");
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
419 Register pre_val_reg = pre_val()->as_register();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
420
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
421 if (do_load()) {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
422 ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false /*wide*/, false /*unaligned*/);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
423 }
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
424
1848
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
425 if (__ is_in_wdisp16_range(_continuation)) {
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
426 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
427 pre_val_reg, _continuation);
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
428 } else {
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
429 __ cmp(pre_val_reg, G0);
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
430 __ brx(Assembler::equal, false, Assembler::pn, _continuation);
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
431 }
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
432 __ delayed()->nop();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
433
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
434 __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id));
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
435 __ delayed()->mov(pre_val_reg, G4);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
436 __ br(Assembler::always, false, Assembler::pt, _continuation);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
437 __ delayed()->nop();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
438
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
439 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
440
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
441 void G1UnsafeGetObjSATBBarrierStub::emit_code(LIR_Assembler* ce) {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
442 // At this point we know that offset == referent_offset.
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
443 //
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
444 // So we might have to emit:
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
445 // if (src == null) goto continuation.
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
446 //
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
447 // and we definitely have to emit:
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
448 // if (klass(src).reference_type == REF_NONE) goto continuation
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
449 // if (!marking_active) goto continuation
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
450 // if (pre_val == null) goto continuation
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
451 // call pre_barrier(pre_val)
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
452 // goto continuation
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
453 //
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
454 __ bind(_entry);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
455
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
456 assert(src()->is_register(), "sanity");
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
457 Register src_reg = src()->as_register();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
458
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
459 if (gen_src_check()) {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
460 // The original src operand was not a constant.
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
461 // Generate src == null?
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
462 if (__ is_in_wdisp16_range(_continuation)) {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
463 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
464 src_reg, _continuation);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
465 } else {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
466 __ cmp(src_reg, G0);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
467 __ brx(Assembler::equal, false, Assembler::pt, _continuation);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
468 }
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
469 __ delayed()->nop();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
470 }
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
471
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
472 // Generate src->_klass->_reference_type() == REF_NONE)?
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
473 assert(tmp()->is_register(), "sanity");
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
474 Register tmp_reg = tmp()->as_register();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
475
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
476 __ load_klass(src_reg, tmp_reg);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
477
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
478 Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset_in_bytes() + sizeof(oopDesc));
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
479 __ ld(ref_type_adr, tmp_reg);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
480
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
481 if (__ is_in_wdisp16_range(_continuation)) {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
482 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
483 tmp_reg, _continuation);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
484 } else {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
485 __ cmp(tmp_reg, G0);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
486 __ brx(Assembler::equal, false, Assembler::pt, _continuation);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
487 }
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
488 __ delayed()->nop();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
489
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
490 // Is marking active?
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
491 assert(thread()->is_register(), "precondition");
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
492 Register thread_reg = thread()->as_register();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
493
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
494 Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() +
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
495 PtrQueue::byte_offset_of_active()));
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
496
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
497 if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
498 __ ld(in_progress, tmp_reg);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
499 } else {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
500 assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
501 __ ldsb(in_progress, tmp_reg);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
502 }
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
503 if (__ is_in_wdisp16_range(_continuation)) {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
504 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
505 tmp_reg, _continuation);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
506 } else {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
507 __ cmp(tmp_reg, G0);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
508 __ brx(Assembler::equal, false, Assembler::pt, _continuation);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
509 }
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
510 __ delayed()->nop();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
511
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
512 // val == null?
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
513 assert(val()->is_register(), "Precondition.");
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
514 Register val_reg = val()->as_register();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
515
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
516 if (__ is_in_wdisp16_range(_continuation)) {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
517 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
518 val_reg, _continuation);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
519 } else {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
520 __ cmp(val_reg, G0);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
521 __ brx(Assembler::equal, false, Assembler::pt, _continuation);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
522 }
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
523 __ delayed()->nop();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
524
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
525 __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id));
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
526 __ delayed()->mov(val_reg, G4);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
527 __ br(Assembler::always, false, Assembler::pt, _continuation);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
528 __ delayed()->nop();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
529 }
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2380
diff changeset
530
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
531 jbyte* G1PostBarrierStub::_byte_map_base = NULL;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
532
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
533 jbyte* G1PostBarrierStub::byte_map_base_slow() {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
534 BarrierSet* bs = Universe::heap()->barrier_set();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
535 assert(bs->is_a(BarrierSet::G1SATBCTLogging),
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
536 "Must be if we're using this.");
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
537 return ((G1SATBCardTableModRefBS*)bs)->byte_map_base;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
538 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
539
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
540 void G1PostBarrierStub::emit_code(LIR_Assembler* ce) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
541 __ bind(_entry);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
542
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
543 assert(addr()->is_register(), "Precondition.");
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
544 assert(new_val()->is_register(), "Precondition.");
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
545 Register addr_reg = addr()->as_pointer_register();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
546 Register new_val_reg = new_val()->as_register();
1848
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
547 if (__ is_in_wdisp16_range(_continuation)) {
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
548 __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt,
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
549 new_val_reg, _continuation);
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
550 } else {
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
551 __ cmp(new_val_reg, G0);
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
552 __ brx(Assembler::equal, false, Assembler::pn, _continuation);
c393f046f4c5 6991512: G1 barriers fail with 64bit C1
iveresov
parents: 1819
diff changeset
553 }
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
554 __ delayed()->nop();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
555
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
556 __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_post_barrier_slow_id));
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
557 __ delayed()->mov(addr_reg, G4);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
558 __ br(Assembler::always, false, Assembler::pt, _continuation);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
559 __ delayed()->nop();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
560 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
561
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
562 #endif // SERIALGC
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
563 ///////////////////////////////////////////////////////////////////////////////////
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
564
0
a61af66fc99e Initial load
duke
parents:
diff changeset
565 #undef __