16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "gc/shared/barrierSetAssembler.hpp"
29 #include "interpreter/interp_masm.hpp"
30
31 #define __ masm->
32
33 void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
34 Register base, RegisterOrConstant ind_or_offs, Register val,
35 Register tmp1, Register tmp2, Register tmp3, bool needs_frame) {
36 bool on_heap = (decorators & IN_HEAP) != 0;
37 bool in_native = (decorators & IN_NATIVE) != 0;
38 bool not_null = (decorators & OOP_NOT_NULL) != 0;
39 assert(on_heap || in_native, "where?");
40 assert_different_registers(base, val, tmp1, tmp2, R0);
41
42 switch (type) {
43 case T_ARRAY:
44 case T_OBJECT: {
45 if (UseCompressedOops && on_heap) {
46 Register co = tmp1;
47 if (val == noreg) {
48 __ li(co, 0);
49 } else {
50 co = not_null ? __ encode_heap_oop_not_null(tmp1, val) : __ encode_heap_oop(tmp1, val);
51 }
52 __ stw(co, ind_or_offs, base, tmp2);
53 } else {
54 if (val == noreg) {
55 val = tmp1;
56 __ li(val, 0);
57 }
58 __ std(val, ind_or_offs, base, tmp2);
59 }
60 break;
61 }
62 default: Unimplemented();
63 }
64 }
65
66 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
67 Register base, RegisterOrConstant ind_or_offs, Register dst,
68 Register tmp1, Register tmp2, bool needs_frame, Label *L_handle_null) {
69 bool on_heap = (decorators & IN_HEAP) != 0;
70 bool in_native = (decorators & IN_NATIVE) != 0;
71 bool not_null = (decorators & OOP_NOT_NULL) != 0;
72 assert(on_heap || in_native, "where?");
73 assert_different_registers(ind_or_offs.register_or_noreg(), dst, R0);
74
75 switch (type) {
76 case T_ARRAY:
77 case T_OBJECT: {
78 if (UseCompressedOops && on_heap) {
79 if (L_handle_null != NULL) { // Label provided.
80 __ lwz(dst, ind_or_offs, base);
81 __ cmpwi(CCR0, dst, 0);
82 __ beq(CCR0, *L_handle_null);
83 __ decode_heap_oop_not_null(dst);
84 } else if (not_null) { // Guaranteed to be not null.
85 Register narrowOop = (tmp1 != noreg && Universe::narrow_oop_base_disjoint()) ? tmp1 : dst;
86 __ lwz(narrowOop, ind_or_offs, base);
87 __ decode_heap_oop_not_null(dst, narrowOop);
88 } else { // Any oop.
89 __ lwz(dst, ind_or_offs, base);
90 __ decode_heap_oop(dst);
91 }
92 } else {
93 __ ld(dst, ind_or_offs, base);
94 if (L_handle_null != NULL) {
95 __ cmpdi(CCR0, dst, 0);
96 __ beq(CCR0, *L_handle_null);
97 }
98 }
|
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "gc/shared/barrierSetAssembler.hpp"
29 #include "interpreter/interp_masm.hpp"
30
31 #define __ masm->
32
33 void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
34 Register base, RegisterOrConstant ind_or_offs, Register val,
35 Register tmp1, Register tmp2, Register tmp3, bool needs_frame) {
36 bool in_heap = (decorators & IN_HEAP) != 0;
37 bool in_native = (decorators & IN_NATIVE) != 0;
38 bool not_null = (decorators & OOP_NOT_NULL) != 0;
39 assert(in_heap || in_native, "where?");
40 assert_different_registers(base, val, tmp1, tmp2, R0);
41
42 switch (type) {
43 case T_ARRAY:
44 case T_OBJECT: {
45 if (UseCompressedOops && in_heap) {
46 Register co = tmp1;
47 if (val == noreg) {
48 __ li(co, 0);
49 } else {
50 co = not_null ? __ encode_heap_oop_not_null(tmp1, val) : __ encode_heap_oop(tmp1, val);
51 }
52 __ stw(co, ind_or_offs, base, tmp2);
53 } else {
54 if (val == noreg) {
55 val = tmp1;
56 __ li(val, 0);
57 }
58 __ std(val, ind_or_offs, base, tmp2);
59 }
60 break;
61 }
62 default: Unimplemented();
63 }
64 }
65
66 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
67 Register base, RegisterOrConstant ind_or_offs, Register dst,
68 Register tmp1, Register tmp2, bool needs_frame, Label *L_handle_null) {
69 bool in_heap = (decorators & IN_HEAP) != 0;
70 bool in_native = (decorators & IN_NATIVE) != 0;
71 bool not_null = (decorators & OOP_NOT_NULL) != 0;
72 assert(in_heap || in_native, "where?");
73 assert_different_registers(ind_or_offs.register_or_noreg(), dst, R0);
74
75 switch (type) {
76 case T_ARRAY:
77 case T_OBJECT: {
78 if (UseCompressedOops && in_heap) {
79 if (L_handle_null != NULL) { // Label provided.
80 __ lwz(dst, ind_or_offs, base);
81 __ cmpwi(CCR0, dst, 0);
82 __ beq(CCR0, *L_handle_null);
83 __ decode_heap_oop_not_null(dst);
84 } else if (not_null) { // Guaranteed to be not null.
85 Register narrowOop = (tmp1 != noreg && Universe::narrow_oop_base_disjoint()) ? tmp1 : dst;
86 __ lwz(narrowOop, ind_or_offs, base);
87 __ decode_heap_oop_not_null(dst, narrowOop);
88 } else { // Any oop.
89 __ lwz(dst, ind_or_offs, base);
90 __ decode_heap_oop(dst);
91 }
92 } else {
93 __ ld(dst, ind_or_offs, base);
94 if (L_handle_null != NULL) {
95 __ cmpdi(CCR0, dst, 0);
96 __ beq(CCR0, *L_handle_null);
97 }
98 }
|