< prev index next >

src/hotspot/share/opto/compile.hpp

Print this page

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

 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 install_code) :
 196           _subsume_loads(subsume_loads),
 197           _do_escape_analysis(do_escape_analysis),
 198           _do_iterative_escape_analysis(do_iterative_escape_analysis),
 199           _do_reduce_allocation_merges(do_reduce_allocation_merges),
 200           _eliminate_boxing(eliminate_boxing),
 201           _do_locks_coarsening(do_locks_coarsening),

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

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

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

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

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



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

 655   void          set_do_scheduling(bool z)       { _do_scheduling = z; }
 656   bool              do_freq_based_layout() const{ return _do_freq_based_layout; }
 657   void          set_do_freq_based_layout(bool z){ _do_freq_based_layout = z; }
 658   bool              do_vector_loop() const      { return _do_vector_loop; }
 659   void          set_do_vector_loop(bool z)      { _do_vector_loop = z; }
 660   bool              use_cmove() const           { return _use_cmove; }
 661   void          set_use_cmove(bool z)           { _use_cmove = z; }
 662   bool              do_aliasing() const          { return _do_aliasing; }
 663   bool              print_assembly() const       { return _print_assembly; }
 664   void          set_print_assembly(bool z)       { _print_assembly = z; }
 665   bool              print_inlining() const       { return _print_inlining; }
 666   void          set_print_inlining(bool z)       { _print_inlining = z; }
 667   bool              print_intrinsics() const     { return _print_intrinsics; }
 668   void          set_print_intrinsics(bool z)     { _print_intrinsics = z; }
 669   uint              max_node_limit() const       { return (uint)_max_node_limit; }
 670   void          set_max_node_limit(uint n)       { _max_node_limit = n; }
 671   bool              clinit_barrier_on_entry()       { return _clinit_barrier_on_entry; }
 672   void          set_clinit_barrier_on_entry(bool z) { _clinit_barrier_on_entry = z; }
 673   bool              has_monitors() const         { return _has_monitors; }
 674   void          set_has_monitors(bool v)         { _has_monitors = v; }


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

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

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

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

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