1 /*
2 * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 *
91 __ lsr(end, end, CardTable::card_shift());
92 __ sub(count, end, start); // number of bytes to copy
93
94 __ load_byte_map_base(scratch);
95 __ add(start, start, scratch);
96 __ bind(L_loop);
97 __ strb(zr, Address(start, count));
98 __ subs(count, count, 1);
99 __ br(Assembler::GE, L_loop);
100 __ bind(L_done);
101 }
102
103 void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
104 Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) {
105 bool in_heap = (decorators & IN_HEAP) != 0;
106 bool is_array = (decorators & IS_ARRAY) != 0;
107 bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
108 bool precise = is_array || on_anonymous;
109
110 bool needs_post_barrier = val != noreg && in_heap;
111 BarrierSetAssembler::store_at(masm, decorators, type, dst, val, noreg, noreg, noreg);
112 if (needs_post_barrier) {
113 // flatten object address if needed
114 if (!precise || (dst.index() == noreg && dst.offset() == 0)) {
115 store_check(masm, dst.base(), dst);
116 } else {
117 __ lea(tmp3, dst);
118 store_check(masm, tmp3, dst);
119 }
120 }
121 }
|
1 /*
2 * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 *
91 __ lsr(end, end, CardTable::card_shift());
92 __ sub(count, end, start); // number of bytes to copy
93
94 __ load_byte_map_base(scratch);
95 __ add(start, start, scratch);
96 __ bind(L_loop);
97 __ strb(zr, Address(start, count));
98 __ subs(count, count, 1);
99 __ br(Assembler::GE, L_loop);
100 __ bind(L_done);
101 }
102
103 void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
104 Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) {
105 bool in_heap = (decorators & IN_HEAP) != 0;
106 bool is_array = (decorators & IS_ARRAY) != 0;
107 bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
108 bool precise = is_array || on_anonymous;
109
110 bool needs_post_barrier = val != noreg && in_heap;
111
112 BarrierSetAssembler::store_at(masm, decorators, type, dst, val, noreg, noreg, noreg);
113 if (needs_post_barrier) {
114 // flatten object address if needed
115 if (!precise || (dst.index() == noreg && dst.offset() == 0)) {
116 store_check(masm, dst.base(), dst);
117 } else {
118 __ lea(tmp3, dst);
119 store_check(masm, tmp3, dst);
120 }
121 }
122 }
|