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