< prev index next >

src/hotspot/share/opto/compile.hpp

Print this page

  28 #include "asm/codeBuffer.hpp"
  29 #include "ci/compilerInterface.hpp"
  30 #include "code/debugInfoRec.hpp"
  31 #include "compiler/cHeapStringHolder.hpp"
  32 #include "compiler/compileBroker.hpp"
  33 #include "compiler/compiler_globals.hpp"
  34 #include "compiler/compilerEvent.hpp"
  35 #include "libadt/dict.hpp"
  36 #include "libadt/vectset.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "oops/methodData.hpp"
  39 #include "opto/idealGraphPrinter.hpp"
  40 #include "opto/phase.hpp"
  41 #include "opto/phasetype.hpp"
  42 #include "opto/printinlining.hpp"
  43 #include "opto/regmask.hpp"
  44 #include "runtime/deoptimization.hpp"
  45 #include "runtime/sharedRuntime.hpp"
  46 #include "runtime/timerTrace.hpp"
  47 #include "runtime/vmThread.hpp"

  48 #include "utilities/ticks.hpp"
  49 #include "utilities/vmEnums.hpp"
  50 
  51 class AbstractLockNode;
  52 class AddPNode;
  53 class Block;
  54 class Bundle;
  55 class CallGenerator;

  56 class CallStaticJavaNode;
  57 class CloneMap;
  58 class CompilationFailureInfo;
  59 class ConnectionGraph;
  60 class IdealGraphPrinter;
  61 class InlineTree;
  62 class Matcher;
  63 class MachConstantNode;
  64 class MachConstantBaseNode;
  65 class MachNode;
  66 class MachOper;
  67 class MachSafePointNode;
  68 class Node;
  69 class Node_Array;
  70 class Node_List;
  71 class Node_Notes;
  72 class NodeHash;
  73 class NodeCloneInfo;
  74 class OpaqueTemplateAssertionPredicateNode;
  75 class OptoReg;

  79 class PhaseIterGVN;
  80 class PhaseRegAlloc;
  81 class PhaseCCP;
  82 class PhaseOutput;
  83 class RootNode;
  84 class relocInfo;
  85 class StartNode;
  86 class SafePointNode;
  87 class JVMState;
  88 class Type;
  89 class TypeInt;
  90 class TypeInteger;
  91 class TypeKlassPtr;
  92 class TypePtr;
  93 class TypeOopPtr;
  94 class TypeFunc;
  95 class TypeVect;
  96 class Type_Array;
  97 class Unique_Node_List;
  98 class UnstableIfTrap;

  99 class nmethod;
 100 class Node_Stack;
 101 struct Final_Reshape_Counts;
 102 class VerifyMeetResult;
 103 
 104 enum LoopOptsMode {
 105   LoopOptsDefault,
 106   LoopOptsNone,
 107   LoopOptsMaxUnroll,
 108   LoopOptsShenandoahExpand,
 109   LoopOptsSkipSplitIf,
 110   LoopOptsVerify
 111 };
 112 
 113 // The type of all node counts and indexes.
 114 // It must hold at least 16 bits, but must also be fast to load and store.
 115 // This type, if less than 32 bits, could limit the number of possible nodes.
 116 // (To make this type platform-specific, move to globalDefinitions_xxx.hpp.)
 117 typedef unsigned int node_idx_t;
 118 

 317   int                   _fixed_slots;           // count of frame slots not allocated by the register
 318                                                 // allocator i.e. locks, original deopt pc, etc.
 319   uintx                 _max_node_limit;        // Max unique node count during a single compilation.
 320 
 321   bool                  _post_loop_opts_phase;  // Loop opts are finished.
 322   bool                  _merge_stores_phase;    // Phase for merging stores, after post loop opts phase.
 323   bool                  _allow_macro_nodes;     // True if we allow creation of macro nodes.
 324 
 325   /* If major progress is set:
 326    *   Marks that the loop tree information (get_ctrl, idom, get_loop, etc.) could be invalid, and we need to rebuild the loop tree.
 327    *   It also indicates that the graph was changed in a way that is promising to be able to apply more loop optimization.
 328    * If major progress is not set:
 329    *   Loop tree information is valid.
 330    *   If major progress is not set at the end of a loop opts phase, then we can stop loop opts, because we do not expect any further progress if we did more loop opts phases.
 331    *
 332    * This is not 100% accurate, the semantics of major progress has become less clear over time, but this is the general idea.
 333    */
 334   bool                  _major_progress;
 335   bool                  _inlining_progress;     // progress doing incremental inlining?
 336   bool                  _inlining_incrementally;// Are we doing incremental inlining (post parse)

 337   bool                  _do_cleanup;            // Cleanup is needed before proceeding with incremental inlining
 338   bool                  _has_loops;             // True if the method _may_ have some loops
 339   bool                  _has_split_ifs;         // True if the method _may_ have some split-if
 340   bool                  _has_unsafe_access;     // True if the method _may_ produce faults in unsafe loads or stores.
 341   bool                  _has_stringbuilder;     // True StringBuffers or StringBuilders are allocated
 342   bool                  _has_boxed_value;       // True if a boxed object is allocated
 343   bool                  _has_reserved_stack_access; // True if the method or an inlined method is annotated with ReservedStackAccess

 344   uint                  _max_vector_size;       // Maximum size of generated vectors
 345   bool                  _clear_upper_avx;       // Clear upper bits of ymm registers using vzeroupper
 346   uint                  _trap_hist[trapHistLength];  // Cumulative traps
 347   bool                  _trap_can_recompile;    // Have we emitted a recompiling trap?
 348   uint                  _decompile_count;       // Cumulative decompilation counts.
 349   bool                  _do_inlining;           // True if we intend to do inlining
 350   bool                  _do_scheduling;         // True if we intend to do scheduling
 351   bool                  _do_freq_based_layout;  // True if we intend to do frequency based block layout
 352   bool                  _do_vector_loop;        // True if allowed to execute loop in parallel iterations
 353   bool                  _use_cmove;             // True if CMove should be used without profitability analysis
 354   bool                  _do_aliasing;           // True if we intend to do aliasing
 355   bool                  _print_assembly;        // True if we should dump assembly code for this compilation
 356   bool                  _print_inlining;        // True if we should print inlining for this compilation
 357   bool                  _print_intrinsics;      // True if we should print intrinsics for this compilation
 358   bool                  _print_phase_loop_opts; // True if we should print before and after loop opts phase
 359 #ifndef PRODUCT
 360   uint                  _phase_counter;         // Counter for the number of already printed phases
 361   uint                  _igv_idx;               // Counter for IGV node identifiers
 362   uint                  _igv_phase_iter[PHASE_NUM_TYPES]; // Counters for IGV phase iterations
 363   bool                  _trace_opto_output;
 364   bool                  _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
 365 #endif
 366   bool                  _has_irreducible_loop;  // Found irreducible loops
 367   bool                  _has_monitors;          // Metadata transfered to nmethod to enable Continuations lock-detection fastpath
 368   bool                  _has_scoped_access;     // For shared scope closure
 369   bool                  _clinit_barrier_on_entry; // True if clinit barrier is needed on nmethod entry
 370   int                   _loop_opts_cnt;         // loop opts round



 371   uint                  _stress_seed;           // Seed for stress testing
 372 
 373   // Compilation environment.
 374   Arena                 _comp_arena;            // Arena with lifetime equivalent to Compile
 375   void*                 _barrier_set_state;     // Potential GC barrier state for Compile
 376   ciEnv*                _env;                   // CI interface
 377   DirectiveSet*         _directive;             // Compiler directive
 378   CompileLog*           _log;                   // from CompilerThread
 379   CHeapStringHolder     _failure_reason;        // for record_failure/failing pattern
 380   CompilationFailureInfo* _first_failure_details; // Details for the first failure happening during compilation
 381   GrowableArray<CallGenerator*> _intrinsics;    // List of intrinsics.
 382   GrowableArray<Node*>  _macro_nodes;           // List of nodes which need to be expanded before matching.
 383   GrowableArray<ParsePredicateNode*> _parse_predicates; // List of Parse Predicates.
 384   // List of OpaqueTemplateAssertionPredicateNode nodes for Template Assertion Predicates which can be seen as list
 385   // of Template Assertion Predicates themselves.
 386   GrowableArray<OpaqueTemplateAssertionPredicateNode*>  _template_assertion_predicate_opaques;
 387   GrowableArray<Node*>  _expensive_nodes;       // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
 388   GrowableArray<Node*>  _for_post_loop_igvn;    // List of nodes for IGVN after loop opts are over


 389   GrowableArray<Node*>  _for_merge_stores_igvn; // List of nodes for IGVN merge stores
 390   GrowableArray<UnstableIfTrap*> _unstable_if_traps;        // List of ifnodes after IGVN
 391   GrowableArray<Node_List*> _coarsened_locks;   // List of coarsened Lock and Unlock nodes
 392   ConnectionGraph*      _congraph;
 393 #ifndef PRODUCT
 394   IdealGraphPrinter*    _igv_printer;
 395   static IdealGraphPrinter* _debug_file_printer;
 396   static IdealGraphPrinter* _debug_network_printer;
 397 #endif
 398 
 399 
 400   // Node management
 401   uint                  _unique;                // Counter for unique Node indices
 402   uint                  _dead_node_count;       // Number of dead nodes; VectorSet::Size() is O(N).
 403                                                 // So use this to keep count and make the call O(1).
 404   VectorSet             _dead_node_list;        // Set of dead nodes
 405   DEBUG_ONLY(Unique_Node_List* _modified_nodes;)   // List of nodes which inputs were modified
 406   DEBUG_ONLY(bool       _phase_optimize_finished;) // Used for live node verification while creating new nodes
 407 
 408   DEBUG_ONLY(bool       _phase_verify_ideal_loop;) // Are we in PhaseIdealLoop verification?

 582   ciMethod*         method() const              { return _method; }
 583   int               entry_bci() const           { return _entry_bci; }
 584   bool              is_osr_compilation() const  { return _entry_bci != InvocationEntryBci; }
 585   bool              is_method_compilation() const { return (_method != nullptr && !_method->flags().is_native()); }
 586   const TypeFunc*   tf() const                  { assert(_tf!=nullptr, ""); return _tf; }
 587   void         init_tf(const TypeFunc* tf)      { assert(_tf==nullptr, ""); _tf = tf; }
 588   InlineTree*       ilt() const                 { return _ilt; }
 589   address           stub_function() const       { return _stub_function; }
 590   const char*       stub_name() const           { return _stub_name; }
 591   StubId            stub_id() const             { return _stub_id; }
 592   address           stub_entry_point() const    { return _stub_entry_point; }
 593   void          set_stub_entry_point(address z) { _stub_entry_point = z; }
 594 
 595   // Control of this compilation.
 596   int               fixed_slots() const         { assert(_fixed_slots >= 0, "");         return _fixed_slots; }
 597   void          set_fixed_slots(int n)          { _fixed_slots = n; }
 598   void          set_inlining_progress(bool z)   { _inlining_progress = z; }
 599   int               inlining_progress() const   { return _inlining_progress; }
 600   void          set_inlining_incrementally(bool z) { _inlining_incrementally = z; }
 601   int               inlining_incrementally() const { return _inlining_incrementally; }


 602   void          set_do_cleanup(bool z)          { _do_cleanup = z; }
 603   int               do_cleanup() const          { return _do_cleanup; }
 604   bool              major_progress() const      { return _major_progress; }
 605   void          set_major_progress()            { _major_progress = true; }
 606   void          restore_major_progress(bool progress) { _major_progress = _major_progress || progress; }
 607   void        clear_major_progress()            { _major_progress = false; }
 608   int               max_inline_size() const     { return _max_inline_size; }
 609   void          set_freq_inline_size(int n)     { _freq_inline_size = n; }
 610   int               freq_inline_size() const    { return _freq_inline_size; }
 611   void          set_max_inline_size(int n)      { _max_inline_size = n; }
 612   bool              has_loops() const           { return _has_loops; }
 613   void          set_has_loops(bool z)           { _has_loops = z; }
 614   bool              has_split_ifs() const       { return _has_split_ifs; }
 615   void          set_has_split_ifs(bool z)       { _has_split_ifs = z; }
 616   bool              has_unsafe_access() const   { return _has_unsafe_access; }
 617   void          set_has_unsafe_access(bool z)   { _has_unsafe_access = z; }
 618   bool              has_stringbuilder() const   { return _has_stringbuilder; }
 619   void          set_has_stringbuilder(bool z)   { _has_stringbuilder = z; }
 620   bool              has_boxed_value() const     { return _has_boxed_value; }
 621   void          set_has_boxed_value(bool z)     { _has_boxed_value = z; }
 622   bool              has_reserved_stack_access() const { return _has_reserved_stack_access; }
 623   void          set_has_reserved_stack_access(bool z) { _has_reserved_stack_access = z; }


 624   uint              max_vector_size() const     { return _max_vector_size; }
 625   void          set_max_vector_size(uint s)     { _max_vector_size = s; }
 626   bool              clear_upper_avx() const     { return _clear_upper_avx; }
 627   void          set_clear_upper_avx(bool s)     { _clear_upper_avx = s; }
 628   void          set_trap_count(uint r, uint c)  { assert(r < trapHistLength, "oob");        _trap_hist[r] = c; }
 629   uint              trap_count(uint r) const    { assert(r < trapHistLength, "oob"); return _trap_hist[r]; }
 630   bool              trap_can_recompile() const  { return _trap_can_recompile; }
 631   void          set_trap_can_recompile(bool z)  { _trap_can_recompile = z; }
 632   uint              decompile_count() const     { return _decompile_count; }
 633   void          set_decompile_count(uint c)     { _decompile_count = c; }
 634   bool              allow_range_check_smearing() const;
 635   bool              do_inlining() const         { return _do_inlining; }
 636   void          set_do_inlining(bool z)         { _do_inlining = z; }
 637   bool              do_scheduling() const       { return _do_scheduling; }
 638   void          set_do_scheduling(bool z)       { _do_scheduling = z; }
 639   bool              do_freq_based_layout() const{ return _do_freq_based_layout; }
 640   void          set_do_freq_based_layout(bool z){ _do_freq_based_layout = z; }
 641   bool              do_vector_loop() const      { return _do_vector_loop; }
 642   void          set_do_vector_loop(bool z)      { _do_vector_loop = z; }
 643   bool              use_cmove() const           { return _use_cmove; }
 644   void          set_use_cmove(bool z)           { _use_cmove = z; }
 645   bool              do_aliasing() const          { return _do_aliasing; }
 646   bool              print_assembly() const       { return _print_assembly; }
 647   void          set_print_assembly(bool z)       { _print_assembly = z; }
 648   bool              print_inlining() const       { return _print_inlining; }
 649   void          set_print_inlining(bool z)       { _print_inlining = z; }
 650   bool              print_intrinsics() const     { return _print_intrinsics; }
 651   void          set_print_intrinsics(bool z)     { _print_intrinsics = z; }
 652   uint              max_node_limit() const       { return (uint)_max_node_limit; }
 653   void          set_max_node_limit(uint n)       { _max_node_limit = n; }
 654   bool              clinit_barrier_on_entry()       { return _clinit_barrier_on_entry; }
 655   void          set_clinit_barrier_on_entry(bool z) { _clinit_barrier_on_entry = z; }










 656   bool              has_monitors() const         { return _has_monitors; }
 657   void          set_has_monitors(bool v)         { _has_monitors = v; }
 658   bool              has_scoped_access() const    { return _has_scoped_access; }
 659   void          set_has_scoped_access(bool v)    { _has_scoped_access = v; }
 660 
 661   // check the CompilerOracle for special behaviours for this compile
 662   bool          method_has_option(CompileCommandEnum option) const {
 663     return method() != nullptr && method()->has_option(option);
 664   }
 665 
 666 #ifndef PRODUCT
 667   uint          next_igv_idx()                  { return _igv_idx++; }
 668   bool          trace_opto_output() const       { return _trace_opto_output; }
 669   void          print_phase(const char* phase_name);
 670   void          print_ideal_ir(const char* compile_phase_name) const;
 671   bool          should_print_ideal() const      { return _directive->PrintIdealOption; }
 672   bool              parsed_irreducible_loop() const { return _parsed_irreducible_loop; }
 673   void          set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; }
 674   int _in_dump_cnt;  // Required for dumping ir nodes.
 675 #endif

 767   bool coarsened_locks_consistent();
 768   void mark_unbalanced_boxes() const;
 769 
 770   bool       post_loop_opts_phase() { return _post_loop_opts_phase;  }
 771   void   set_post_loop_opts_phase() { _post_loop_opts_phase = true;  }
 772   void reset_post_loop_opts_phase() { _post_loop_opts_phase = false; }
 773 
 774 #ifdef ASSERT
 775   bool       phase_verify_ideal_loop() const { return _phase_verify_ideal_loop; }
 776   void   set_phase_verify_ideal_loop() { _phase_verify_ideal_loop = true; }
 777   void reset_phase_verify_ideal_loop() { _phase_verify_ideal_loop = false; }
 778 #endif
 779 
 780   bool       allow_macro_nodes() { return _allow_macro_nodes;  }
 781   void reset_allow_macro_nodes() { _allow_macro_nodes = false;  }
 782 
 783   void record_for_post_loop_opts_igvn(Node* n);
 784   void remove_from_post_loop_opts_igvn(Node* n);
 785   void process_for_post_loop_opts_igvn(PhaseIterGVN& igvn);
 786 


















 787   void record_unstable_if_trap(UnstableIfTrap* trap);
 788   bool remove_unstable_if_trap(CallStaticJavaNode* unc, bool yield);
 789   void remove_useless_unstable_if_traps(Unique_Node_List &useful);
 790   void process_for_unstable_if_traps(PhaseIterGVN& igvn);
 791 
 792   bool     merge_stores_phase() { return _merge_stores_phase;  }
 793   void set_merge_stores_phase() { _merge_stores_phase = true;  }
 794   void record_for_merge_stores_igvn(Node* n);
 795   void remove_from_merge_stores_igvn(Node* n);
 796   void process_for_merge_stores_igvn(PhaseIterGVN& igvn);
 797 
 798   void shuffle_late_inlines();
 799   void shuffle_macro_nodes();
 800   void sort_macro_nodes();
 801 
 802   void mark_parse_predicate_nodes_useless(PhaseIterGVN& igvn);
 803 
 804   // Are there candidate expensive nodes for optimization?
 805   bool should_optimize_expensive_nodes(PhaseIterGVN &igvn);
 806   // Check whether n1 and n2 are similar

 950   Arena*            type_arena()                { return _type_arena; }
 951   Dict*             type_dict()                 { return _type_dict; }
 952   size_t            type_last_size()            { return _type_last_size; }
 953   int               num_alias_types()           { return _num_alias_types; }
 954 
 955   void          init_type_arena()                       { _type_arena = &_Compile_types; }
 956   void          set_type_arena(Arena* a)                { _type_arena = a; }
 957   void          set_type_dict(Dict* d)                  { _type_dict = d; }
 958   void          set_type_last_size(size_t sz)           { _type_last_size = sz; }
 959 
 960   const TypeFunc* last_tf(ciMethod* m) {
 961     return (m == _last_tf_m) ? _last_tf : nullptr;
 962   }
 963   void set_last_tf(ciMethod* m, const TypeFunc* tf) {
 964     assert(m != nullptr || tf == nullptr, "");
 965     _last_tf_m = m;
 966     _last_tf = tf;
 967   }
 968 
 969   AliasType*        alias_type(int                idx)  { assert(idx < num_alias_types(), "oob"); return _alias_types[idx]; }
 970   AliasType*        alias_type(const TypePtr* adr_type, ciField* field = nullptr) { return find_alias_type(adr_type, false, field); }
 971   bool         have_alias_type(const TypePtr* adr_type);
 972   AliasType*        alias_type(ciField*         field);
 973 
 974   int               get_alias_index(const TypePtr* at)  { return alias_type(at)->index(); }
 975   const TypePtr*    get_adr_type(uint aidx)             { return alias_type(aidx)->adr_type(); }
 976   int               get_general_index(uint aidx)        { return alias_type(aidx)->general_index(); }
 977 
 978   // Building nodes
 979   void              rethrow_exceptions(JVMState* jvms);
 980   void              return_values(JVMState* jvms);
 981   JVMState*         build_start_state(StartNode* start, const TypeFunc* tf);
 982 
 983   // Decide how to build a call.
 984   // The profile factor is a discount to apply to this site's interp. profile.
 985   CallGenerator*    call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch,
 986                                    JVMState* jvms, bool allow_inline, float profile_factor, ciKlass* speculative_receiver_type = nullptr,
 987                                    bool allow_intrinsics = true);
 988   bool should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
 989     return C->directive()->should_delay_inline(call_method) ||
 990            should_delay_string_inlining(call_method, jvms) ||
 991            should_delay_boxing_inlining(call_method, jvms) ||
 992            should_delay_vector_inlining(call_method, jvms);
 993   }
 994   bool should_delay_string_inlining(ciMethod* call_method, JVMState* jvms);

