1 /*
2 * Copyright (c) 2018, 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 *
234 __ cbz(rscratch1, runtime);
235 __ sub(rscratch1, rscratch1, wordSize);
236 __ str(rscratch1, queue_index);
237
238 __ ldr(tmp2, buffer);
239 __ str(card_addr, Address(tmp2, rscratch1));
240 __ b(done);
241
242 __ bind(runtime);
243 // save the live input values
244 RegSet saved = RegSet::of(store_addr, new_val);
245 __ push(saved, sp);
246 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
247 __ pop(saved, sp);
248
249 __ bind(done);
250 }
251
252 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
253 Register dst, Address src, Register tmp1, Register tmp_thread) {
254 bool on_oop = type == T_OBJECT || type == T_ARRAY;
255 bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
256 bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
257 bool on_reference = on_weak || on_phantom;
258 ModRefBarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread);
259 if (on_oop && on_reference) {
260 // LR is live. It must be saved around calls.
261 __ enter(); // barrier may call runtime
262 // Generate the G1 pre-barrier code to log the value of
263 // the referent field in an SATB buffer.
264 g1_write_barrier_pre(masm /* masm */,
265 noreg /* obj */,
266 dst /* pre_val */,
267 rthread /* thread */,
268 tmp1 /* tmp */,
269 true /* tosca_live */,
270 true /* expand_call */);
271 __ leave();
272 }
273 }
274
|
1 /*
2 * Copyright (c) 2018, 2019, 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 *
234 __ cbz(rscratch1, runtime);
235 __ sub(rscratch1, rscratch1, wordSize);
236 __ str(rscratch1, queue_index);
237
238 __ ldr(tmp2, buffer);
239 __ str(card_addr, Address(tmp2, rscratch1));
240 __ b(done);
241
242 __ bind(runtime);
243 // save the live input values
244 RegSet saved = RegSet::of(store_addr, new_val);
245 __ push(saved, sp);
246 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
247 __ pop(saved, sp);
248
249 __ bind(done);
250 }
251
252 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
253 Register dst, Address src, Register tmp1, Register tmp_thread) {
254 bool on_oop = is_reference_type(type);
255 bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
256 bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
257 bool on_reference = on_weak || on_phantom;
258 ModRefBarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread);
259 if (on_oop && on_reference) {
260 // LR is live. It must be saved around calls.
261 __ enter(); // barrier may call runtime
262 // Generate the G1 pre-barrier code to log the value of
263 // the referent field in an SATB buffer.
264 g1_write_barrier_pre(masm /* masm */,
265 noreg /* obj */,
266 dst /* pre_val */,
267 rthread /* thread */,
268 tmp1 /* tmp */,
269 true /* tosca_live */,
270 true /* expand_call */);
271 __ leave();
272 }
273 }
274
|