src/hotspot/cpu/sparc/gc/g1/g1BarrierSetAssembler_sparc.cpp
changeset 49484 ee8fa73b90f9
child 49748 6a880e576856
equal deleted inserted replaced
49483:d374b1634589 49484:ee8fa73b90f9
       
     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  *
       
    23  */
       
    24 
       
    25 #include "precompiled.hpp"
       
    26 #include "asm/macroAssembler.inline.hpp"
       
    27 #include "gc/g1/g1BarrierSet.hpp"
       
    28 #include "gc/g1/g1CardTable.hpp"
       
    29 #include "gc/g1/g1BarrierSetAssembler.hpp"
       
    30 #include "gc/g1/heapRegion.hpp"
       
    31 #include "gc/shared/collectedHeap.hpp"
       
    32 #include "interpreter/interp_masm.hpp"
       
    33 #include "runtime/sharedRuntime.hpp"
       
    34 #include "runtime/thread.hpp"
       
    35 #include "utilities/macros.hpp"
       
    36 
       
    37 #define __ masm->
       
    38 
       
    39 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
       
    40                                                             Register addr, Register count) {
       
    41   bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0;
       
    42   // With G1, don't generate the call if we statically know that the target in uninitialized
       
    43   if (!dest_uninitialized) {
       
    44     Register tmp = O5;
       
    45     assert_different_registers(addr, count, tmp);
       
    46     Label filtered;
       
    47     // Is marking active?
       
    48     if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
       
    49       __ ld(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp);
       
    50     } else {
       
    51       guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1,
       
    52                 "Assumption");
       
    53       __ ldsb(G2, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), tmp);
       
    54     }
       
    55     // Is marking active?
       
    56     __ cmp_and_br_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
       
    57 
       
    58     __ save_frame(0);
       
    59     // Save the necessary global regs... will be used after.
       
    60     if (addr->is_global()) {
       
    61       __ mov(addr, L0);
       
    62     }
       
    63     if (count->is_global()) {
       
    64       __ mov(count, L1);
       
    65     }
       
    66     __ mov(addr->after_save(), O0);
       
    67     // Get the count into O1
       
    68     address slowpath = UseCompressedOops ? CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry)
       
    69                                          : CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry);
       
    70     __ call(slowpath);
       
    71     __ delayed()->mov(count->after_save(), O1);
       
    72     if (addr->is_global()) {
       
    73       __ mov(L0, addr);
       
    74     }
       
    75     if (count->is_global()) {
       
    76       __ mov(L1, count);
       
    77     }
       
    78     __ restore();
       
    79 
       
    80     __ bind(filtered);
       
    81     DEBUG_ONLY(__ set(0xDEADC0DE, tmp);) // we have killed tmp
       
    82   }
       
    83 }
       
    84 
       
    85 void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
       
    86                                                              Register addr, Register count, Register tmp) {
       
    87   // Get some new fresh output registers.
       
    88   __ save_frame(0);
       
    89   __ mov(addr->after_save(), O0);
       
    90   __ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry));
       
    91   __ delayed()->mov(count->after_save(), O1);
       
    92   __ restore();
       
    93 }