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 "precompiled.hpp"
26 #include "gc/shared/barrierSetAssembler.hpp"
27 #include "interpreter/interp_masm.hpp"
28 #include "runtime/jniHandles.hpp"
29
30 #define __ masm->
31
32 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
33 Register dst, Address src, Register tmp1, Register tmp_thread) {
34 bool on_heap = (decorators & IN_HEAP) != 0;
35 bool on_root = (decorators & IN_ROOT) != 0;
36 bool oop_not_null = (decorators & OOP_NOT_NULL) != 0;
37 bool atomic = (decorators & MO_RELAXED) != 0;
38
39 switch (type) {
40 case T_OBJECT:
41 case T_ARRAY: {
42 if (on_heap) {
43 #ifdef _LP64
44 if (UseCompressedOops) {
45 __ movl(dst, src);
46 if (oop_not_null) {
47 __ decode_heap_oop_not_null(dst);
48 } else {
49 __ decode_heap_oop(dst);
50 }
51 } else
52 #endif
53 {
54 __ movptr(dst, src);
55 }
80 #else
81 if (atomic) {
82 __ fild_d(src); // Must load atomically
83 __ subptr(rsp,2*wordSize); // Make space for store
84 __ fistp_d(Address(rsp,0));
85 __ pop(rax);
86 __ pop(rdx);
87 } else {
88 __ movl(rax, src);
89 __ movl(rdx, src.plus_disp(wordSize));
90 }
91 #endif
92 break;
93 default: Unimplemented();
94 }
95 }
96
97 void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
98 Address dst, Register val, Register tmp1, Register tmp2) {
99 bool on_heap = (decorators & IN_HEAP) != 0;
100 bool on_root = (decorators & IN_ROOT) != 0;
101 bool oop_not_null = (decorators & OOP_NOT_NULL) != 0;
102 bool atomic = (decorators & MO_RELAXED) != 0;
103
104 switch (type) {
105 case T_OBJECT:
106 case T_ARRAY: {
107 if (on_heap) {
108 if (val == noreg) {
109 assert(!oop_not_null, "inconsistent access");
110 #ifdef _LP64
111 if (UseCompressedOops) {
112 __ movl(dst, (int32_t)NULL_WORD);
113 } else {
114 __ movslq(dst, (int32_t)NULL_WORD);
115 }
116 #else
117 __ movl(dst, (int32_t)NULL_WORD);
118 #endif
119 } else {
120 #ifdef _LP64
|
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 "precompiled.hpp"
26 #include "gc/shared/barrierSetAssembler.hpp"
27 #include "interpreter/interp_masm.hpp"
28 #include "runtime/jniHandles.hpp"
29
30 #define __ masm->
31
32 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
33 Register dst, Address src, Register tmp1, Register tmp_thread) {
34 bool on_heap = (decorators & IN_HEAP) != 0;
35 bool on_root = (decorators & IN_NATIVE) != 0;
36 bool oop_not_null = (decorators & OOP_NOT_NULL) != 0;
37 bool atomic = (decorators & MO_RELAXED) != 0;
38
39 switch (type) {
40 case T_OBJECT:
41 case T_ARRAY: {
42 if (on_heap) {
43 #ifdef _LP64
44 if (UseCompressedOops) {
45 __ movl(dst, src);
46 if (oop_not_null) {
47 __ decode_heap_oop_not_null(dst);
48 } else {
49 __ decode_heap_oop(dst);
50 }
51 } else
52 #endif
53 {
54 __ movptr(dst, src);
55 }
80 #else
81 if (atomic) {
82 __ fild_d(src); // Must load atomically
83 __ subptr(rsp,2*wordSize); // Make space for store
84 __ fistp_d(Address(rsp,0));
85 __ pop(rax);
86 __ pop(rdx);
87 } else {
88 __ movl(rax, src);
89 __ movl(rdx, src.plus_disp(wordSize));
90 }
91 #endif
92 break;
93 default: Unimplemented();
94 }
95 }
96
97 void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
98 Address dst, Register val, Register tmp1, Register tmp2) {
99 bool on_heap = (decorators & IN_HEAP) != 0;
100 bool on_root = (decorators & IN_NATIVE) != 0;
101 bool oop_not_null = (decorators & OOP_NOT_NULL) != 0;
102 bool atomic = (decorators & MO_RELAXED) != 0;
103
104 switch (type) {
105 case T_OBJECT:
106 case T_ARRAY: {
107 if (on_heap) {
108 if (val == noreg) {
109 assert(!oop_not_null, "inconsistent access");
110 #ifdef _LP64
111 if (UseCompressedOops) {
112 __ movl(dst, (int32_t)NULL_WORD);
113 } else {
114 __ movslq(dst, (int32_t)NULL_WORD);
115 }
116 #else
117 __ movl(dst, (int32_t)NULL_WORD);
118 #endif
119 } else {
120 #ifdef _LP64
|