< prev index next >

src/share/vm/runtime/icache.hpp

Print this page
rev 11647 : 8161258: Simplify including platform files.
Summary: Include patform files with macros cpu_header() etc. Do various cleanups of macro usages. Remove _64/_32 from adlc generated files and platform .hpp files. Merge stubRoutines_x86*.hpp. Remove empty mutex_<os>* files.
Reviewed-by: dholmes, coleenp, kbarrett
   1 /*
   2  * Copyright (c) 1997, 2011, 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 
  25 #ifndef SHARE_VM_RUNTIME_ICACHE_HPP
  26 #define SHARE_VM_RUNTIME_ICACHE_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/stubCodeGenerator.hpp"

  30 
  31 // Interface for updating the instruction cache.  Whenever the VM modifies
  32 // code, part of the processor instruction cache potentially has to be flushed.
  33 
  34 // Default implementation is in icache.cpp, and can be hidden per-platform.
  35 // Most platforms must provide only ICacheStubGenerator::generate_icache_flush().
  36 // Platforms that don't require icache flushing can just nullify the public
  37 // members of AbstractICache in their ICache class.  AbstractICache should never
  38 // be referenced other than by deriving the ICache class from it.
  39 //
  40 // The code for the ICache class and for generate_icache_flush() must be in
  41 // architecture-specific files, i.e., icache_<arch>.hpp/.cpp
  42 
  43 class AbstractICache : AllStatic {
  44  public:
  45   // The flush stub signature
  46   typedef int (*flush_icache_stub_t)(address addr, int lines, int magic);
  47 
  48  protected:
  49   // The flush stub function address


  51 
  52   // Call the flush stub
  53   static void call_flush_stub(address start, int lines);
  54 
  55  public:
  56   enum {
  57     stub_size      = 0, // Size of the icache flush stub in bytes
  58     line_size      = 0, // Icache line size in bytes
  59     log2_line_size = 0  // log2(line_size)
  60   };
  61 
  62   static void initialize();
  63   static void invalidate_word(address addr);
  64   static void invalidate_range(address start, int nbytes);
  65 };
  66 
  67 
  68 // Must be included before the definition of ICacheStubGenerator
  69 // because ICacheStubGenerator uses ICache definitions.
  70 
  71 #ifdef TARGET_ARCH_x86
  72 # include "icache_x86.hpp"
  73 #endif
  74 #ifdef TARGET_ARCH_sparc
  75 # include "icache_sparc.hpp"
  76 #endif
  77 #ifdef TARGET_ARCH_zero
  78 # include "icache_zero.hpp"
  79 #endif
  80 #ifdef TARGET_ARCH_arm
  81 # include "icache_arm.hpp"
  82 #endif
  83 #ifdef TARGET_ARCH_ppc
  84 # include "icache_ppc.hpp"
  85 #endif
  86 #ifdef TARGET_ARCH_aarch64
  87 # include "icache_aarch64.hpp"
  88 #endif
  89 
  90 
  91 
  92 class ICacheStubGenerator : public StubCodeGenerator {
  93  public:
  94   ICacheStubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {}
  95 
  96   // Generate the icache flush stub.
  97   //
  98   // Since we cannot flush the cache when this stub is generated,
  99   // it must be generated first, and just to be sure, we do extra
 100   // work to allow a check that these instructions got executed.
 101   //
 102   // The flush stub has three parameters (see flush_icache_stub_t).
 103   //
 104   //   addr  - Start address, must be aligned at log2_line_size
 105   //   lines - Number of line_size icache lines to flush
 106   //   magic - Magic number copied to result register to make sure
 107   //           the stub executed properly
 108   //
 109   // A template for generate_icache_flush is
 110   //


   1 /*
   2  * Copyright (c) 1997, 2016, 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 
  25 #ifndef SHARE_VM_RUNTIME_ICACHE_HPP
  26 #define SHARE_VM_RUNTIME_ICACHE_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/stubCodeGenerator.hpp"
  30 #include "utilities/macros.hpp"
  31 
  32 // Interface for updating the instruction cache.  Whenever the VM modifies
  33 // code, part of the processor instruction cache potentially has to be flushed.
  34 
  35 // Default implementation is in icache.cpp, and can be hidden per-platform.
  36 // Most platforms must provide only ICacheStubGenerator::generate_icache_flush().
  37 // Platforms that don't require icache flushing can just nullify the public
  38 // members of AbstractICache in their ICache class.  AbstractICache should never
  39 // be referenced other than by deriving the ICache class from it.
  40 //
  41 // The code for the ICache class and for generate_icache_flush() must be in
  42 // architecture-specific files, i.e., icache_<arch>.hpp/.cpp
  43 
  44 class AbstractICache : AllStatic {
  45  public:
  46   // The flush stub signature
  47   typedef int (*flush_icache_stub_t)(address addr, int lines, int magic);
  48 
  49  protected:
  50   // The flush stub function address


  52 
  53   // Call the flush stub
  54   static void call_flush_stub(address start, int lines);
  55 
  56  public:
  57   enum {
  58     stub_size      = 0, // Size of the icache flush stub in bytes
  59     line_size      = 0, // Icache line size in bytes
  60     log2_line_size = 0  // log2(line_size)
  61   };
  62 
  63   static void initialize();
  64   static void invalidate_word(address addr);
  65   static void invalidate_range(address start, int nbytes);
  66 };
  67 
  68 
  69 // Must be included before the definition of ICacheStubGenerator
  70 // because ICacheStubGenerator uses ICache definitions.
  71 
  72 #include CPU_HEADER(icache)



















  73 
  74 class ICacheStubGenerator : public StubCodeGenerator {
  75  public:
  76   ICacheStubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {}
  77 
  78   // Generate the icache flush stub.
  79   //
  80   // Since we cannot flush the cache when this stub is generated,
  81   // it must be generated first, and just to be sure, we do extra
  82   // work to allow a check that these instructions got executed.
  83   //
  84   // The flush stub has three parameters (see flush_icache_stub_t).
  85   //
  86   //   addr  - Start address, must be aligned at log2_line_size
  87   //   lines - Number of line_size icache lines to flush
  88   //   magic - Magic number copied to result register to make sure
  89   //           the stub executed properly
  90   //
  91   // A template for generate_icache_flush is
  92   //


< prev index next >