1204   // Number of outgoing stack slots killed above the out_preserve_stack_slots
1205   // for calls to C.  Supports the var-args backing area for register parms.
1206   uint varargs_C_out_slots_killed() const;
1207 
1208   // Number of Stack Slots consumed by a synchronization entry
1209   int sync_stack_slots() const;
1210 
1211   // Compute the name of old_SP.  See <arch>.ad for frame layout.
1212   OptoReg::Name compute_old_SP();
1213 
1214  private:
1215   // Phase control:
1216   void Init(bool aliasing);                      // Prepare for a single compilation
1217   void Optimize();                               // Given a graph, optimize it
1218   void Code_Gen();                               // Generate code from a graph
1219 
1220   // Management of the AliasType table.
1221   void grow_alias_types();
1222   AliasCacheEntry* probe_alias_cache(const TypePtr* adr_type);
1223   const TypePtr *flatten_alias_type(const TypePtr* adr_type) const;
1224   AliasType* find_alias_type(const TypePtr* adr_type, bool no_create, ciField* field);
1225 
1226   void verify_top(Node*) const PRODUCT_RETURN;
1227 
1228   // Intrinsic setup.
1229   CallGenerator* make_vm_intrinsic(ciMethod* m, bool is_virtual);          // constructor
1230   int            intrinsic_insertion_index(ciMethod* m, bool is_virtual, bool& found);  // helper
1231   CallGenerator* find_intrinsic(ciMethod* m, bool is_virtual);             // query fn
1232   void           register_intrinsic(CallGenerator* cg);                    // update fn
1233 
1234 #ifndef PRODUCT
1235   static juint  _intrinsic_hist_count[];
1236   static jubyte _intrinsic_hist_flags[];
1237 #endif
1238   // Function calls made by the public function final_graph_reshaping.
1239   // No need to be made public as they are not called elsewhere.
1240   void final_graph_reshaping_impl(Node *n, Final_Reshape_Counts& frc, Unique_Node_List& dead_nodes);
1241   void final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& frc, uint nop, Unique_Node_List& dead_nodes);
1242   void final_graph_reshaping_walk(Node_Stack& nstack, Node* root, Final_Reshape_Counts& frc, Unique_Node_List& dead_nodes);
1243   void handle_div_mod_op(Node* n, BasicType bt, bool is_unsigned);
1244 

