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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "classfile/classLoaderData.hpp"
26 #include "gc/shared/barrierSet.hpp"
27 #include "gc/shared/barrierSetAssembler.hpp"
28 #include "gc/shared/barrierSetNMethod.hpp"
29 #include "gc/shared/collectedHeap.hpp"
30 #include "interpreter/interp_masm.hpp"
31 #include "memory/universe.hpp"
32 #include "runtime/javaThread.hpp"
33 #include "runtime/jniHandles.hpp"
34 #include "runtime/sharedRuntime.hpp"
35 #include "runtime/stubRoutines.hpp"
36 #ifdef COMPILER2
37 #include "gc/shared/c2/barrierSetC2.hpp"
38 #endif // COMPILER2
39
40 #define __ masm->
41
42 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
43 Register dst, Address src, Register tmp1) {
44 bool in_heap = (decorators & IN_HEAP) != 0;
45 bool in_native = (decorators & IN_NATIVE) != 0;
46 bool is_not_null = (decorators & IS_NOT_NULL) != 0;
47 bool atomic = (decorators & MO_RELAXED) != 0;
48
144 break;
145 case T_LONG:
146 assert(val == noreg, "only tos");
147 __ movq(dst, rax);
148 break;
149 case T_FLOAT:
150 assert(val == noreg, "only tos");
151 __ movflt(dst, xmm0);
152 break;
153 case T_DOUBLE:
154 assert(val == noreg, "only tos");
155 __ movdbl(dst, xmm0);
156 break;
157 case T_ADDRESS:
158 __ movptr(dst, val);
159 break;
160 default: Unimplemented();
161 }
162 }
163
164 void BarrierSetAssembler::copy_load_at(MacroAssembler* masm,
165 DecoratorSet decorators,
166 BasicType type,
167 size_t bytes,
168 Register dst,
169 Address src,
170 Register tmp) {
171 assert(bytes <= 8, "can only deal with non-vector registers");
172 switch (bytes) {
173 case 1:
174 __ movb(dst, src);
175 break;
176 case 2:
177 __ movw(dst, src);
178 break;
179 case 4:
180 __ movl(dst, src);
181 break;
182 case 8:
183 __ movq(dst, src);
|
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "asm/macroAssembler.inline.hpp"
26 #include "classfile/classLoaderData.hpp"
27 #include "gc/shared/barrierSet.hpp"
28 #include "gc/shared/barrierSetAssembler.hpp"
29 #include "gc/shared/barrierSetNMethod.hpp"
30 #include "gc/shared/barrierSetRuntime.hpp"
31 #include "gc/shared/collectedHeap.hpp"
32 #include "interpreter/interp_masm.hpp"
33 #include "memory/universe.hpp"
34 #include "runtime/javaThread.hpp"
35 #include "runtime/jniHandles.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #include "runtime/stubRoutines.hpp"
38 #ifdef COMPILER2
39 #include "gc/shared/c2/barrierSetC2.hpp"
40 #endif // COMPILER2
41
42 #define __ masm->
43
44 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
45 Register dst, Address src, Register tmp1) {
46 bool in_heap = (decorators & IN_HEAP) != 0;
47 bool in_native = (decorators & IN_NATIVE) != 0;
48 bool is_not_null = (decorators & IS_NOT_NULL) != 0;
49 bool atomic = (decorators & MO_RELAXED) != 0;
50
146 break;
147 case T_LONG:
148 assert(val == noreg, "only tos");
149 __ movq(dst, rax);
150 break;
151 case T_FLOAT:
152 assert(val == noreg, "only tos");
153 __ movflt(dst, xmm0);
154 break;
155 case T_DOUBLE:
156 assert(val == noreg, "only tos");
157 __ movdbl(dst, xmm0);
158 break;
159 case T_ADDRESS:
160 __ movptr(dst, val);
161 break;
162 default: Unimplemented();
163 }
164 }
165
166 void BarrierSetAssembler::flat_field_copy(MacroAssembler* masm, DecoratorSet decorators,
167 Register src, Register dst, Register inline_layout_info) {
168 // flat_field_copy implementation is fairly complex, and there are not any
169 // "short-cuts" to be made from asm. What there is, appears to have the same
170 // cost in C++, so just "call_VM_leaf" for now rather than maintain hundreds
171 // of hand-rolled instructions...
172 if (decorators & IS_DEST_UNINITIALIZED) {
173 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSetRuntime::value_copy_is_dest_uninitialized), src, dst, inline_layout_info);
174 } else {
175 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSetRuntime::value_copy), src, dst, inline_layout_info);
176 }
177 }
178
179 void BarrierSetAssembler::copy_load_at(MacroAssembler* masm,
180 DecoratorSet decorators,
181 BasicType type,
182 size_t bytes,
183 Register dst,
184 Address src,
185 Register tmp) {
186 assert(bytes <= 8, "can only deal with non-vector registers");
187 switch (bytes) {
188 case 1:
189 __ movb(dst, src);
190 break;
191 case 2:
192 __ movw(dst, src);
193 break;
194 case 4:
195 __ movl(dst, src);
196 break;
197 case 8:
198 __ movq(dst, src);
|