1 /*
   2  * Copyright (c) 2018, 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   address _load_barrier_slow_stub[RegisterImpl::number_of_registers];
  37   address _load_barrier_weak_slow_stub[RegisterImpl::number_of_registers];
  38 
  39 public:
  40   ZBarrierSetAssembler() :
  41     _load_barrier_slow_stub(),
  42     _load_barrier_weak_slow_stub() {}
  43 
  44   address load_barrier_slow_stub(Register reg) { return _load_barrier_slow_stub[reg->encoding()]; }
  45   address load_barrier_weak_slow_stub(Register reg) { return _load_barrier_weak_slow_stub[reg->encoding()]; }
  46 
  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 src,
  61                         Register tmp1,
  62                         Register tmp2);
  63 #endif // ASSERT
  64 
  65   virtual void arraycopy_prologue(MacroAssembler* masm,
  66                                   DecoratorSet decorators,
  67                                   BasicType type,
  68                                   Register src,
  69                                   Register dst,
  70                                   Register count);
  71 
  72   virtual void try_resolve_jobject_in_native(MacroAssembler* masm,
  73                                              Register jni_env,
  74                                              Register obj,
  75                                              Register tmp,
  76                                              Label& slowpath);
  77 
  78 #ifdef COMPILER1
  79   void generate_c1_load_barrier_test(LIR_Assembler* ce,
  80                                      LIR_Opr ref) const;
  81 
  82   void generate_c1_load_barrier_stub(LIR_Assembler* ce,
  83                                      ZLoadBarrierStubC1* stub) const;
  84 
  85   void generate_c1_load_barrier_runtime_stub(StubAssembler* sasm,
  86                                              DecoratorSet decorators) const;
  87 #endif // COMPILER1
  88 
  89   virtual void barrier_stubs_init();
  90 };
  91 
  92 #endif // CPU_X86_GC_Z_ZBARRIERSETASSEMBLER_X86_HPP