1 /* 2 * Copyright (c) 2018, 2020, 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_SHARED_BARRIERSETASSEMBLER_RISCV_HPP 27 #define CPU_RISCV_GC_SHARED_BARRIERSETASSEMBLER_RISCV_HPP 28 29 #include "asm/macroAssembler.hpp" 30 #include "gc/shared/barrierSet.hpp" 31 #include "gc/shared/barrierSetNMethod.hpp" 32 #include "memory/allocation.hpp" 33 #include "oops/access.hpp" 34 35 class BarrierSetAssembler: public CHeapObj<mtGC> { 36 private: 37 void incr_allocated_bytes(MacroAssembler* masm, 38 Register var_size_in_bytes, int con_size_in_bytes, 39 Register t1 = noreg); 40 41 public: 42 virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop, 43 Register src, Register dst, Register count, RegSet saved_regs) {} 44 virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop, 45 Register start, Register end, Register tmp, RegSet saved_regs) {} 46 virtual void load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 47 Register dst, Address src, Register tmp1, Register tmp_thread); 48 virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 49 Address dst, Register val, Register tmp1, Register tmp2); 50 51 virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env, 52 Register obj, Register tmp, Label& slowpath); 53 54 virtual void tlab_allocate(MacroAssembler* masm, 55 Register obj, // result: pointer to object after successful allocation 56 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise 57 int con_size_in_bytes, // object size in bytes if known at compile time 58 Register tmp1, // temp register 59 Register tmp2, // temp register 60 Label& slow_case, // continuation point if fast allocation fails 61 bool is_far = false 62 ); 63 64 void eden_allocate(MacroAssembler* masm, 65 Register obj, // result: pointer to object after successful allocation 66 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise 67 int con_size_in_bytes, // object size in bytes if known at compile time 68 Register tmp1, // temp register 69 Label& slow_case, // continuation point if fast allocation fails 70 bool is_far = false 71 ); 72 virtual void barrier_stubs_init() {} 73 74 virtual void nmethod_entry_barrier(MacroAssembler* masm); 75 virtual void c2i_entry_barrier(MacroAssembler* masm); 76 virtual ~BarrierSetAssembler() {} 77 }; 78 79 #endif // CPU_RISCV_GC_SHARED_BARRIERSETASSEMBLER_RISCV_HPP