< prev index next >

src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp

Print this page

  1 /*
  2  * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright (c) 2018, 2025 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  *

264   }
265 
266   __ li(R0, G1CardTable::dirty_card_val());
267   __ stbx(R0, tmp1, tmp2);
268 }
269 
270 void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, DecoratorSet decorators,
271                                                   Register store_addr, Register new_val,
272                                                   Register tmp1, Register tmp2) {
273   bool not_null = (decorators & IS_NOT_NULL) != 0;
274 
275   Label done;
276   generate_post_barrier(masm, store_addr, new_val, R16_thread, tmp1, tmp2, done, !not_null);
277   __ bind(done);
278 }
279 
280 void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
281                                        Register base, RegisterOrConstant ind_or_offs, Register val,
282                                        Register tmp1, Register tmp2, Register tmp3,
283                                        MacroAssembler::PreservationLevel preservation_level) {





284   bool is_array = (decorators & IS_ARRAY) != 0;
285   bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
286   bool precise = is_array || on_anonymous;

287   // Load and record the previous value.
288   g1_write_barrier_pre(masm, decorators,
289                        base, ind_or_offs,
290                        tmp1, tmp2, tmp3,
291                        preservation_level);


292 
293   BarrierSetAssembler::store_at(masm, decorators,
294                                 type, base, ind_or_offs, val,
295                                 tmp1, tmp2, tmp3,
296                                 preservation_level);
297 
298   // No need for post barrier if storing null
299   if (val != noreg) {
300     if (precise) {
301       if (ind_or_offs.is_constant()) {
302         __ add_const_optimized(base, base, ind_or_offs.as_constant(), tmp1);
303       } else {
304         __ add(base, ind_or_offs.as_register(), base);
305       }
306     }
307     g1_write_barrier_post(masm, decorators,
308                           base, val,
309                           tmp1, tmp2);
310   }
311 }
312 
313 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
314                                     Register base, RegisterOrConstant ind_or_offs, Register dst,
315                                     Register tmp1, Register tmp2,
316                                     MacroAssembler::PreservationLevel preservation_level, Label *L_handle_null) {
317   bool on_oop = is_reference_type(type);
318   bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
319   bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;

  1 /*
  2  * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright (c) 2018, 2026 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  *

264   }
265 
266   __ li(R0, G1CardTable::dirty_card_val());
267   __ stbx(R0, tmp1, tmp2);
268 }
269 
270 void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, DecoratorSet decorators,
271                                                   Register store_addr, Register new_val,
272                                                   Register tmp1, Register tmp2) {
273   bool not_null = (decorators & IS_NOT_NULL) != 0;
274 
275   Label done;
276   generate_post_barrier(masm, store_addr, new_val, R16_thread, tmp1, tmp2, done, !not_null);
277   __ bind(done);
278 }
279 
280 void G1BarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
281                                        Register base, RegisterOrConstant ind_or_offs, Register val,
282                                        Register tmp1, Register tmp2, Register tmp3,
283                                        MacroAssembler::PreservationLevel preservation_level) {
284   bool in_heap = (decorators & IN_HEAP) != 0;
285   bool as_normal = (decorators & AS_NORMAL) != 0;
286   bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
287   bool needs_pre_barrier = as_normal && !dest_uninitialized;
288   bool needs_post_barrier = (val != noreg && in_heap);
289   bool is_array = (decorators & IS_ARRAY) != 0;
290   bool on_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
291   bool precise = is_array || on_anonymous;
292 
293   // Load and record the previous value.
294   if (needs_pre_barrier) {
295     g1_write_barrier_pre(masm, decorators,
296                          base, ind_or_offs,
297                          tmp1, tmp2, tmp3,
298                          preservation_level);
299   }
300 
301   BarrierSetAssembler::store_at(masm, decorators,
302                                 type, base, ind_or_offs, val,
303                                 tmp1, tmp2, tmp3,
304                                 preservation_level);
305 
306   // No need for post barrier if storing null
307   if (needs_post_barrier) {
308     if (precise) {
309       if (ind_or_offs.is_constant()) {
310         __ add_const_optimized(base, base, ind_or_offs.as_constant(), tmp1);
311       } else {
312         __ add(base, ind_or_offs.as_register(), base);
313       }
314     }
315     g1_write_barrier_post(masm, decorators,
316                           base, val,
317                           tmp1, tmp2);
318   }
319 }
320 
321 void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
322                                     Register base, RegisterOrConstant ind_or_offs, Register dst,
323                                     Register tmp1, Register tmp2,
324                                     MacroAssembler::PreservationLevel preservation_level, Label *L_handle_null) {
325   bool on_oop = is_reference_type(type);
326   bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
327   bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
< prev index next >