23 */
24
25 #include "precompiled.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 "runtime/jniHandles.hpp"
32 #include "runtime/thread.hpp"
33
34 #define __ masm->
35
36 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
37 Register dst, Address src, Register tmp1, Register tmp_thread) {
38 bool in_heap = (decorators & IN_HEAP) != 0;
39 bool in_native = (decorators & IN_NATIVE) != 0;
40 bool is_not_null = (decorators & IS_NOT_NULL) != 0;
41 bool atomic = (decorators & MO_RELAXED) != 0;
42
43 switch (type) {
44 case T_OBJECT:
45 case T_ARRAY: {
46 if (in_heap) {
47 #ifdef _LP64
48 if (UseCompressedOops) {
49 __ movl(dst, src);
50 if (is_not_null) {
51 __ decode_heap_oop_not_null(dst);
52 } else {
53 __ decode_heap_oop(dst);
54 }
55 } else
56 #endif
57 {
58 __ movptr(dst, src);
59 }
60 } else {
61 assert(in_native, "why else?");
62 __ movptr(dst, src);
88 __ fistp_d(Address(rsp,0));
89 __ pop(rax);
90 __ pop(rdx);
91 } else {
92 __ movl(rax, src);
93 __ movl(rdx, src.plus_disp(wordSize));
94 }
95 #endif
96 break;
97 default: Unimplemented();
98 }
99 }
100
101 void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
102 Address dst, Register val, Register tmp1, Register tmp2) {
103 bool in_heap = (decorators & IN_HEAP) != 0;
104 bool in_native = (decorators & IN_NATIVE) != 0;
105 bool is_not_null = (decorators & IS_NOT_NULL) != 0;
106 bool atomic = (decorators & MO_RELAXED) != 0;
107
108 switch (type) {
109 case T_OBJECT:
110 case T_ARRAY: {
111 if (in_heap) {
112 if (val == noreg) {
113 assert(!is_not_null, "inconsistent access");
114 #ifdef _LP64
115 if (UseCompressedOops) {
116 __ movl(dst, (int32_t)NULL_WORD);
117 } else {
118 __ movslq(dst, (int32_t)NULL_WORD);
119 }
120 #else
121 __ movl(dst, (int32_t)NULL_WORD);
122 #endif
123 } else {
124 #ifdef _LP64
125 if (UseCompressedOops) {
126 assert(!dst.uses(val), "not enough registers");
127 if (is_not_null) {
|
23 */
24
25 #include "precompiled.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 "runtime/jniHandles.hpp"
32 #include "runtime/thread.hpp"
33
34 #define __ masm->
35
36 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
37 Register dst, Address src, Register tmp1, Register tmp_thread) {
38 bool in_heap = (decorators & IN_HEAP) != 0;
39 bool in_native = (decorators & IN_NATIVE) != 0;
40 bool is_not_null = (decorators & IS_NOT_NULL) != 0;
41 bool atomic = (decorators & MO_RELAXED) != 0;
42
43 assert(type != T_VALUETYPE, "Not supported yet");
44 switch (type) {
45 case T_OBJECT:
46 case T_ARRAY: {
47 if (in_heap) {
48 #ifdef _LP64
49 if (UseCompressedOops) {
50 __ movl(dst, src);
51 if (is_not_null) {
52 __ decode_heap_oop_not_null(dst);
53 } else {
54 __ decode_heap_oop(dst);
55 }
56 } else
57 #endif
58 {
59 __ movptr(dst, src);
60 }
61 } else {
62 assert(in_native, "why else?");
63 __ movptr(dst, src);
89 __ fistp_d(Address(rsp,0));
90 __ pop(rax);
91 __ pop(rdx);
92 } else {
93 __ movl(rax, src);
94 __ movl(rdx, src.plus_disp(wordSize));
95 }
96 #endif
97 break;
98 default: Unimplemented();
99 }
100 }
101
102 void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
103 Address dst, Register val, Register tmp1, Register tmp2) {
104 bool in_heap = (decorators & IN_HEAP) != 0;
105 bool in_native = (decorators & IN_NATIVE) != 0;
106 bool is_not_null = (decorators & IS_NOT_NULL) != 0;
107 bool atomic = (decorators & MO_RELAXED) != 0;
108
109 assert(type != T_VALUETYPE, "Not supported yet");
110 switch (type) {
111 case T_OBJECT:
112 case T_ARRAY: {
113 if (in_heap) {
114 if (val == noreg) {
115 assert(!is_not_null, "inconsistent access");
116 #ifdef _LP64
117 if (UseCompressedOops) {
118 __ movl(dst, (int32_t)NULL_WORD);
119 } else {
120 __ movslq(dst, (int32_t)NULL_WORD);
121 }
122 #else
123 __ movl(dst, (int32_t)NULL_WORD);
124 #endif
125 } else {
126 #ifdef _LP64
127 if (UseCompressedOops) {
128 assert(!dst.uses(val), "not enough registers");
129 if (is_not_null) {
|