1294   // End-of-run dumps.
1295   static void print_statistics() PRODUCT_RETURN;
1296 
1297   // Verify ADLC assumptions during startup
1298   static void adlc_verification() PRODUCT_RETURN;
1299 
1300   // Definitions of pd methods
1301   static void pd_compiler2_init();
1302 
1303   // Static parse-time type checking logic for gen_subtype_check:
1304   enum SubTypeCheckResult { SSC_always_false, SSC_always_true, SSC_easy_test, SSC_full_test };
1305   SubTypeCheckResult static_subtype_check(const TypeKlassPtr* superk, const TypeKlassPtr* subk, bool skip = StressReflectiveCode);
1306 
1307   static Node* conv_I2X_index(PhaseGVN* phase, Node* offset, const TypeInt* sizetype,
1308                               // Optional control dependency (for example, on range check)
1309                               Node* ctrl = nullptr);
1310 
1311   // Convert integer value to a narrowed long type dependent on ctrl (for example, a range check)
1312   static Node* constrained_convI2L(PhaseGVN* phase, Node* value, const TypeInt* itype, Node* ctrl, bool carry_dependency = false);
1313 
1314   // Auxiliary methods for randomized fuzzing/stressing
1315   int random();
1316   bool randomized_select(int count);
1317 
1318   // seed random number generation and log the seed for repeatability.
1319   void initialize_stress_seed(const DirectiveSet* directive);
1320 
1321   // supporting clone_map
1322   CloneMap&     clone_map();
1323   void          set_clone_map(Dict* d);
1324 
1325   bool needs_clinit_barrier(ciField* ik,         ciMethod* accessing_method);
1326   bool needs_clinit_barrier(ciMethod* ik,        ciMethod* accessing_method);
1327   bool needs_clinit_barrier(ciInstanceKlass* ik, ciMethod* accessing_method);
1328 
1329 #ifdef ASSERT
1330   VerifyMeetResult* _type_verify;
1331   void set_exception_backedge() { _exception_backedge = true; }
1332   bool has_exception_backedge() const { return _exception_backedge; }
1333 #endif
1334 

  28 #include "asm/codeBuffer.hpp"
  29 #include "ci/compilerInterface.hpp"
  30 #include "code/debugInfoRec.hpp"
  31 #include "compiler/cHeapStringHolder.hpp"
  32 #include "compiler/compileBroker.hpp"
  33 #include "compiler/compiler_globals.hpp"
  34 #include "compiler/compilerEvent.hpp"
  35 #include "libadt/dict.hpp"
  36 #include "libadt/vectset.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "oops/methodData.hpp"
  39 #include "opto/idealGraphPrinter.hpp"
  40 #include "opto/phase.hpp"
  41 #include "opto/phasetype.hpp"
  42 #include "opto/printinlining.hpp"
  43 #include "opto/regmask.hpp"
  44 #include "runtime/deoptimization.hpp"
  45 #include "runtime/sharedRuntime.hpp"
  46 #include "runtime/timerTrace.hpp"
  47 #include "runtime/vmThread.hpp"
  48 #include "utilities/growableArray.hpp"
  49 #include "utilities/ticks.hpp"
  50 #include "utilities/vmEnums.hpp"
  51 
  52 class AbstractLockNode;
  53 class AddPNode;
  54 class Block;
  55 class Bundle;
  56 class CallGenerator;
  57 class CallNode;
  58 class CallStaticJavaNode;
  59 class CloneMap;
  60 class CompilationFailureInfo;
  61 class ConnectionGraph;
  62 class IdealGraphPrinter;
  63 class InlineTree;
  64 class Matcher;
  65 class MachConstantNode;
  66 class MachConstantBaseNode;
  67 class MachNode;
  68 class MachOper;
  69 class MachSafePointNode;
  70 class Node;
  71 class Node_Array;
  72 class Node_List;
  73 class Node_Notes;
  74 class NodeHash;
  75 class NodeCloneInfo;
  76 class OpaqueTemplateAssertionPredicateNode;
  77 class OptoReg;

  81 class PhaseIterGVN;
  82 class PhaseRegAlloc;
  83 class PhaseCCP;
  84 class PhaseOutput;
  85 class RootNode;
  86 class relocInfo;
  87 class StartNode;
  88 class SafePointNode;
  89 class JVMState;
  90 class Type;
  91 class TypeInt;
  92 class TypeInteger;
  93 class TypeKlassPtr;
  94 class TypePtr;
  95 class TypeOopPtr;
  96 class TypeFunc;
  97 class TypeVect;
  98 class Type_Array;
  99 class Unique_Node_List;
 100 class UnstableIfTrap;
 101 class InlineTypeNode;
 102 class nmethod;
 103 class Node_Stack;
 104 struct Final_Reshape_Counts;
 105 class VerifyMeetResult;
 106 
 107 enum LoopOptsMode {
 108   LoopOptsDefault,
 109   LoopOptsNone,
 110   LoopOptsMaxUnroll,
 111   LoopOptsShenandoahExpand,
 112   LoopOptsSkipSplitIf,
 113   LoopOptsVerify
 114 };
 115 
 116 // The type of all node counts and indexes.
 117 // It must hold at least 16 bits, but must also be fast to load and store.
 118 // This type, if less than 32 bits, could limit the number of possible nodes.
 119 // (To make this type platform-specific, move to globalDefinitions_xxx.hpp.)
 120 typedef unsigned int node_idx_t;
 121 

 320   int                   _fixed_slots;           // count of frame slots not allocated by the register
 321                                                 // allocator i.e. locks, original deopt pc, etc.
 322   uintx                 _max_node_limit;        // Max unique node count during a single compilation.
 323 
 324   bool                  _post_loop_opts_phase;  // Loop opts are finished.
 325   bool                  _merge_stores_phase;    // Phase for merging stores, after post loop opts phase.
 326   bool                  _allow_macro_nodes;     // True if we allow creation of macro nodes.
 327 
 328   /* If major progress is set:
 329    *   Marks that the loop tree information (get_ctrl, idom, get_loop, etc.) could be invalid, and we need to rebuild the loop tree.
 330    *   It also indicates that the graph was changed in a way that is promising to be able to apply more loop optimization.
 331    * If major progress is not set:
 332    *   Loop tree information is valid.
 333    *   If major progress is not set at the end of a loop opts phase, then we can stop loop opts, because we do not expect any further progress if we did more loop opts phases.
 334    *
 335    * This is not 100% accurate, the semantics of major progress has become less clear over time, but this is the general idea.
 336    */
 337   bool                  _major_progress;
 338   bool                  _inlining_progress;     // progress doing incremental inlining?
 339   bool                  _inlining_incrementally;// Are we doing incremental inlining (post parse)
 340   bool                  _strength_reduction;    // Are we doing strength reduction to direct call
 341   bool                  _do_cleanup;            // Cleanup is needed before proceeding with incremental inlining
 342   bool                  _has_loops;             // True if the method _may_ have some loops
 343   bool                  _has_split_ifs;         // True if the method _may_ have some split-if
 344   bool                  _has_unsafe_access;     // True if the method _may_ produce faults in unsafe loads or stores.
 345   bool                  _has_stringbuilder;     // True StringBuffers or StringBuilders are allocated
 346   bool                  _has_boxed_value;       // True if a boxed object is allocated
 347   bool                  _has_reserved_stack_access; // True if the method or an inlined method is annotated with ReservedStackAccess
 348   bool                  _has_circular_inline_type; // True if method loads an inline type with a circular, non-flat field
 349   uint                  _max_vector_size;       // Maximum size of generated vectors
 350   bool                  _clear_upper_avx;       // Clear upper bits of ymm registers using vzeroupper
 351   uint                  _trap_hist[trapHistLength];  // Cumulative traps
 352   bool                  _trap_can_recompile;    // Have we emitted a recompiling trap?
 353   uint                  _decompile_count;       // Cumulative decompilation counts.
 354   bool                  _do_inlining;           // True if we intend to do inlining
 355   bool                  _do_scheduling;         // True if we intend to do scheduling
 356   bool                  _do_freq_based_layout;  // True if we intend to do frequency based block layout
 357   bool                  _do_vector_loop;        // True if allowed to execute loop in parallel iterations
 358   bool                  _use_cmove;             // True if CMove should be used without profitability analysis
 359   bool                  _do_aliasing;           // True if we intend to do aliasing
 360   bool                  _print_assembly;        // True if we should dump assembly code for this compilation
 361   bool                  _print_inlining;        // True if we should print inlining for this compilation
 362   bool                  _print_intrinsics;      // True if we should print intrinsics for this compilation
 363   bool                  _print_phase_loop_opts; // True if we should print before and after loop opts phase
 364 #ifndef PRODUCT
 365   uint                  _phase_counter;         // Counter for the number of already printed phases
 366   uint                  _igv_idx;               // Counter for IGV node identifiers
 367   uint                  _igv_phase_iter[PHASE_NUM_TYPES]; // Counters for IGV phase iterations
 368   bool                  _trace_opto_output;
 369   bool                  _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
 370 #endif
 371   bool                  _has_irreducible_loop;  // Found irreducible loops
 372   bool                  _has_monitors;          // Metadata transfered to nmethod to enable Continuations lock-detection fastpath
 373   bool                  _has_scoped_access;     // For shared scope closure
 374   bool                  _clinit_barrier_on_entry; // True if clinit barrier is needed on nmethod entry
 375   int                   _loop_opts_cnt;         // loop opts round
 376   bool                  _has_flat_accesses;     // Any known flat array accesses?
 377   bool                  _flat_accesses_share_alias; // Initially all flat array share a single slice
 378   bool                  _scalarize_in_safepoints; // Scalarize inline types in safepoint debug info
 379   uint                  _stress_seed;           // Seed for stress testing
 380 
 381   // Compilation environment.
 382   Arena                 _comp_arena;            // Arena with lifetime equivalent to Compile
 383   void*                 _barrier_set_state;     // Potential GC barrier state for Compile
 384   ciEnv*                _env;                   // CI interface
 385   DirectiveSet*         _directive;             // Compiler directive
 386   CompileLog*           _log;                   // from CompilerThread
 387   CHeapStringHolder     _failure_reason;        // for record_failure/failing pattern
 388   CompilationFailureInfo* _first_failure_details; // Details for the first failure happening during compilation
 389   GrowableArray<CallGenerator*> _intrinsics;    // List of intrinsics.
 390   GrowableArray<Node*>  _macro_nodes;           // List of nodes which need to be expanded before matching.
 391   GrowableArray<ParsePredicateNode*> _parse_predicates; // List of Parse Predicates.
 392   // List of OpaqueTemplateAssertionPredicateNode nodes for Template Assertion Predicates which can be seen as list
 393   // of Template Assertion Predicates themselves.
 394   GrowableArray<OpaqueTemplateAssertionPredicateNode*>  _template_assertion_predicate_opaques;
 395   GrowableArray<Node*>  _expensive_nodes;       // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
 396   GrowableArray<Node*>  _for_post_loop_igvn;    // List of nodes for IGVN after loop opts are over
 397   GrowableArray<Node*>  _inline_type_nodes;     // List of InlineType nodes
 398   GrowableArray<Node*>  _flat_access_nodes;     // List of LoadFlat and StoreFlat nodes
 399   GrowableArray<Node*>  _for_merge_stores_igvn; // List of nodes for IGVN merge stores
 400   GrowableArray<UnstableIfTrap*> _unstable_if_traps;        // List of ifnodes after IGVN
 401   GrowableArray<Node_List*> _coarsened_locks;   // List of coarsened Lock and Unlock nodes
 402   ConnectionGraph*      _congraph;
 403 #ifndef PRODUCT
 404   IdealGraphPrinter*    _igv_printer;
 405   static IdealGraphPrinter* _debug_file_printer;
 406   static IdealGraphPrinter* _debug_network_printer;
 407 #endif
 408 
 409 
 410   // Node management
 411   uint                  _unique;                // Counter for unique Node indices
 412   uint                  _dead_node_count;       // Number of dead nodes; VectorSet::Size() is O(N).
 413                                                 // So use this to keep count and make the call O(1).
 414   VectorSet             _dead_node_list;        // Set of dead nodes
 415   DEBUG_ONLY(Unique_Node_List* _modified_nodes;)   // List of nodes which inputs were modified
 416   DEBUG_ONLY(bool       _phase_optimize_finished;) // Used for live node verification while creating new nodes
 417 
 418   DEBUG_ONLY(bool       _phase_verify_ideal_loop;) // Are we in PhaseIdealLoop verification?

 592   ciMethod*         method() const              { return _method; }
 593   int               entry_bci() const           { return _entry_bci; }
 594   bool              is_osr_compilation() const  { return _entry_bci != InvocationEntryBci; }
 595   bool              is_method_compilation() const { return (_method != nullptr && !_method->flags().is_native()); }
 596   const TypeFunc*   tf() const                  { assert(_tf!=nullptr, ""); return _tf; }
 597   void         init_tf(const TypeFunc* tf)      { assert(_tf==nullptr, ""); _tf = tf; }
 598   InlineTree*       ilt() const                 { return _ilt; }
 599   address           stub_function() const       { return _stub_function; }
 600   const char*       stub_name() const           { return _stub_name; }
 601   StubId            stub_id() const             { return _stub_id; }
 602   address           stub_entry_point() const    { return _stub_entry_point; }
 603   void          set_stub_entry_point(address z) { _stub_entry_point = z; }
 604 
 605   // Control of this compilation.
 606   int               fixed_slots() const         { assert(_fixed_slots >= 0, "");         return _fixed_slots; }
 607   void          set_fixed_slots(int n)          { _fixed_slots = n; }
 608   void          set_inlining_progress(bool z)   { _inlining_progress = z; }
 609   int               inlining_progress() const   { return _inlining_progress; }
 610   void          set_inlining_incrementally(bool z) { _inlining_incrementally = z; }
 611   int               inlining_incrementally() const { return _inlining_incrementally; }
 612   void          set_strength_reduction(bool z)  { _strength_reduction = z; }
 613   bool              strength_reduction() const  { return _strength_reduction; }
 614   void          set_do_cleanup(bool z)          { _do_cleanup = z; }
 615   int               do_cleanup() const          { return _do_cleanup; }
 616   bool              major_progress() const      { return _major_progress; }
 617   void          set_major_progress()            { _major_progress = true; }
 618   void          restore_major_progress(bool progress) { _major_progress = _major_progress || progress; }
 619   void        clear_major_progress()            { _major_progress = false; }
 620   int               max_inline_size() const     { return _max_inline_size; }
 621   void          set_freq_inline_size(int n)     { _freq_inline_size = n; }
 622   int               freq_inline_size() const    { return _freq_inline_size; }
 623   void          set_max_inline_size(int n)      { _max_inline_size = n; }
 624   bool              has_loops() const           { return _has_loops; }
 625   void          set_has_loops(bool z)           { _has_loops = z; }
 626   bool              has_split_ifs() const       { return _has_split_ifs; }
 627   void          set_has_split_ifs(bool z)       { _has_split_ifs = z; }
 628   bool              has_unsafe_access() const   { return _has_unsafe_access; }
 629   void          set_has_unsafe_access(bool z)   { _has_unsafe_access = z; }
 630   bool              has_stringbuilder() const   { return _has_stringbuilder; }
 631   void          set_has_stringbuilder(bool z)   { _has_stringbuilder = z; }
 632   bool              has_boxed_value() const     { return _has_boxed_value; }
 633   void          set_has_boxed_value(bool z)     { _has_boxed_value = z; }
 634   bool              has_reserved_stack_access() const { return _has_reserved_stack_access; }
 635   void          set_has_reserved_stack_access(bool z) { _has_reserved_stack_access = z; }
 636   bool              has_circular_inline_type() const { return _has_circular_inline_type; }
 637   void          set_has_circular_inline_type(bool z) { _has_circular_inline_type = z; }
 638   uint              max_vector_size() const     { return _max_vector_size; }
 639   void          set_max_vector_size(uint s)     { _max_vector_size = s; }
 640   bool              clear_upper_avx() const     { return _clear_upper_avx; }
 641   void          set_clear_upper_avx(bool s)     { _clear_upper_avx = s; }
 642   void          set_trap_count(uint r, uint c)  { assert(r < trapHistLength, "oob");        _trap_hist[r] = c; }
 643   uint              trap_count(uint r) const    { assert(r < trapHistLength, "oob"); return _trap_hist[r]; }
 644   bool              trap_can_recompile() const  { return _trap_can_recompile; }
 645   void          set_trap_can_recompile(bool z)  { _trap_can_recompile = z; }
 646   uint              decompile_count() const     { return _decompile_count; }
 647   void          set_decompile_count(uint c)     { _decompile_count = c; }
 648   bool              allow_range_check_smearing() const;
 649   bool              do_inlining() const         { return _do_inlining; }
 650   void          set_do_inlining(bool z)         { _do_inlining = z; }
 651   bool              do_scheduling() const       { return _do_scheduling; }
 652   void          set_do_scheduling(bool z)       { _do_scheduling = z; }
 653   bool              do_freq_based_layout() const{ return _do_freq_based_layout; }
 654   void          set_do_freq_based_layout(bool z){ _do_freq_based_layout = z; }
 655   bool              do_vector_loop() const      { return _do_vector_loop; }
 656   void          set_do_vector_loop(bool z)      { _do_vector_loop = z; }
 657   bool              use_cmove() const           { return _use_cmove; }
 658   void          set_use_cmove(bool z)           { _use_cmove = z; }
 659   bool              do_aliasing() const          { return _do_aliasing; }
 660   bool              print_assembly() const       { return _print_assembly; }
 661   void          set_print_assembly(bool z)       { _print_assembly = z; }
 662   bool              print_inlining() const       { return _print_inlining; }
 663   void          set_print_inlining(bool z)       { _print_inlining = z; }
 664   bool              print_intrinsics() const     { return _print_intrinsics; }
 665   void          set_print_intrinsics(bool z)     { _print_intrinsics = z; }
 666   uint              max_node_limit() const       { return (uint)_max_node_limit; }
 667   void          set_max_node_limit(uint n)       { _max_node_limit = n; }
 668   bool              clinit_barrier_on_entry()       { return _clinit_barrier_on_entry; }
 669   void          set_clinit_barrier_on_entry(bool z) { _clinit_barrier_on_entry = z; }
 670   void          set_flat_accesses()              { _has_flat_accesses = true; }
 671   bool          flat_accesses_share_alias() const { return _flat_accesses_share_alias; }
 672   void          set_flat_accesses_share_alias(bool z) { _flat_accesses_share_alias = z; }
 673   bool          scalarize_in_safepoints() const { return _scalarize_in_safepoints; }
 674   void          set_scalarize_in_safepoints(bool z) { _scalarize_in_safepoints = z; }
 675 
 676   // Support for scalarized inline type calling convention
 677   bool              has_scalarized_args() const  { return _method != nullptr && _method->has_scalarized_args(); }
 678   bool              needs_stack_repair()  const  { return _method != nullptr && _method->get_Method()->c2_needs_stack_repair(); }
 679 
 680   bool              has_monitors() const         { return _has_monitors; }
 681   void          set_has_monitors(bool v)         { _has_monitors = v; }
 682   bool              has_scoped_access() const    { return _has_scoped_access; }
 683   void          set_has_scoped_access(bool v)    { _has_scoped_access = v; }
 684 
 685   // check the CompilerOracle for special behaviours for this compile
 686   bool          method_has_option(CompileCommandEnum option) const {
 687     return method() != nullptr && method()->has_option(option);
 688   }
 689 
 690 #ifndef PRODUCT
 691   uint          next_igv_idx()                  { return _igv_idx++; }
 692   bool          trace_opto_output() const       { return _trace_opto_output; }
 693   void          print_phase(const char* phase_name);
 694   void          print_ideal_ir(const char* compile_phase_name) const;
 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

 791   bool coarsened_locks_consistent();
 792   void mark_unbalanced_boxes() const;
 793 
 794   bool       post_loop_opts_phase() { return _post_loop_opts_phase;  }
 795   void   set_post_loop_opts_phase() { _post_loop_opts_phase = true;  }
 796   void reset_post_loop_opts_phase() { _post_loop_opts_phase = false; }
 797 
 798 #ifdef ASSERT
 799   bool       phase_verify_ideal_loop() const { return _phase_verify_ideal_loop; }
 800   void   set_phase_verify_ideal_loop() { _phase_verify_ideal_loop = true; }
 801   void reset_phase_verify_ideal_loop() { _phase_verify_ideal_loop = false; }
 802 #endif
 803 
 804   bool       allow_macro_nodes() { return _allow_macro_nodes;  }
 805   void reset_allow_macro_nodes() { _allow_macro_nodes = false;  }
 806 
 807   void record_for_post_loop_opts_igvn(Node* n);
 808   void remove_from_post_loop_opts_igvn(Node* n);
 809   void process_for_post_loop_opts_igvn(PhaseIterGVN& igvn);
 810 
 811   // Keep track of inline type nodes for later processing
 812   void add_inline_type(Node* n);
 813   void remove_inline_type(Node* n);
 814   void process_inline_types(PhaseIterGVN &igvn, bool remove = false);
 815 
 816   void add_flat_access(Node* n);
 817   void remove_flat_access(Node* n);
 818   void process_flat_accesses(PhaseIterGVN& igvn);
 819 
 820   template <class F>
 821   void for_each_flat_access(F consumer) {
 822     for (int i = _flat_access_nodes.length() - 1; i >= 0; i--) {
 823       consumer(_flat_access_nodes.at(i));
 824     }
 825   }
 826 
 827   void adjust_flat_array_access_aliases(PhaseIterGVN& igvn);
 828 
 829   void record_unstable_if_trap(UnstableIfTrap* trap);
 830   bool remove_unstable_if_trap(CallStaticJavaNode* unc, bool yield);
 831   void remove_useless_unstable_if_traps(Unique_Node_List &useful);
 832   void process_for_unstable_if_traps(PhaseIterGVN& igvn);
 833 
 834   bool     merge_stores_phase() { return _merge_stores_phase;  }
 835   void set_merge_stores_phase() { _merge_stores_phase = true;  }
 836   void record_for_merge_stores_igvn(Node* n);
 837   void remove_from_merge_stores_igvn(Node* n);
 838   void process_for_merge_stores_igvn(PhaseIterGVN& igvn);
 839 
 840   void shuffle_late_inlines();
 841   void shuffle_macro_nodes();
 842   void sort_macro_nodes();
 843 
 844   void mark_parse_predicate_nodes_useless(PhaseIterGVN& igvn);
 845 
 846   // Are there candidate expensive nodes for optimization?
 847   bool should_optimize_expensive_nodes(PhaseIterGVN &igvn);
 848   // Check whether n1 and n2 are similar

 992   Arena*            type_arena()                { return _type_arena; }
 993   Dict*             type_dict()                 { return _type_dict; }
 994   size_t            type_last_size()            { return _type_last_size; }
 995   int               num_alias_types()           { return _num_alias_types; }
 996 
 997   void          init_type_arena()                       { _type_arena = &_Compile_types; }
 998   void          set_type_arena(Arena* a)                { _type_arena = a; }
 999   void          set_type_dict(Dict* d)                  { _type_dict = d; }
