1 /*
2 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2018, SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
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 *
288 tmp1, tmp2, tmp3, needs_frame);
289
290 BarrierSetAssembler::store_at(masm, decorators, type, base, ind_or_offs, val, tmp1, tmp2, tmp3, needs_frame);
291
292 // No need for post barrier if storing NULL
293 if (val != noreg) {
294 if (precise) {
295 if (ind_or_offs.is_constant()) {
296 __ add_const_optimized(base, base, ind_or_offs.as_constant(), tmp1);
297 } else {
298 __ add(base, ind_or_offs.as_register(), base);
299 }
300 }
301 g1_write_barrier_post(masm, decorators, base, val, tmp1, tmp2, tmp3);
302 }
303 }
304
305 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
306 Register base, RegisterOrConstant ind_or_offs, Register dst,
307 Register tmp1, Register tmp2, bool needs_frame, Label *L_handle_null) {
308 bool on_oop = type == T_OBJECT || type == T_ARRAY;
309 bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
310 bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
311 bool on_reference = on_weak || on_phantom;
312 Label done;
313 if (on_oop && on_reference && L_handle_null == NULL) { L_handle_null = &done; }
314 // Load the value of the referent field.
315 ModRefBarrierSetAssembler::load_at(masm, decorators, type, base, ind_or_offs, dst, tmp1, tmp2, needs_frame, L_handle_null);
316 if (on_oop && on_reference) {
317 // Generate the G1 pre-barrier code to log the value of
318 // the referent field in an SATB buffer. Note with
319 // these parameters the pre-barrier does not generate
320 // the load of the previous value
321 // We only reach here if value is not null.
322 g1_write_barrier_pre(masm, decorators | IS_NOT_NULL, noreg /* obj */, (intptr_t)0, dst /* pre_val */,
323 tmp1, tmp2, needs_frame);
324 }
325 __ bind(done);
326 }
327
328 void G1BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2, bool needs_frame) {
|
1 /*
2 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2018, 2019, SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
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 *
288 tmp1, tmp2, tmp3, needs_frame);
289
290 BarrierSetAssembler::store_at(masm, decorators, type, base, ind_or_offs, val, tmp1, tmp2, tmp3, needs_frame);
291
292 // No need for post barrier if storing NULL
293 if (val != noreg) {
294 if (precise) {
295 if (ind_or_offs.is_constant()) {
296 __ add_const_optimized(base, base, ind_or_offs.as_constant(), tmp1);
297 } else {
298 __ add(base, ind_or_offs.as_register(), base);
299 }
300 }
301 g1_write_barrier_post(masm, decorators, base, val, tmp1, tmp2, tmp3);
302 }
303 }
304
305 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
306 Register base, RegisterOrConstant ind_or_offs, Register dst,
307 Register tmp1, Register tmp2, bool needs_frame, Label *L_handle_null) {
308 bool on_oop = is_reference_type(type);
309 bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
310 bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
311 bool on_reference = on_weak || on_phantom;
312 Label done;
313 if (on_oop && on_reference && L_handle_null == NULL) { L_handle_null = &done; }
314 // Load the value of the referent field.
315 ModRefBarrierSetAssembler::load_at(masm, decorators, type, base, ind_or_offs, dst, tmp1, tmp2, needs_frame, L_handle_null);
316 if (on_oop && on_reference) {
317 // Generate the G1 pre-barrier code to log the value of
318 // the referent field in an SATB buffer. Note with
319 // these parameters the pre-barrier does not generate
320 // the load of the previous value
321 // We only reach here if value is not null.
322 g1_write_barrier_pre(masm, decorators | IS_NOT_NULL, noreg /* obj */, (intptr_t)0, dst /* pre_val */,
323 tmp1, tmp2, needs_frame);
324 }
325 __ bind(done);
326 }
327
328 void G1BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2, bool needs_frame) {
|