1 /*
  2  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. 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  *
 24  */
 25 
 26 #ifndef CPU_RISCV_GC_Z_ZBARRIERSETASSEMBLER_RISCV_HPP
 27 #define CPU_RISCV_GC_Z_ZBARRIERSETASSEMBLER_RISCV_HPP
 28 
 29 #include "code/vmreg.hpp"
 30 #include "oops/accessDecorators.hpp"
 31 #ifdef COMPILER2
 32 #include "opto/optoreg.hpp"
 33 #endif // COMPILER2
 34 
 35 #ifdef COMPILER1
 36 class LIR_Assembler;
 37 class LIR_OprDesc;
 38 typedef LIR_OprDesc* LIR_Opr;
 39 class StubAssembler;
 40 class ZLoadBarrierStubC1;
 41 #endif // COMPILER1
 42 
 43 #ifdef COMPILER2
 44 class Node;
 45 class ZLoadBarrierStubC2;
 46 #endif // COMPILER2
 47 
 48 class ZBarrierSetAssembler : public ZBarrierSetAssemblerBase {
 49 public:
 50   virtual void load_at(MacroAssembler* masm,
 51                        DecoratorSet decorators,
 52                        BasicType type,
 53                        Register dst,
 54                        Address src,
 55                        Register tmp1,
 56                        Register tmp_thread);
 57 
 58 #ifdef ASSERT
 59   virtual void store_at(MacroAssembler* masm,
 60                         DecoratorSet decorators,
 61                         BasicType type,
 62                         Address dst,
 63                         Register val,
 64                         Register tmp1,
 65                         Register tmp2);
 66 #endif // ASSERT
 67 
 68   virtual void arraycopy_prologue(MacroAssembler* masm,
 69                                   DecoratorSet decorators,
 70                                   bool is_oop,
 71                                   Register src,
 72                                   Register dst,
 73                                   Register count,
 74                                   RegSet saved_regs);
 75 
 76   virtual void try_resolve_jobject_in_native(MacroAssembler* masm,
 77                                              Register jni_env,
 78                                              Register robj,
 79                                              Register tmp,
 80                                              Label& slowpath);
 81 
 82 #ifdef COMPILER1
 83   void generate_c1_load_barrier_test(LIR_Assembler* ce,
 84                                      LIR_Opr ref) const;
 85 
 86   void generate_c1_load_barrier_stub(LIR_Assembler* ce,
 87                                      ZLoadBarrierStubC1* stub) const;
 88 
 89   void generate_c1_load_barrier_runtime_stub(StubAssembler* sasm,
 90                                              DecoratorSet decorators) const;
 91 #endif // COMPILER1
 92 
 93 #ifdef COMPILER2
 94   OptoReg::Name refine_register(const Node* node,
 95                                 OptoReg::Name opto_reg);
 96 
 97   void generate_c2_load_barrier_stub(MacroAssembler* masm,
 98                                      ZLoadBarrierStubC2* stub) const;
 99 #endif // COMPILER2
100 };
101 
102 #endif // CPU_RISCV_GC_Z_ZBARRIERSETASSEMBLER_RISCV_HPP