1000   void          set_type_last_size(size_t sz)           { _type_last_size = sz; }
1001 
1002   const TypeFunc* last_tf(ciMethod* m) {
1003     return (m == _last_tf_m) ? _last_tf : nullptr;
1004   }
1005   void set_last_tf(ciMethod* m, const TypeFunc* tf) {
1006     assert(m != nullptr || tf == nullptr, "");
1007     _last_tf_m = m;
1008     _last_tf = tf;
1009   }
1010 
1011   AliasType*        alias_type(int                idx)  { assert(idx < num_alias_types(), "oob"); return _alias_types[idx]; }
1012   AliasType*        alias_type(const TypePtr* adr_type, ciField* field = nullptr, bool uncached = false) { return find_alias_type(adr_type, false, field, uncached); }
1013   bool         have_alias_type(const TypePtr* adr_type);
1014   AliasType*        alias_type(ciField*         field);
1015 
1016   int               get_alias_index(const TypePtr* at, bool uncached = false) { return alias_type(at, nullptr, uncached)->index(); }
1017   const TypePtr*    get_adr_type(uint aidx)             { return alias_type(aidx)->adr_type(); }
1018   int               get_general_index(uint aidx)        { return alias_type(aidx)->general_index(); }
1019 
1020   // Building nodes
1021   void              rethrow_exceptions(JVMState* jvms);
1022   void              return_values(JVMState* jvms);
1023   JVMState*         build_start_state(StartNode* start, const TypeFunc* tf);
1024 
1025   // Decide how to build a call.
1026   // The profile factor is a discount to apply to this site's interp. profile.
1027   CallGenerator*    call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch,
1028                                    JVMState* jvms, bool allow_inline, float profile_factor, ciKlass* speculative_receiver_type = nullptr,
1029                                    bool allow_intrinsics = true);
1030   bool should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
1031     return C->directive()->should_delay_inline(call_method) ||
1032            should_delay_string_inlining(call_method, jvms) ||
1033            should_delay_boxing_inlining(call_method, jvms) ||
1034            should_delay_vector_inlining(call_method, jvms);
1035   }
1036   bool should_delay_string_inlining(ciMethod* call_method, JVMState* jvms);

