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 #ifdef COMPILER1
  28 class LIR_Assembler;
  29 class LIR_OprDesc;
  30 typedef LIR_OprDesc* LIR_Opr;
  31 class StubAssembler;
  32 class ZLoadBarrierStubC1;
  33 #endif // COMPILER1
  34 
  35 class ZBarrierSetAssembler : public ZBarrierSetAssemblerBase {
  36 private:
  37   address _load_barrier_slow_stub[RegisterImpl::number_of_registers];
  38   address _load_barrier_weak_slow_stub[RegisterImpl::number_of_registers];
  39 
  40 public:
  41   ZBarrierSetAssembler();
  42 
  43   virtual void load_at(MacroAssembler* masm,
  44                        DecoratorSet decorators,
  45                        BasicType type,
  46                        Register dst,
  47                        Address src,
  48                        Register tmp1,
  49                        Register tmp_thread);
  50 
  51 #ifdef ASSERT
  52   virtual void store_at(MacroAssembler* masm,
  53                         DecoratorSet decorators,
  54                         BasicType type,
  55                         Address dst,
  56                         Register val,
  57                         Register tmp1,
  58                         Register tmp2);
  59 #endif // ASSERT
  60 
  61   virtual void arraycopy_prologue(MacroAssembler* masm,
  62                                   DecoratorSet decorators,
  63                                   bool is_oop,
  64                                   Register src,
  65                                   Register dst,
  66                                   Register count,
  67                                   RegSet saved_regs);
  68 
  69   virtual void try_resolve_jobject_in_native(MacroAssembler* masm,
  70                                              Register jni_env,
  71                                              Register robj,
  72                                              Register tmp,
  73                                              Label& slowpath);
  74 
  75 #ifdef COMPILER1
  76   void generate_c1_load_barrier_test(LIR_Assembler* ce,
  77                                      LIR_Opr ref) const;
  78 
  79   void generate_c1_load_barrier_stub(LIR_Assembler* ce,
  80                                      ZLoadBarrierStubC1* stub) const;
  81 
  82   void generate_c1_load_barrier_runtime_stub(StubAssembler* sasm,
  83                                              DecoratorSet decorators) const;
  84 #endif // COMPILER1
  85 
  86   virtual void barrier_stubs_init();
  87 
  88   address load_barrier_slow_stub(Register reg);
  89   address load_barrier_weak_slow_stub(Register reg);
  90 };
  91 
  92 #endif // CPU_AARCH64_GC_Z_ZBARRIERSETASSEMBLER_AARCH64_HPP