src/share/vm/opto/runtime.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8031320_8u Sdiff src/share/vm/opto

src/share/vm/opto/runtime.hpp

Print this page
rev 5968 : 8031320: Use Intel RTM instructions for locks
Summary: Use RTM for inflated locks and stack locks.
Reviewed-by: iveresov, twisti, roland, dcubed


  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_OPTO_RUNTIME_HPP
  26 #define SHARE_VM_OPTO_RUNTIME_HPP
  27 
  28 #include "code/codeBlob.hpp"
  29 #include "opto/machnode.hpp"
  30 #include "opto/type.hpp"
  31 #include "runtime/biasedLocking.hpp"

  32 #include "runtime/deoptimization.hpp"
  33 #include "runtime/vframe.hpp"
  34 
  35 //------------------------------OptoRuntime------------------------------------
  36 // Opto compiler runtime routines
  37 //
  38 // These are all generated from Ideal graphs.  They are called with the
  39 // Java calling convention.  Internally they call C++.  They are made once at
  40 // startup time and Opto compiles calls to them later.
  41 // Things are broken up into quads: the signature they will be called with,
  42 // the address of the generated code, the corresponding C++ code and an
  43 // nmethod.
  44 
  45 // The signature (returned by "xxx_Type()") is used at startup time by the
  46 // Generator to make the generated code "xxx_Java".  Opto compiles calls
  47 // to the generated code "xxx_Java".  When the compiled code gets executed,
  48 // it calls the C++ code "xxx_C".  The generated nmethod is saved in the
  49 // CodeCache.  Exception handlers use the nmethod to get the callee-save
  50 // register OopMaps.
  51 class CallInfo;
  52 
  53 //
  54 // NamedCounters are tagged counters which can be used for profiling
  55 // code in various ways.  Currently they are used by the lock coarsening code
  56 //
  57 
  58 class NamedCounter : public CHeapObj<mtCompiler> {
  59 public:
  60     enum CounterTag {
  61     NoTag,
  62     LockCounter,
  63     EliminatedLockCounter,
  64     BiasedLockingCounter

  65   };
  66 
  67 private:
  68   const char *  _name;
  69   int           _count;
  70   CounterTag    _tag;
  71   NamedCounter* _next;
  72 
  73  public:
  74   NamedCounter(const char *n, CounterTag tag = NoTag):
  75     _name(n),
  76     _count(0),
  77     _next(NULL),
  78     _tag(tag) {}
  79 
  80   const char * name() const     { return _name; }
  81   int count() const             { return _count; }
  82   address addr()                { return (address)&_count; }
  83   CounterTag tag() const        { return _tag; }
  84   void set_tag(CounterTag tag)  { _tag = tag; }
  85 
  86   NamedCounter* next() const    { return _next; }
  87   void set_next(NamedCounter* next) {
  88     assert(_next == NULL, "already set");
  89     _next = next;
  90   }
  91 
  92 };
  93 
  94 class BiasedLockingNamedCounter : public NamedCounter {
  95  private:
  96   BiasedLockingCounters _counters;
  97 
  98  public:
  99   BiasedLockingNamedCounter(const char *n) :
 100     NamedCounter(n, BiasedLockingCounter), _counters() {}
 101 
 102   BiasedLockingCounters* counters() { return &_counters; }
 103 };
 104 












 105 typedef const TypeFunc*(*TypeFunc_generator)();
 106 
 107 class OptoRuntime : public AllStatic {
 108   friend class Matcher;  // allow access to stub names
 109 
 110  private:
 111   // define stubs
 112   static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char *name, int is_fancy_jump, bool pass_tls, bool save_arguments, bool return_pc);
 113 
 114   // References to generated stubs
 115   static address _new_instance_Java;
 116   static address _new_array_Java;
 117   static address _new_array_nozero_Java;
 118   static address _multianewarray2_Java;
 119   static address _multianewarray3_Java;
 120   static address _multianewarray4_Java;
 121   static address _multianewarray5_Java;
 122   static address _multianewarrayN_Java;
 123   static address _g1_wb_pre_Java;
 124   static address _g1_wb_post_Java;




  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_OPTO_RUNTIME_HPP
  26 #define SHARE_VM_OPTO_RUNTIME_HPP
  27 
  28 #include "code/codeBlob.hpp"
  29 #include "opto/machnode.hpp"
  30 #include "opto/type.hpp"
  31 #include "runtime/biasedLocking.hpp"
  32 #include "runtime/rtmLocking.hpp"
  33 #include "runtime/deoptimization.hpp"
  34 #include "runtime/vframe.hpp"
  35 
  36 //------------------------------OptoRuntime------------------------------------
  37 // Opto compiler runtime routines
  38 //
  39 // These are all generated from Ideal graphs.  They are called with the
  40 // Java calling convention.  Internally they call C++.  They are made once at
  41 // startup time and Opto compiles calls to them later.
  42 // Things are broken up into quads: the signature they will be called with,
  43 // the address of the generated code, the corresponding C++ code and an
  44 // nmethod.
  45 
  46 // The signature (returned by "xxx_Type()") is used at startup time by the
  47 // Generator to make the generated code "xxx_Java".  Opto compiles calls
  48 // to the generated code "xxx_Java".  When the compiled code gets executed,
  49 // it calls the C++ code "xxx_C".  The generated nmethod is saved in the
  50 // CodeCache.  Exception handlers use the nmethod to get the callee-save
  51 // register OopMaps.
  52 class CallInfo;
  53 
  54 //
  55 // NamedCounters are tagged counters which can be used for profiling
  56 // code in various ways.  Currently they are used by the lock coarsening code
  57 //
  58 
  59 class NamedCounter : public CHeapObj<mtCompiler> {
  60 public:
  61     enum CounterTag {
  62     NoTag,
  63     LockCounter,
  64     EliminatedLockCounter,
  65     BiasedLockingCounter,
  66     RTMLockingCounter
  67   };
  68 
  69 private:
  70   const char *  _name;
  71   int           _count;
  72   CounterTag    _tag;
  73   NamedCounter* _next;
  74 
  75  public:
  76   NamedCounter(const char *n, CounterTag tag = NoTag):
  77     _name(n),
  78     _count(0),
  79     _next(NULL),
  80     _tag(tag) {}
  81 
  82   const char * name() const     { return _name; }
  83   int count() const             { return _count; }
  84   address addr()                { return (address)&_count; }
  85   CounterTag tag() const        { return _tag; }
  86   void set_tag(CounterTag tag)  { _tag = tag; }
  87 
  88   NamedCounter* next() const    { return _next; }
  89   void set_next(NamedCounter* next) {
  90     assert(_next == NULL || next == NULL, "already set");
  91     _next = next;
  92   }
  93 
  94 };
  95 
  96 class BiasedLockingNamedCounter : public NamedCounter {
  97  private:
  98   BiasedLockingCounters _counters;
  99 
 100  public:
 101   BiasedLockingNamedCounter(const char *n) :
 102     NamedCounter(n, BiasedLockingCounter), _counters() {}
 103 
 104   BiasedLockingCounters* counters() { return &_counters; }
 105 };
 106 
 107 
 108 class RTMLockingNamedCounter : public NamedCounter {
 109  private:
 110  RTMLockingCounters _counters;
 111 
 112  public:
 113   RTMLockingNamedCounter(const char *n) :
 114     NamedCounter(n, RTMLockingCounter), _counters() {}
 115 
 116   RTMLockingCounters* counters() { return &_counters; }
 117 };
 118 
 119 typedef const TypeFunc*(*TypeFunc_generator)();
 120 
 121 class OptoRuntime : public AllStatic {
 122   friend class Matcher;  // allow access to stub names
 123 
 124  private:
 125   // define stubs
 126   static address generate_stub(ciEnv* ci_env, TypeFunc_generator gen, address C_function, const char *name, int is_fancy_jump, bool pass_tls, bool save_arguments, bool return_pc);
 127 
 128   // References to generated stubs
 129   static address _new_instance_Java;
 130   static address _new_array_Java;
 131   static address _new_array_nozero_Java;
 132   static address _multianewarray2_Java;
 133   static address _multianewarray3_Java;
 134   static address _multianewarray4_Java;
 135   static address _multianewarray5_Java;
 136   static address _multianewarrayN_Java;
 137   static address _g1_wb_pre_Java;
 138   static address _g1_wb_post_Java;


src/share/vm/opto/runtime.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File