1246   // Number of outgoing stack slots killed above the out_preserve_stack_slots
1247   // for calls to C.  Supports the var-args backing area for register parms.
1248   uint varargs_C_out_slots_killed() const;
1249 
1250   // Number of Stack Slots consumed by a synchronization entry
1251   int sync_stack_slots() const;
1252 
1253   // Compute the name of old_SP.  See <arch>.ad for frame layout.
1254   OptoReg::Name compute_old_SP();
1255 
1256  private:
1257   // Phase control:
1258   void Init(bool aliasing);                      // Prepare for a single compilation
1259   void Optimize();                               // Given a graph, optimize it
1260   void Code_Gen();                               // Generate code from a graph
1261 
1262   // Management of the AliasType table.
1263   void grow_alias_types();
1264   AliasCacheEntry* probe_alias_cache(const TypePtr* adr_type);
1265   const TypePtr *flatten_alias_type(const TypePtr* adr_type) const;
1266   AliasType* find_alias_type(const TypePtr* adr_type, bool no_create, ciField* field, bool uncached = false);
1267 
1268   void verify_top(Node*) const PRODUCT_RETURN;
1269 
1270   // Intrinsic setup.
1271   CallGenerator* make_vm_intrinsic(ciMethod* m, bool is_virtual);          // constructor
1272   int            intrinsic_insertion_index(ciMethod* m, bool is_virtual, bool& found);  // helper
1273   CallGenerator* find_intrinsic(ciMethod* m, bool is_virtual);             // query fn
1274   void           register_intrinsic(CallGenerator* cg);                    // update fn
1275 
1276 #ifndef PRODUCT
1277   static juint  _intrinsic_hist_count[];
1278   static jubyte _intrinsic_hist_flags[];
1279 #endif
1280   // Function calls made by the public function final_graph_reshaping.
1281   // No need to be made public as they are not called elsewhere.
1282   void final_graph_reshaping_impl(Node *n, Final_Reshape_Counts& frc, Unique_Node_List& dead_nodes);
1283   void final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& frc, uint nop, Unique_Node_List& dead_nodes);
1284   void final_graph_reshaping_walk(Node_Stack& nstack, Node* root, Final_Reshape_Counts& frc, Unique_Node_List& dead_nodes);
1285   void handle_div_mod_op(Node* n, BasicType bt, bool is_unsigned);
1286 

