< prev index next >

src/hotspot/share/opto/compile.hpp

Print this page

 164 
 165   int  clone_idx() const                         { return _clone_idx; }
 166   void set_clone_idx(int x)                      { _clone_idx = x; }
 167   bool is_debug()                 const          { return _debug; }
 168   void set_debug(bool debug)                     { _debug = debug; }
 169 
 170   bool same_idx(node_idx_t k1, node_idx_t k2)  const { return idx(k1) == idx(k2); }
 171   bool same_gen(node_idx_t k1, node_idx_t k2)  const { return gen(k1) == gen(k2); }
 172 };
 173 
 174 class Options {
 175   friend class Compile;
 176   friend class VMStructs;
 177  private:
 178   const bool _subsume_loads;         // Load can be matched as part of a larger op.
 179   const bool _do_escape_analysis;    // Do escape analysis.
 180   const bool _do_iterative_escape_analysis;  // Do iterative escape analysis.
 181   const bool _do_reduce_allocation_merges;  // Do try to reduce allocation merges.
 182   const bool _eliminate_boxing;      // Do boxing elimination.
 183   const bool _do_locks_coarsening;   // Do locks coarsening

 184   const bool _do_superword;          // Do SuperWord
 185   const bool _install_code;          // Install the code that was compiled
 186  public:
 187   Options(bool subsume_loads,
 188           bool do_escape_analysis,
 189           bool do_iterative_escape_analysis,
 190           bool do_reduce_allocation_merges,
 191           bool eliminate_boxing,
 192           bool do_locks_coarsening,
 193           bool do_superword,

 194           bool install_code) :
 195           _subsume_loads(subsume_loads),
 196           _do_escape_analysis(do_escape_analysis),
 197           _do_iterative_escape_analysis(do_iterative_escape_analysis),
 198           _do_reduce_allocation_merges(do_reduce_allocation_merges),
 199           _eliminate_boxing(eliminate_boxing),
 200           _do_locks_coarsening(do_locks_coarsening),

 201           _do_superword(do_superword),
 202           _install_code(install_code) {
 203   }
 204 
 205   static Options for_runtime_stub() {
 206     return Options(
 207        /* subsume_loads = */ true,
 208        /* do_escape_analysis = */ false,
 209        /* do_iterative_escape_analysis = */ false,
 210        /* do_reduce_allocation_merges = */ false,
 211        /* eliminate_boxing = */ false,
 212        /* do_lock_coarsening = */ false,

 213        /* do_superword = */ true,
 214        /* install_code = */ true
 215     );
 216   }
 217 };
 218 
 219 //------------------------------Compile----------------------------------------
 220 // This class defines a top-level Compiler invocation.
 221 
 222 class Compile : public Phase {
 223   friend class VMStructs;
 224 
 225  public:
 226   // Fixed alias indexes.  (See also MergeMemNode.)
 227   enum {
 228     AliasIdxTop = 1,  // pseudo-index, aliases to nothing (used as sentinel value)
 229     AliasIdxBot = 2,  // pseudo-index, aliases to everything
 230     AliasIdxRaw = 3   // hard-wired index for TypeRawPtr::BOTTOM
 231   };
 232 

 336   bool                  _do_inlining;           // True if we intend to do inlining
 337   bool                  _do_scheduling;         // True if we intend to do scheduling
 338   bool                  _do_freq_based_layout;  // True if we intend to do frequency based block layout
 339   bool                  _do_vector_loop;        // True if allowed to execute loop in parallel iterations
 340   bool                  _use_cmove;             // True if CMove should be used without profitability analysis
 341   bool                  _do_aliasing;           // True if we intend to do aliasing
 342   bool                  _print_assembly;        // True if we should dump assembly code for this compilation
 343   bool                  _print_inlining;        // True if we should print inlining for this compilation
 344   bool                  _print_intrinsics;      // True if we should print intrinsics for this compilation
 345 #ifndef PRODUCT
 346   uint                  _igv_idx;               // Counter for IGV node identifiers
 347   uint                  _igv_phase_iter[PHASE_NUM_TYPES]; // Counters for IGV phase iterations
 348   bool                  _trace_opto_output;
 349   bool                  _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
 350 #endif
 351   bool                  _has_irreducible_loop;  // Found irreducible loops
 352   // JSR 292
 353   bool                  _has_method_handle_invokes; // True if this method has MethodHandle invokes.
 354   bool                  _has_monitors;          // Metadata transfered to nmethod to enable Continuations lock-detection fastpath
 355   bool                  _clinit_barrier_on_entry; // True if clinit barrier is needed on nmethod entry

 356   RTMState              _rtm_state;             // State of Restricted Transactional Memory usage
 357   int                   _loop_opts_cnt;         // loop opts round
 358   uint                  _stress_seed;           // Seed for stress testing
 359 
 360   // Compilation environment.
 361   Arena                 _comp_arena;            // Arena with lifetime equivalent to Compile
 362   void*                 _barrier_set_state;     // Potential GC barrier state for Compile
 363   ciEnv*                _env;                   // CI interface
 364   DirectiveSet*         _directive;             // Compiler directive
 365   CompileLog*           _log;                   // from CompilerThread
 366   const char*           _failure_reason;        // for record_failure/failing pattern
 367   CompilationFailureInfo* _first_failure_details; // Details for the first failure happening during compilation
 368   GrowableArray<CallGenerator*> _intrinsics;    // List of intrinsics.
 369   GrowableArray<Node*>  _macro_nodes;           // List of nodes which need to be expanded before matching.
 370   GrowableArray<ParsePredicateNode*> _parse_predicates; // List of Parse Predicates.
 371   GrowableArray<Node*>  _template_assertion_predicate_opaqs; // List of Opaque4 nodes for Template Assertion Predicates.
 372   GrowableArray<Node*>  _expensive_nodes;       // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
 373   GrowableArray<Node*>  _for_post_loop_igvn;    // List of nodes for IGVN after loop opts are over
 374   GrowableArray<UnstableIfTrap*> _unstable_if_traps;        // List of ifnodes after IGVN
 375   GrowableArray<Node_List*> _coarsened_locks;   // List of coarsened Lock and Unlock nodes

 578   int               compile_id() const          { return _compile_id; }
 579   DirectiveSet*     directive() const           { return _directive; }
 580 
 581   // Does this compilation allow instructions to subsume loads?  User
 582   // instructions that subsume a load may result in an unschedulable
 583   // instruction sequence.
 584   bool              subsume_loads() const       { return _options._subsume_loads; }
 585   /** Do escape analysis. */
 586   bool              do_escape_analysis() const  { return _options._do_escape_analysis; }
 587   bool              do_iterative_escape_analysis() const  { return _options._do_iterative_escape_analysis; }
 588   bool              do_reduce_allocation_merges() const  { return _options._do_reduce_allocation_merges; }
 589   /** Do boxing elimination. */
 590   bool              eliminate_boxing() const    { return _options._eliminate_boxing; }
 591   /** Do aggressive boxing elimination. */
 592   bool              aggressive_unboxing() const { return _options._eliminate_boxing && AggressiveUnboxing; }
 593   bool              should_install_code() const { return _options._install_code; }
 594   /** Do locks coarsening. */
 595   bool              do_locks_coarsening() const { return _options._do_locks_coarsening; }
 596   bool              do_superword() const        { return _options._do_superword; }
 597 



 598   // Other fixed compilation parameters.
 599   ciMethod*         method() const              { return _method; }
 600   int               entry_bci() const           { return _entry_bci; }
 601   bool              is_osr_compilation() const  { return _entry_bci != InvocationEntryBci; }
 602   bool              is_method_compilation() const { return (_method != nullptr && !_method->flags().is_native()); }
 603   const TypeFunc*   tf() const                  { assert(_tf!=nullptr, ""); return _tf; }
 604   void         init_tf(const TypeFunc* tf)      { assert(_tf==nullptr, ""); _tf = tf; }
 605   InlineTree*       ilt() const                 { return _ilt; }
 606   address           stub_function() const       { return _stub_function; }
 607   const char*       stub_name() const           { return _stub_name; }
 608   address           stub_entry_point() const    { return _stub_entry_point; }
 609   void          set_stub_entry_point(address z) { _stub_entry_point = z; }
 610 
 611   // Control of this compilation.
 612   int               fixed_slots() const         { assert(_fixed_slots >= 0, "");         return _fixed_slots; }
 613   void          set_fixed_slots(int n)          { _fixed_slots = n; }
 614   int               major_progress() const      { return _major_progress; }
 615   void          set_inlining_progress(bool z)   { _inlining_progress = z; }
 616   int               inlining_progress() const   { return _inlining_progress; }
 617   void          set_inlining_incrementally(bool z) { _inlining_incrementally = z; }

 658   void          set_do_vector_loop(bool z)      { _do_vector_loop = z; }
 659   bool              use_cmove() const           { return _use_cmove; }
 660   void          set_use_cmove(bool z)           { _use_cmove = z; }
 661   bool              do_aliasing() const          { return _do_aliasing; }
 662   bool              print_assembly() const       { return _print_assembly; }
 663   void          set_print_assembly(bool z)       { _print_assembly = z; }
 664   bool              print_inlining() const       { return _print_inlining; }
 665   void          set_print_inlining(bool z)       { _print_inlining = z; }
 666   bool              print_intrinsics() const     { return _print_intrinsics; }
 667   void          set_print_intrinsics(bool z)     { _print_intrinsics = z; }
 668   RTMState          rtm_state()  const           { return _rtm_state; }
 669   void          set_rtm_state(RTMState s)        { _rtm_state = s; }
 670   bool              use_rtm() const              { return (_rtm_state & NoRTM) == 0; }
 671   bool          profile_rtm() const              { return _rtm_state == ProfileRTM; }
 672   uint              max_node_limit() const       { return (uint)_max_node_limit; }
 673   void          set_max_node_limit(uint n)       { _max_node_limit = n; }
 674   bool              clinit_barrier_on_entry()       { return _clinit_barrier_on_entry; }
 675   void          set_clinit_barrier_on_entry(bool z) { _clinit_barrier_on_entry = z; }
 676   bool              has_monitors() const         { return _has_monitors; }
 677   void          set_has_monitors(bool v)         { _has_monitors = v; }


 678 
 679   // check the CompilerOracle for special behaviours for this compile
 680   bool          method_has_option(enum CompileCommand option) {
 681     return method() != nullptr && method()->has_option(option);
 682   }
 683 
 684 #ifndef PRODUCT
 685   uint          next_igv_idx()                  { return _igv_idx++; }
 686   bool          trace_opto_output() const       { return _trace_opto_output; }
 687   void          print_ideal_ir(const char* phase_name);
 688   bool          should_print_ideal() const      { return _directive->PrintIdealOption; }
 689   bool              parsed_irreducible_loop() const { return _parsed_irreducible_loop; }
 690   void          set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; }
 691   int _in_dump_cnt;  // Required for dumping ir nodes.
 692 #endif
 693   bool              has_irreducible_loop() const { return _has_irreducible_loop; }
 694   void          set_has_irreducible_loop(bool z) { _has_irreducible_loop = z; }
 695 
 696   // JSR 292
 697   bool              has_method_handle_invokes() const { return _has_method_handle_invokes;     }

 164 
 165   int  clone_idx() const                         { return _clone_idx; }
 166   void set_clone_idx(int x)                      { _clone_idx = x; }
 167   bool is_debug()                 const          { return _debug; }
 168   void set_debug(bool debug)                     { _debug = debug; }
 169 
 170   bool same_idx(node_idx_t k1, node_idx_t k2)  const { return idx(k1) == idx(k2); }
 171   bool same_gen(node_idx_t k1, node_idx_t k2)  const { return gen(k1) == gen(k2); }
 172 };
 173 
 174 class Options {
 175   friend class Compile;
 176   friend class VMStructs;
 177  private:
 178   const bool _subsume_loads;         // Load can be matched as part of a larger op.
 179   const bool _do_escape_analysis;    // Do escape analysis.
 180   const bool _do_iterative_escape_analysis;  // Do iterative escape analysis.
 181   const bool _do_reduce_allocation_merges;  // Do try to reduce allocation merges.
 182   const bool _eliminate_boxing;      // Do boxing elimination.
 183   const bool _do_locks_coarsening;   // Do locks coarsening
 184   const bool _for_preload;           // Generate code for preload (before Java method execution), do class init barriers
 185   const bool _do_superword;          // Do SuperWord
 186   const bool _install_code;          // Install the code that was compiled
 187  public:
 188   Options(bool subsume_loads,
 189           bool do_escape_analysis,
 190           bool do_iterative_escape_analysis,
 191           bool do_reduce_allocation_merges,
 192           bool eliminate_boxing,
 193           bool do_locks_coarsening,
 194           bool do_superword,
 195           bool for_preload,
 196           bool install_code) :
 197           _subsume_loads(subsume_loads),
 198           _do_escape_analysis(do_escape_analysis),
 199           _do_iterative_escape_analysis(do_iterative_escape_analysis),
 200           _do_reduce_allocation_merges(do_reduce_allocation_merges),
 201           _eliminate_boxing(eliminate_boxing),
 202           _do_locks_coarsening(do_locks_coarsening),
 203           _for_preload(for_preload),
 204           _do_superword(do_superword),
 205           _install_code(install_code) {
 206   }
 207 
 208   static Options for_runtime_stub() {
 209     return Options(
 210        /* subsume_loads = */ true,
 211        /* do_escape_analysis = */ false,
 212        /* do_iterative_escape_analysis = */ false,
 213        /* do_reduce_allocation_merges = */ false,
 214        /* eliminate_boxing = */ false,
 215        /* do_lock_coarsening = */ false,
 216        /* for_preload = */ false,
 217        /* do_superword = */ true,
 218        /* install_code = */ true
 219     );
 220   }
 221 };
 222 
 223 //------------------------------Compile----------------------------------------
 224 // This class defines a top-level Compiler invocation.
 225 
 226 class Compile : public Phase {
 227   friend class VMStructs;
 228 
 229  public:
 230   // Fixed alias indexes.  (See also MergeMemNode.)
 231   enum {
 232     AliasIdxTop = 1,  // pseudo-index, aliases to nothing (used as sentinel value)
 233     AliasIdxBot = 2,  // pseudo-index, aliases to everything
 234     AliasIdxRaw = 3   // hard-wired index for TypeRawPtr::BOTTOM
 235   };
 236 

 340   bool                  _do_inlining;           // True if we intend to do inlining
 341   bool                  _do_scheduling;         // True if we intend to do scheduling
 342   bool                  _do_freq_based_layout;  // True if we intend to do frequency based block layout
 343   bool                  _do_vector_loop;        // True if allowed to execute loop in parallel iterations
 344   bool                  _use_cmove;             // True if CMove should be used without profitability analysis
 345   bool                  _do_aliasing;           // True if we intend to do aliasing
 346   bool                  _print_assembly;        // True if we should dump assembly code for this compilation
 347   bool                  _print_inlining;        // True if we should print inlining for this compilation
 348   bool                  _print_intrinsics;      // True if we should print intrinsics for this compilation
 349 #ifndef PRODUCT
 350   uint                  _igv_idx;               // Counter for IGV node identifiers
 351   uint                  _igv_phase_iter[PHASE_NUM_TYPES]; // Counters for IGV phase iterations
 352   bool                  _trace_opto_output;
 353   bool                  _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
 354 #endif
 355   bool                  _has_irreducible_loop;  // Found irreducible loops
 356   // JSR 292
 357   bool                  _has_method_handle_invokes; // True if this method has MethodHandle invokes.
 358   bool                  _has_monitors;          // Metadata transfered to nmethod to enable Continuations lock-detection fastpath
 359   bool                  _clinit_barrier_on_entry; // True if clinit barrier is needed on nmethod entry
 360   bool                  _has_clinit_barriers;   // True if compiled code has clinit barriers
 361   RTMState              _rtm_state;             // State of Restricted Transactional Memory usage
 362   int                   _loop_opts_cnt;         // loop opts round
 363   uint                  _stress_seed;           // Seed for stress testing
 364 
 365   // Compilation environment.
 366   Arena                 _comp_arena;            // Arena with lifetime equivalent to Compile
 367   void*                 _barrier_set_state;     // Potential GC barrier state for Compile
 368   ciEnv*                _env;                   // CI interface
 369   DirectiveSet*         _directive;             // Compiler directive
 370   CompileLog*           _log;                   // from CompilerThread
 371   const char*           _failure_reason;        // for record_failure/failing pattern
 372   CompilationFailureInfo* _first_failure_details; // Details for the first failure happening during compilation
 373   GrowableArray<CallGenerator*> _intrinsics;    // List of intrinsics.
 374   GrowableArray<Node*>  _macro_nodes;           // List of nodes which need to be expanded before matching.
 375   GrowableArray<ParsePredicateNode*> _parse_predicates; // List of Parse Predicates.
 376   GrowableArray<Node*>  _template_assertion_predicate_opaqs; // List of Opaque4 nodes for Template Assertion Predicates.
 377   GrowableArray<Node*>  _expensive_nodes;       // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
 378   GrowableArray<Node*>  _for_post_loop_igvn;    // List of nodes for IGVN after loop opts are over
 379   GrowableArray<UnstableIfTrap*> _unstable_if_traps;        // List of ifnodes after IGVN
 380   GrowableArray<Node_List*> _coarsened_locks;   // List of coarsened Lock and Unlock nodes

 583   int               compile_id() const          { return _compile_id; }
 584   DirectiveSet*     directive() const           { return _directive; }
 585 
 586   // Does this compilation allow instructions to subsume loads?  User
 587   // instructions that subsume a load may result in an unschedulable
 588   // instruction sequence.
 589   bool              subsume_loads() const       { return _options._subsume_loads; }
 590   /** Do escape analysis. */
 591   bool              do_escape_analysis() const  { return _options._do_escape_analysis; }
 592   bool              do_iterative_escape_analysis() const  { return _options._do_iterative_escape_analysis; }
 593   bool              do_reduce_allocation_merges() const  { return _options._do_reduce_allocation_merges; }
 594   /** Do boxing elimination. */
 595   bool              eliminate_boxing() const    { return _options._eliminate_boxing; }
 596   /** Do aggressive boxing elimination. */
 597   bool              aggressive_unboxing() const { return _options._eliminate_boxing && AggressiveUnboxing; }
 598   bool              should_install_code() const { return _options._install_code; }
 599   /** Do locks coarsening. */
 600   bool              do_locks_coarsening() const { return _options._do_locks_coarsening; }
 601   bool              do_superword() const        { return _options._do_superword; }
 602 
 603   bool              do_clinit_barriers()  const { return _options._for_preload; }
 604   bool              for_preload()         const { return _options._for_preload; }
 605 
 606   // Other fixed compilation parameters.
 607   ciMethod*         method() const              { return _method; }
 608   int               entry_bci() const           { return _entry_bci; }
 609   bool              is_osr_compilation() const  { return _entry_bci != InvocationEntryBci; }
 610   bool              is_method_compilation() const { return (_method != nullptr && !_method->flags().is_native()); }
 611   const TypeFunc*   tf() const                  { assert(_tf!=nullptr, ""); return _tf; }
 612   void         init_tf(const TypeFunc* tf)      { assert(_tf==nullptr, ""); _tf = tf; }
 613   InlineTree*       ilt() const                 { return _ilt; }
 614   address           stub_function() const       { return _stub_function; }
 615   const char*       stub_name() const           { return _stub_name; }
 616   address           stub_entry_point() const    { return _stub_entry_point; }
 617   void          set_stub_entry_point(address z) { _stub_entry_point = z; }
 618 
 619   // Control of this compilation.
 620   int               fixed_slots() const         { assert(_fixed_slots >= 0, "");         return _fixed_slots; }
 621   void          set_fixed_slots(int n)          { _fixed_slots = n; }
 622   int               major_progress() const      { return _major_progress; }
 623   void          set_inlining_progress(bool z)   { _inlining_progress = z; }
 624   int               inlining_progress() const   { return _inlining_progress; }
 625   void          set_inlining_incrementally(bool z) { _inlining_incrementally = z; }

 666   void          set_do_vector_loop(bool z)      { _do_vector_loop = z; }
 667   bool              use_cmove() const           { return _use_cmove; }
 668   void          set_use_cmove(bool z)           { _use_cmove = z; }
 669   bool              do_aliasing() const          { return _do_aliasing; }
 670   bool              print_assembly() const       { return _print_assembly; }
 671   void          set_print_assembly(bool z)       { _print_assembly = z; }
 672   bool              print_inlining() const       { return _print_inlining; }
 673   void          set_print_inlining(bool z)       { _print_inlining = z; }
 674   bool              print_intrinsics() const     { return _print_intrinsics; }
 675   void          set_print_intrinsics(bool z)     { _print_intrinsics = z; }
 676   RTMState          rtm_state()  const           { return _rtm_state; }
 677   void          set_rtm_state(RTMState s)        { _rtm_state = s; }
 678   bool              use_rtm() const              { return (_rtm_state & NoRTM) == 0; }
 679   bool          profile_rtm() const              { return _rtm_state == ProfileRTM; }
 680   uint              max_node_limit() const       { return (uint)_max_node_limit; }
 681   void          set_max_node_limit(uint n)       { _max_node_limit = n; }
 682   bool              clinit_barrier_on_entry()       { return _clinit_barrier_on_entry; }
 683   void          set_clinit_barrier_on_entry(bool z) { _clinit_barrier_on_entry = z; }
 684   bool              has_monitors() const         { return _has_monitors; }
 685   void          set_has_monitors(bool v)         { _has_monitors = v; }
 686   bool              has_clinit_barriers()        { return _has_clinit_barriers; }
 687   void          set_has_clinit_barriers(bool z)  { _has_clinit_barriers = z; }
 688 
 689   // check the CompilerOracle for special behaviours for this compile
 690   bool          method_has_option(enum CompileCommand option) {
 691     return method() != nullptr && method()->has_option(option);
 692   }
 693 
 694 #ifndef PRODUCT
 695   uint          next_igv_idx()                  { return _igv_idx++; }
 696   bool          trace_opto_output() const       { return _trace_opto_output; }
 697   void          print_ideal_ir(const char* phase_name);
 698   bool          should_print_ideal() const      { return _directive->PrintIdealOption; }
 699   bool              parsed_irreducible_loop() const { return _parsed_irreducible_loop; }
 700   void          set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; }
 701   int _in_dump_cnt;  // Required for dumping ir nodes.
 702 #endif
 703   bool              has_irreducible_loop() const { return _has_irreducible_loop; }
 704   void          set_has_irreducible_loop(bool z) { _has_irreducible_loop = z; }
 705 
 706   // JSR 292
 707   bool              has_method_handle_invokes() const { return _has_method_handle_invokes;     }
< prev index next >