hotspot/src/share/vm/compiler/abstractCompiler.hpp
changeset 42040 70ec5a09a0d5
parent 33638 ef49ed90010b
equal deleted inserted replaced
42039:db627462f2c9 42040:70ec5a09a0d5
    24 
    24 
    25 #ifndef SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP
    25 #ifndef SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP
    26 #define SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP
    26 #define SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP
    27 
    27 
    28 #include "ci/compilerInterface.hpp"
    28 #include "ci/compilerInterface.hpp"
       
    29 #include "compiler/compilerDefinitions.hpp"
    29 #include "compiler/compilerDirectives.hpp"
    30 #include "compiler/compilerDirectives.hpp"
    30 
    31 
    31 typedef void (*initializer)(void);
    32 typedef void (*initializer)(void);
    32 
    33 
    33 #if INCLUDE_JVMCI
    34 #if INCLUDE_JVMCI
    80 
    81 
    81   // This method returns true for the first compiler thread that reaches that methods.
    82   // This method returns true for the first compiler thread that reaches that methods.
    82   // This thread will initialize the compiler runtime.
    83   // This thread will initialize the compiler runtime.
    83   bool should_perform_init();
    84   bool should_perform_init();
    84 
    85 
    85   // The (closed set) of concrete compiler classes.
       
    86   enum Type {
       
    87     none,
       
    88     c1,
       
    89     c2,
       
    90     jvmci,
       
    91     shark
       
    92   };
       
    93 
       
    94  private:
    86  private:
    95   Type _type;
    87   const CompilerType _type;
    96 
    88 
    97 #if INCLUDE_JVMCI
    89 #if INCLUDE_JVMCI
    98   CompilerStatistics _stats;
    90   CompilerStatistics _stats;
    99 #endif
    91 #endif
   100 
    92 
   101  public:
    93  public:
   102   AbstractCompiler(Type type) : _type(type), _compiler_state(uninitialized), _num_compiler_threads(0) {}
    94   AbstractCompiler(CompilerType type) : _type(type), _compiler_state(uninitialized), _num_compiler_threads(0) {}
   103 
    95 
   104   // This function determines the compiler thread that will perform the
    96   // This function determines the compiler thread that will perform the
   105   // shutdown of the corresponding compiler runtime.
    97   // shutdown of the corresponding compiler runtime.
   106   bool should_perform_shutdown();
    98   bool should_perform_shutdown();
   107 
    99 
   155   virtual bool is_intrinsic_supported(const methodHandle& method) {
   147   virtual bool is_intrinsic_supported(const methodHandle& method) {
   156     return false;
   148     return false;
   157   }
   149   }
   158 
   150 
   159   // Compiler type queries.
   151   // Compiler type queries.
   160   bool is_c1()                                   { return _type == c1; }
   152   const bool is_c1()                             { return _type == compiler_c1; }
   161   bool is_c2()                                   { return _type == c2; }
   153   const bool is_c2()                             { return _type == compiler_c2; }
   162   bool is_jvmci()                                { return _type == jvmci; }
   154   const bool is_jvmci()                          { return _type == compiler_jvmci; }
   163   bool is_shark()                                { return _type == shark; }
   155   const bool is_shark()                          { return _type == compiler_shark; }
       
   156   const CompilerType type()                      { return _type; }
   164 
   157 
   165   // Extra tests to identify trivial methods for the tiered compilation policy.
   158   // Extra tests to identify trivial methods for the tiered compilation policy.
   166   virtual bool is_trivial(Method* method) { return false; }
   159   virtual bool is_trivial(Method* method) { return false; }
   167 
   160 
   168   // Customization
   161   // Customization