1336   // End-of-run dumps.
1337   static void print_statistics() PRODUCT_RETURN;
1338 
1339   // Verify ADLC assumptions during startup
1340   static void adlc_verification() PRODUCT_RETURN;
1341 
1342   // Definitions of pd methods
1343   static void pd_compiler2_init();
1344 
1345   // Static parse-time type checking logic for gen_subtype_check:
1346   enum SubTypeCheckResult { SSC_always_false, SSC_always_true, SSC_easy_test, SSC_full_test };
1347   SubTypeCheckResult static_subtype_check(const TypeKlassPtr* superk, const TypeKlassPtr* subk, bool skip = StressReflectiveCode);
1348 
1349   static Node* conv_I2X_index(PhaseGVN* phase, Node* offset, const TypeInt* sizetype,
1350                               // Optional control dependency (for example, on range check)
1351                               Node* ctrl = nullptr);
1352 
1353   // Convert integer value to a narrowed long type dependent on ctrl (for example, a range check)
1354   static Node* constrained_convI2L(PhaseGVN* phase, Node* value, const TypeInt* itype, Node* ctrl, bool carry_dependency = false);
1355 
1356   // Auxiliary method for randomized fuzzing/stressing
1357   int random();
1358   bool randomized_select(int count);
1359 
1360   // seed random number generation and log the seed for repeatability.
1361   void initialize_stress_seed(const DirectiveSet* directive);
1362 
1363   // supporting clone_map
1364   CloneMap&     clone_map();
1365   void          set_clone_map(Dict* d);
1366 
1367   bool needs_clinit_barrier(ciField* ik,         ciMethod* accessing_method);
1368   bool needs_clinit_barrier(ciMethod* ik,        ciMethod* accessing_method);
1369   bool needs_clinit_barrier(ciInstanceKlass* ik, ciMethod* accessing_method);
1370 
1371 #ifdef ASSERT
1372   VerifyMeetResult* _type_verify;
1373   void set_exception_backedge() { _exception_backedge = true; }
1374   bool has_exception_backedge() const { return _exception_backedge; }
1375 #endif
1376 
< prev index next >