1 /*
   2  * Copyright (c) 2018, 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_X86_GC_Z_ZBARRIERSETASSEMBLER_X86_HPP
  25 #define CPU_X86_GC_Z_ZBARRIERSETASSEMBLER_X86_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 src,
  57                         Register tmp1,
  58                         Register tmp2);
  59 #endif // ASSERT
  60 
  61   virtual void arraycopy_prologue(MacroAssembler* masm,
  62                                   DecoratorSet decorators,
  63                                   BasicType type,
  64                                   Register src,
  65                                   Register dst,
  66                                   Register count);
  67 
  68   virtual void try_resolve_jobject_in_native(MacroAssembler* masm,
  69                                              Register jni_env,
  70                                              Register obj,
  71                                              Register tmp,
  72                                              Label& slowpath);
  73 
  74 #ifdef COMPILER1
  75   void generate_c1_load_barrier_test(LIR_Assembler* ce,
  76                                      LIR_Opr ref) const;
  77 
  78   void generate_c1_load_barrier_stub(LIR_Assembler* ce,
  79                                      ZLoadBarrierStubC1* stub) const;
  80 
  81   void generate_c1_load_barrier_runtime_stub(StubAssembler* sasm,
  82                                              DecoratorSet decorators) const;
  83 #endif // COMPILER1
  84 
  85   virtual void barrier_stubs_init();
  86 
  87   address load_barrier_slow_stub(Register reg);
  88   address load_barrier_weak_slow_stub(Register reg);
  89 };
  90 
  91 #endif // CPU_X86_GC_Z_ZBARRIERSETASSEMBLER_X86_HPP