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;
80 class PhaseRegAlloc;
81 class PhaseCCP;
82 class PhaseOutput;
83 class ReachabilityFenceNode;
84 class RootNode;
85 class relocInfo;
86 class StartNode;
87 class SafePointNode;
88 class JVMState;
89 class Type;
90 class TypeInt;
91 class TypeInteger;
92 class TypeKlassPtr;
93 class TypePtr;
94 class TypeOopPtr;
95 class TypeFunc;
96 class TypeVect;
97 class Type_Array;
98 class Unique_Node_List;
99 class UnstableIfTrap;
100 class nmethod;
101 class Node_Stack;
102 struct Final_Reshape_Counts;
103 class VerifyMeetResult;
104
105 enum LoopOptsMode {
106 LoopOptsDefault,
107 LoopOptsNone,
108 LoopOptsMaxUnroll,
109 LoopOptsSkipSplitIf,
110 LoopOptsVerify,
111 PostLoopOptsExpandReachabilityFences
112 };
113
114 // The type of all node counts and indexes.
115 // It must hold at least 16 bits, but must also be fast to load and store.
116 // This type, if less than 32 bits, could limit the number of possible nodes.
117 // (To make this type platform-specific, move to globalDefinitions_xxx.hpp.)
118 typedef unsigned int node_idx_t;
119
319 // allocator i.e. locks, original deopt pc, etc.
320 uintx _max_node_limit; // Max unique node count during a single compilation.
321 uint _node_count_inlining_cutoff; // Number of nodes in the graph above which inlining is denied
322
323 bool _post_loop_opts_phase; // Loop opts are finished.
324 bool _merge_stores_phase; // Phase for merging stores, after post loop opts phase.
325 bool _allow_macro_nodes; // True if we allow creation of macro nodes.
326
327 /* If major progress is set:
328 * Marks that the loop tree information (get_ctrl, idom, get_loop, etc.) could be invalid, and we need to rebuild the loop tree.
329 * It also indicates that the graph was changed in a way that is promising to be able to apply more loop optimization.
330 * If major progress is not set:
331 * Loop tree information is valid.
332 * 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.
333 *
334 * This is not 100% accurate, the semantics of major progress has become less clear over time, but this is the general idea.
335 */
336 bool _major_progress;
337 bool _inlining_progress; // progress doing incremental inlining?
338 bool _inlining_incrementally;// Are we doing incremental inlining (post parse)
339 bool _do_cleanup; // Cleanup is needed before proceeding with incremental inlining
340 bool _has_loops; // True if the method _may_ have some loops
341 bool _has_split_ifs; // True if the method _may_ have some split-if
342 bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores.
343 bool _has_stringbuilder; // True StringBuffers or StringBuilders are allocated
344 bool _has_boxed_value; // True if a boxed object is allocated
345 bool _has_reserved_stack_access; // True if the method or an inlined method is annotated with ReservedStackAccess
346 uint _max_vector_size; // Maximum size of generated vectors
347 bool _clear_upper_avx; // Clear upper bits of ymm registers using vzeroupper
348 uint _trap_hist[trapHistLength]; // Cumulative traps
349 bool _trap_can_recompile; // Have we emitted a recompiling trap?
350 uint _decompile_count; // Cumulative decompilation counts.
351 bool _do_inlining; // True if we intend to do inlining
352 bool _do_scheduling; // True if we intend to do scheduling
353 bool _do_freq_based_layout; // True if we intend to do frequency based block layout
354 bool _do_vector_loop; // True if allowed to execute loop in parallel iterations
355 bool _use_cmove; // True if CMove should be used without profitability analysis
356 bool _do_aliasing; // True if we intend to do aliasing
357 bool _print_assembly; // True if we should dump assembly code for this compilation
358 bool _print_inlining; // True if we should print inlining for this compilation
359 bool _print_intrinsics; // True if we should print intrinsics for this compilation
360 bool _print_phase_loop_opts; // True if we should print before and after loop opts phase
361 #ifndef PRODUCT
362 uint _phase_counter; // Counter for the number of already printed phases
363 uint _igv_idx; // Counter for IGV node identifiers
364 uint _igv_phase_iter[PHASE_NUM_TYPES]; // Counters for IGV phase iterations
365 bool _trace_opto_output;
366 bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
367 #endif
368 bool _has_irreducible_loop; // Found irreducible loops
369 bool _has_monitors; // Metadata transfered to nmethod to enable Continuations lock-detection fastpath
370 bool _has_scoped_access; // For shared scope closure
371 bool _clinit_barrier_on_entry; // True if clinit barrier is needed on nmethod entry
372 int _loop_opts_cnt; // loop opts round
373 uint _stress_seed; // Seed for stress testing
374
375 // Compilation environment.
376 Arena _comp_arena; // Arena with lifetime equivalent to Compile
377 void* _barrier_set_state; // Potential GC barrier state for Compile
378 ciEnv* _env; // CI interface
379 DirectiveSet* _directive; // Compiler directive
380 CompileLog* _log; // from CompilerThread
381 CHeapStringHolder _failure_reason; // for record_failure/failing pattern
382 CompilationFailureInfo* _first_failure_details; // Details for the first failure happening during compilation
383 GrowableArray<CallGenerator*> _intrinsics; // List of intrinsics.
384 GrowableArray<Node*> _macro_nodes; // List of nodes which need to be expanded before matching.
385 GrowableArray<ParsePredicateNode*> _parse_predicates; // List of Parse Predicates.
386 // List of OpaqueTemplateAssertionPredicateNode nodes for Template Assertion Predicates which can be seen as list
387 // of Template Assertion Predicates themselves.
388 GrowableArray<OpaqueTemplateAssertionPredicateNode*> _template_assertion_predicate_opaques;
389 GrowableArray<Node*> _expensive_nodes; // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
390 GrowableArray<ReachabilityFenceNode*> _reachability_fences; // List of reachability fences
391 GrowableArray<Node*> _for_post_loop_igvn; // List of nodes for IGVN after loop opts are over
392 GrowableArray<Node*> _for_merge_stores_igvn; // List of nodes for IGVN merge stores
393 GrowableArray<UnstableIfTrap*> _unstable_if_traps; // List of ifnodes after IGVN
394 GrowableArray<Node_List*> _coarsened_locks; // List of coarsened Lock and Unlock nodes
395 ConnectionGraph* _congraph;
396 #ifndef PRODUCT
397 IdealGraphPrinter* _igv_printer;
398 static IdealGraphPrinter* _debug_file_printer;
399 static IdealGraphPrinter* _debug_network_printer;
400 #endif
401
402
403 // Node management
404 uint _unique; // Counter for unique Node indices
405 uint _dead_node_count; // Number of dead nodes; VectorSet::Size() is O(N).
406 // So use this to keep count and make the call O(1).
407 VectorSet _dead_node_list; // Set of dead nodes
408 DEBUG_ONLY(Unique_Node_List* _modified_nodes;) // List of nodes which inputs were modified
409 DEBUG_ONLY(bool _phase_optimize_finished;) // Used for live node verification while creating new nodes
410
411 DEBUG_ONLY(bool _phase_verify_ideal_loop;) // Are we in PhaseIdealLoop verification?
585 ciMethod* method() const { return _method; }
586 int entry_bci() const { return _entry_bci; }
587 bool is_osr_compilation() const { return _entry_bci != InvocationEntryBci; }
588 bool is_method_compilation() const { return (_method != nullptr && !_method->flags().is_native()); }
589 const TypeFunc* tf() const { assert(_tf!=nullptr, ""); return _tf; }
590 void init_tf(const TypeFunc* tf) { assert(_tf==nullptr, ""); _tf = tf; }
591 InlineTree* ilt() const { return _ilt; }
592 address stub_function() const { return _stub_function; }
593 const char* stub_name() const { return _stub_name; }
594 StubId stub_id() const { return _stub_id; }
595 address stub_entry_point() const { return _stub_entry_point; }
596 void set_stub_entry_point(address z) { _stub_entry_point = z; }
597
598 // Control of this compilation.
599 int fixed_slots() const { assert(_fixed_slots >= 0, ""); return _fixed_slots; }
600 void set_fixed_slots(int n) { _fixed_slots = n; }
601 void set_inlining_progress(bool z) { _inlining_progress = z; }
602 bool inlining_progress() const { return _inlining_progress; }
603 void set_inlining_incrementally(bool z) { _inlining_incrementally = z; }
604 bool inlining_incrementally() const { return _inlining_incrementally; }
605 void set_do_cleanup(bool z) { _do_cleanup = z; }
606 bool do_cleanup() const { return _do_cleanup; }
607 bool major_progress() const { return _major_progress; }
608 void set_major_progress() { _major_progress = true; }
609 void restore_major_progress(bool progress) { _major_progress = _major_progress || progress; }
610 void clear_major_progress() { _major_progress = false; }
611 int max_inline_size() const { return _max_inline_size; }
612 void set_freq_inline_size(int n) { _freq_inline_size = n; }
613 int freq_inline_size() const { return _freq_inline_size; }
614 void set_max_inline_size(int n) { _max_inline_size = n; }
615 bool has_loops() const { return _has_loops; }
616 void set_has_loops(bool z) { _has_loops = z; }
617 bool has_split_ifs() const { return _has_split_ifs; }
618 void set_has_split_ifs(bool z) { _has_split_ifs = z; }
619 bool has_unsafe_access() const { return _has_unsafe_access; }
620 void set_has_unsafe_access(bool z) { _has_unsafe_access = z; }
621 bool has_stringbuilder() const { return _has_stringbuilder; }
622 void set_has_stringbuilder(bool z) { _has_stringbuilder = z; }
623 bool has_boxed_value() const { return _has_boxed_value; }
624 void set_has_boxed_value(bool z) { _has_boxed_value = z; }
625 bool has_reserved_stack_access() const { return _has_reserved_stack_access; }
626 void set_has_reserved_stack_access(bool z) { _has_reserved_stack_access = z; }
627 uint max_vector_size() const { return _max_vector_size; }
628 void set_max_vector_size(uint s) { _max_vector_size = s; }
629 bool clear_upper_avx() const { return _clear_upper_avx; }
630 void set_clear_upper_avx(bool s) { _clear_upper_avx = s; }
631 void set_trap_count(uint r, uint c) { assert(r < trapHistLength, "oob"); _trap_hist[r] = c; }
632 uint trap_count(uint r) const { assert(r < trapHistLength, "oob"); return _trap_hist[r]; }
633 bool trap_can_recompile() const { return _trap_can_recompile; }
634 void set_trap_can_recompile(bool z) { _trap_can_recompile = z; }
635 uint decompile_count() const { return _decompile_count; }
636 void set_decompile_count(uint c) { _decompile_count = c; }
637 bool allow_range_check_smearing() const;
638 bool do_inlining() const { return _do_inlining; }
639 void set_do_inlining(bool z) { _do_inlining = z; }
640 bool do_scheduling() const { return _do_scheduling; }
641 void set_do_scheduling(bool z) { _do_scheduling = z; }
642 bool do_freq_based_layout() const{ return _do_freq_based_layout; }
643 void set_do_freq_based_layout(bool z){ _do_freq_based_layout = z; }
644 bool do_vector_loop() const { return _do_vector_loop; }
645 void set_do_vector_loop(bool z) { _do_vector_loop = z; }
646 bool use_cmove() const { return _use_cmove; }
647 void set_use_cmove(bool z) { _use_cmove = z; }
648 bool do_aliasing() const { return _do_aliasing; }
649 bool print_assembly() const { return _print_assembly; }
650 void set_print_assembly(bool z) { _print_assembly = z; }
651 bool print_inlining() const { return _print_inlining; }
652 void set_print_inlining(bool z) { _print_inlining = z; }
653 bool print_intrinsics() const { return _print_intrinsics; }
654 void set_print_intrinsics(bool z) { _print_intrinsics = z; }
655 uint max_node_limit() const { return (uint)_max_node_limit; }
656 void set_max_node_limit(uint n) { _max_node_limit = n; }
657 uint node_count_inlining_cutoff() const { return _node_count_inlining_cutoff; }
658 void set_node_count_inlining_cutoff(uint n) { _node_count_inlining_cutoff = n; }
659 bool clinit_barrier_on_entry() { return _clinit_barrier_on_entry; }
660 void set_clinit_barrier_on_entry(bool z) { _clinit_barrier_on_entry = z; }
661 bool has_monitors() const { return _has_monitors; }
662 void set_has_monitors(bool v) { _has_monitors = v; }
663 bool has_scoped_access() const { return _has_scoped_access; }
664 void set_has_scoped_access(bool v) { _has_scoped_access = v; }
665
666 // check the CompilerOracle for special behaviours for this compile
667 bool method_has_option(CompileCommandEnum option) const {
668 return method() != nullptr && method()->has_option(option);
669 }
670
671 #ifndef PRODUCT
672 uint next_igv_idx() { return _igv_idx++; }
673 bool trace_opto_output() const { return _trace_opto_output; }
674 void print_phase(const char* phase_name);
675 void print_ideal_ir(const char* compile_phase_name) const;
676 bool should_print_ideal() const { return _directive->PrintIdealOption; }
677 bool parsed_irreducible_loop() const { return _parsed_irreducible_loop; }
678 void set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; }
679 int _in_dump_cnt; // Required for dumping ir nodes.
680 #endif
782 bool coarsened_locks_consistent();
783 void mark_unbalanced_boxes() const;
784
785 bool post_loop_opts_phase() { return _post_loop_opts_phase; }
786 void set_post_loop_opts_phase() { _post_loop_opts_phase = true; }
787 void reset_post_loop_opts_phase() { _post_loop_opts_phase = false; }
788
789 #ifdef ASSERT
790 bool phase_verify_ideal_loop() const { return _phase_verify_ideal_loop; }
791 void set_phase_verify_ideal_loop() { _phase_verify_ideal_loop = true; }
792 void reset_phase_verify_ideal_loop() { _phase_verify_ideal_loop = false; }
793 #endif
794
795 bool allow_macro_nodes() { return _allow_macro_nodes; }
796 void reset_allow_macro_nodes() { _allow_macro_nodes = false; }
797
798 void record_for_post_loop_opts_igvn(Node* n);
799 void remove_from_post_loop_opts_igvn(Node* n);
800 void process_for_post_loop_opts_igvn(PhaseIterGVN& igvn);
801
802 void record_unstable_if_trap(UnstableIfTrap* trap);
803 bool remove_unstable_if_trap(CallStaticJavaNode* unc, bool yield);
804 void remove_useless_unstable_if_traps(Unique_Node_List &useful);
805 void process_for_unstable_if_traps(PhaseIterGVN& igvn);
806
807 bool merge_stores_phase() { return _merge_stores_phase; }
808 void set_merge_stores_phase() { _merge_stores_phase = true; }
809 void record_for_merge_stores_igvn(Node* n);
810 void remove_from_merge_stores_igvn(Node* n);
811 void process_for_merge_stores_igvn(PhaseIterGVN& igvn);
812
813 void shuffle_late_inlines();
814 void shuffle_macro_nodes();
815 void sort_macro_nodes();
816
817 void mark_parse_predicate_nodes_useless(PhaseIterGVN& igvn);
818
819 // Are there candidate expensive nodes for optimization?
820 bool should_optimize_expensive_nodes(PhaseIterGVN &igvn);
821 // Check whether n1 and n2 are similar
965 Arena* type_arena() { return _type_arena; }
966 Dict* type_dict() { return _type_dict; }
967 size_t type_last_size() { return _type_last_size; }
968 int num_alias_types() { return _num_alias_types; }
969
970 void init_type_arena() { _type_arena = &_Compile_types; }
971 void set_type_arena(Arena* a) { _type_arena = a; }
972 void set_type_dict(Dict* d) { _type_dict = d; }
973 void set_type_last_size(size_t sz) { _type_last_size = sz; }
974
975 const TypeFunc* last_tf(ciMethod* m) {
976 return (m == _last_tf_m) ? _last_tf : nullptr;
977 }
978 void set_last_tf(ciMethod* m, const TypeFunc* tf) {
979 assert(m != nullptr || tf == nullptr, "");
980 _last_tf_m = m;
981 _last_tf = tf;
982 }
983
984 AliasType* alias_type(int idx) { assert(idx < num_alias_types(), "oob"); return _alias_types[idx]; }
985 AliasType* alias_type(const TypePtr* adr_type, ciField* field = nullptr) { return find_alias_type(adr_type, false, field); }
986 bool have_alias_type(const TypePtr* adr_type);
987 AliasType* alias_type(ciField* field);
988
989 int get_alias_index(const TypePtr* at) { return alias_type(at)->index(); }
990 const TypePtr* get_adr_type(uint aidx) { return alias_type(aidx)->adr_type(); }
991 int get_general_index(uint aidx) { return alias_type(aidx)->general_index(); }
992
993 // Building nodes
994 void rethrow_exceptions(JVMState* jvms);
995 void return_values(JVMState* jvms);
996 JVMState* build_start_state(StartNode* start, const TypeFunc* tf);
997
998 // Decide how to build a call.
999 // The profile factor is a discount to apply to this site's interp. profile.
1000 CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch,
1001 JVMState* jvms, bool allow_inline, float profile_factor, ciKlass* speculative_receiver_type = nullptr,
1002 bool allow_intrinsics = true);
1003 bool should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
1004 return C->directive()->should_delay_inline(call_method) ||
1005 should_delay_string_inlining(call_method, jvms) ||
1006 should_delay_boxing_inlining(call_method, jvms) ||
1007 should_delay_vector_inlining(call_method, jvms);
1008 }
1009 bool should_delay_after_inlining_cutoff(ciMethod* callee, ciMethod* caller);
1220 // Number of outgoing stack slots killed above the out_preserve_stack_slots
1221 // for calls to C. Supports the var-args backing area for register parms.
1222 uint varargs_C_out_slots_killed() const;
1223
1224 // Number of Stack Slots consumed by a synchronization entry
1225 int sync_stack_slots() const;
1226
1227 // Compute the name of old_SP. See <arch>.ad for frame layout.
1228 OptoReg::Name compute_old_SP();
1229
1230 private:
1231 // Phase control:
1232 void Init(bool aliasing); // Prepare for a single compilation
1233 void Optimize(); // Given a graph, optimize it
1234 void Code_Gen(); // Generate code from a graph
1235
1236 // Management of the AliasType table.
1237 void grow_alias_types();
1238 AliasCacheEntry* probe_alias_cache(const TypePtr* adr_type);
1239 const TypePtr *flatten_alias_type(const TypePtr* adr_type) const;
1240 AliasType* find_alias_type(const TypePtr* adr_type, bool no_create, ciField* field);
1241
1242 void verify_top(Node*) const PRODUCT_RETURN;
1243
1244 // Intrinsic setup.
1245 CallGenerator* make_vm_intrinsic(ciMethod* m, bool is_virtual); // constructor
1246 int intrinsic_insertion_index(ciMethod* m, bool is_virtual, bool& found); // helper
1247 CallGenerator* find_intrinsic(ciMethod* m, bool is_virtual); // query fn
1248 void register_intrinsic(CallGenerator* cg); // update fn
1249
1250 #ifndef PRODUCT
1251 static juint _intrinsic_hist_count[];
1252 static jubyte _intrinsic_hist_flags[];
1253 #endif
1254 // Function calls made by the public function final_graph_reshaping.
1255 // No need to be made public as they are not called elsewhere.
1256 void final_graph_reshaping_impl(Node *n, Final_Reshape_Counts& frc, Unique_Node_List& dead_nodes);
1257 void final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& frc, uint nop, Unique_Node_List& dead_nodes);
1258 void final_graph_reshaping_walk(Node_Stack& nstack, Node* root, Final_Reshape_Counts& frc, Unique_Node_List& dead_nodes);
1259 void handle_div_mod_op(Node* n, BasicType bt, bool is_unsigned);
1260
1313 // Verify ADLC assumptions during startup
1314 static void adlc_verification() PRODUCT_RETURN;
1315
1316 // Definitions of pd methods
1317 static void pd_compiler2_init();
1318
1319 // Materialize reachability fences from reachability edges on safepoints.
1320 void expand_reachability_edges(Unique_Node_List& safepoints);
1321
1322 // Static parse-time type checking logic for gen_subtype_check:
1323 enum SubTypeCheckResult { SSC_always_false, SSC_always_true, SSC_easy_test, SSC_full_test };
1324 SubTypeCheckResult static_subtype_check(const TypeKlassPtr* superk, const TypeKlassPtr* subk, bool skip = StressReflectiveCode);
1325
1326 static Node* conv_I2X_index(PhaseGVN* phase, Node* offset, const TypeInt* sizetype,
1327 // Optional control dependency (for example, on range check)
1328 Node* ctrl = nullptr);
1329
1330 // Convert integer value to a narrowed long type dependent on ctrl (for example, a range check)
1331 static Node* constrained_convI2L(PhaseGVN* phase, Node* value, const TypeInt* itype, Node* ctrl, bool carry_dependency = false);
1332
1333 // Auxiliary methods for randomized fuzzing/stressing
1334 int random();
1335 bool randomized_select(int count);
1336
1337 // seed random number generation and log the seed for repeatability.
1338 void initialize_stress_seed(const DirectiveSet* directive);
1339
1340 // supporting clone_map
1341 CloneMap& clone_map();
1342 void set_clone_map(Dict* d);
1343
1344 bool needs_clinit_barrier(ciField* ik, ciMethod* accessing_method);
1345 bool needs_clinit_barrier(ciMethod* ik, ciMethod* accessing_method);
1346 bool needs_clinit_barrier(ciInstanceKlass* ik, ciMethod* accessing_method);
1347
1348 #ifdef ASSERT
1349 VerifyMeetResult* _type_verify;
1350 void set_exception_backedge() { _exception_backedge = true; }
1351 bool has_exception_backedge() const { return _exception_backedge; }
1352 #endif
1353
|
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;
82 class PhaseRegAlloc;
83 class PhaseCCP;
84 class PhaseOutput;
85 class ReachabilityFenceNode;
86 class RootNode;
87 class relocInfo;
88 class StartNode;
89 class SafePointNode;
90 class JVMState;
91 class Type;
92 class TypeInt;
93 class TypeInteger;
94 class TypeKlassPtr;
95 class TypePtr;
96 class TypeOopPtr;
97 class TypeFunc;
98 class TypeVect;
99 class Type_Array;
100 class Unique_Node_List;
101 class UnstableIfTrap;
102 class InlineTypeNode;
103 class nmethod;
104 class Node_Stack;
105 struct Final_Reshape_Counts;
106 class VerifyMeetResult;
107
108 enum LoopOptsMode {
109 LoopOptsDefault,
110 LoopOptsNone,
111 LoopOptsMaxUnroll,
112 LoopOptsSkipSplitIf,
113 LoopOptsVerify,
114 PostLoopOptsExpandReachabilityFences
115 };
116
117 // The type of all node counts and indexes.
118 // It must hold at least 16 bits, but must also be fast to load and store.
119 // This type, if less than 32 bits, could limit the number of possible nodes.
120 // (To make this type platform-specific, move to globalDefinitions_xxx.hpp.)
121 typedef unsigned int node_idx_t;
122
322 // allocator i.e. locks, original deopt pc, etc.
323 uintx _max_node_limit; // Max unique node count during a single compilation.
324 uint _node_count_inlining_cutoff; // Number of nodes in the graph above which inlining is denied
325
326 bool _post_loop_opts_phase; // Loop opts are finished.
327 bool _merge_stores_phase; // Phase for merging stores, after post loop opts phase.
328 bool _allow_macro_nodes; // True if we allow creation of macro nodes.
329
330 /* If major progress is set:
331 * Marks that the loop tree information (get_ctrl, idom, get_loop, etc.) could be invalid, and we need to rebuild the loop tree.
332 * It also indicates that the graph was changed in a way that is promising to be able to apply more loop optimization.
333 * If major progress is not set:
334 * Loop tree information is valid.
335 * 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.
336 *
337 * This is not 100% accurate, the semantics of major progress has become less clear over time, but this is the general idea.
338 */
339 bool _major_progress;
340 bool _inlining_progress; // progress doing incremental inlining?
341 bool _inlining_incrementally;// Are we doing incremental inlining (post parse)
342 bool _strength_reduction; // Are we doing strength reduction to direct call
343 bool _do_cleanup; // Cleanup is needed before proceeding with incremental inlining
344 bool _has_loops; // True if the method _may_ have some loops
345 bool _has_split_ifs; // True if the method _may_ have some split-if
346 bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores.
347 bool _has_stringbuilder; // True StringBuffers or StringBuilders are allocated
348 bool _has_boxed_value; // True if a boxed object is allocated
349 bool _has_reserved_stack_access; // True if the method or an inlined method is annotated with ReservedStackAccess
350 bool _has_circular_inline_type; // True if method loads an inline type with a circular, non-flat field
351 bool _needs_nm_slot; // True if an extra stack slot is needed to hold the null marker at scalarized returns
352 uint _max_vector_size; // Maximum size of generated vectors
353 bool _clear_upper_avx; // Clear upper bits of ymm registers using vzeroupper
354 uint _trap_hist[trapHistLength]; // Cumulative traps
355 bool _trap_can_recompile; // Have we emitted a recompiling trap?
356 uint _decompile_count; // Cumulative decompilation counts.
357 bool _do_inlining; // True if we intend to do inlining
358 bool _do_scheduling; // True if we intend to do scheduling
359 bool _do_freq_based_layout; // True if we intend to do frequency based block layout
360 bool _do_vector_loop; // True if allowed to execute loop in parallel iterations
361 bool _use_cmove; // True if CMove should be used without profitability analysis
362 bool _do_aliasing; // True if we intend to do aliasing
363 bool _print_assembly; // True if we should dump assembly code for this compilation
364 bool _print_inlining; // True if we should print inlining for this compilation
365 bool _print_intrinsics; // True if we should print intrinsics for this compilation
366 bool _print_phase_loop_opts; // True if we should print before and after loop opts phase
367 #ifndef PRODUCT
368 uint _phase_counter; // Counter for the number of already printed phases
369 uint _igv_idx; // Counter for IGV node identifiers
370 uint _igv_phase_iter[PHASE_NUM_TYPES]; // Counters for IGV phase iterations
371 bool _trace_opto_output;
372 bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
373 #endif
374 bool _has_irreducible_loop; // Found irreducible loops
375 bool _has_monitors; // Metadata transfered to nmethod to enable Continuations lock-detection fastpath
376 bool _has_scoped_access; // For shared scope closure
377 bool _clinit_barrier_on_entry; // True if clinit barrier is needed on nmethod entry
378 int _loop_opts_cnt; // loop opts round
379 bool _has_flat_accesses; // Any known flat array accesses?
380 bool _flat_accesses_share_alias; // Initially all flat array share a single slice
381 bool _scalarize_in_safepoints; // Scalarize inline types in safepoint debug info
382 uint _stress_seed; // Seed for stress testing
383
384 // Compilation environment.
385 Arena _comp_arena; // Arena with lifetime equivalent to Compile
386 void* _barrier_set_state; // Potential GC barrier state for Compile
387 ciEnv* _env; // CI interface
388 DirectiveSet* _directive; // Compiler directive
389 CompileLog* _log; // from CompilerThread
390 CHeapStringHolder _failure_reason; // for record_failure/failing pattern
391 CompilationFailureInfo* _first_failure_details; // Details for the first failure happening during compilation
392 GrowableArray<CallGenerator*> _intrinsics; // List of intrinsics.
393 GrowableArray<Node*> _macro_nodes; // List of nodes which need to be expanded before matching.
394 GrowableArray<ParsePredicateNode*> _parse_predicates; // List of Parse Predicates.
395 // List of OpaqueTemplateAssertionPredicateNode nodes for Template Assertion Predicates which can be seen as list
396 // of Template Assertion Predicates themselves.
397 GrowableArray<OpaqueTemplateAssertionPredicateNode*> _template_assertion_predicate_opaques;
398 GrowableArray<Node*> _expensive_nodes; // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
399 GrowableArray<ReachabilityFenceNode*> _reachability_fences; // List of reachability fences
400 GrowableArray<Node*> _for_post_loop_igvn; // List of nodes for IGVN after loop opts are over
401 GrowableArray<Node*> _inline_type_nodes; // List of InlineType nodes
402 GrowableArray<Node*> _flat_access_nodes; // List of LoadFlat and StoreFlat nodes
403 GrowableArray<Node*> _for_merge_stores_igvn; // List of nodes for IGVN merge stores
404 GrowableArray<UnstableIfTrap*> _unstable_if_traps; // List of ifnodes after IGVN
405 GrowableArray<Node_List*> _coarsened_locks; // List of coarsened Lock and Unlock nodes
406 ConnectionGraph* _congraph;
407 #ifndef PRODUCT
408 IdealGraphPrinter* _igv_printer;
409 static IdealGraphPrinter* _debug_file_printer;
410 static IdealGraphPrinter* _debug_network_printer;
411 #endif
412
413
414 // Node management
415 uint _unique; // Counter for unique Node indices
416 uint _dead_node_count; // Number of dead nodes; VectorSet::Size() is O(N).
417 // So use this to keep count and make the call O(1).
418 VectorSet _dead_node_list; // Set of dead nodes
419 DEBUG_ONLY(Unique_Node_List* _modified_nodes;) // List of nodes which inputs were modified
420 DEBUG_ONLY(bool _phase_optimize_finished;) // Used for live node verification while creating new nodes
421
422 DEBUG_ONLY(bool _phase_verify_ideal_loop;) // Are we in PhaseIdealLoop verification?
596 ciMethod* method() const { return _method; }
597 int entry_bci() const { return _entry_bci; }
598 bool is_osr_compilation() const { return _entry_bci != InvocationEntryBci; }
599 bool is_method_compilation() const { return (_method != nullptr && !_method->flags().is_native()); }
600 const TypeFunc* tf() const { assert(_tf!=nullptr, ""); return _tf; }
601 void init_tf(const TypeFunc* tf) { assert(_tf==nullptr, ""); _tf = tf; }
602 InlineTree* ilt() const { return _ilt; }
603 address stub_function() const { return _stub_function; }
604 const char* stub_name() const { return _stub_name; }
605 StubId stub_id() const { return _stub_id; }
606 address stub_entry_point() const { return _stub_entry_point; }
607 void set_stub_entry_point(address z) { _stub_entry_point = z; }
608
609 // Control of this compilation.
610 int fixed_slots() const { assert(_fixed_slots >= 0, ""); return _fixed_slots; }
611 void set_fixed_slots(int n) { _fixed_slots = n; }
612 void set_inlining_progress(bool z) { _inlining_progress = z; }
613 bool inlining_progress() const { return _inlining_progress; }
614 void set_inlining_incrementally(bool z) { _inlining_incrementally = z; }
615 bool inlining_incrementally() const { return _inlining_incrementally; }
616 void set_strength_reduction(bool z) { _strength_reduction = z; }
617 bool strength_reduction() const { return _strength_reduction; }
618 void set_do_cleanup(bool z) { _do_cleanup = z; }
619 bool do_cleanup() const { return _do_cleanup; }
620 bool major_progress() const { return _major_progress; }
621 void set_major_progress() { _major_progress = true; }
622 void restore_major_progress(bool progress) { _major_progress = _major_progress || progress; }
623 void clear_major_progress() { _major_progress = false; }
624 int max_inline_size() const { return _max_inline_size; }
625 void set_freq_inline_size(int n) { _freq_inline_size = n; }
626 int freq_inline_size() const { return _freq_inline_size; }
627 void set_max_inline_size(int n) { _max_inline_size = n; }
628 bool has_loops() const { return _has_loops; }
629 void set_has_loops(bool z) { _has_loops = z; }
630 bool has_split_ifs() const { return _has_split_ifs; }
631 void set_has_split_ifs(bool z) { _has_split_ifs = z; }
632 bool has_unsafe_access() const { return _has_unsafe_access; }
633 void set_has_unsafe_access(bool z) { _has_unsafe_access = z; }
634 bool has_stringbuilder() const { return _has_stringbuilder; }
635 void set_has_stringbuilder(bool z) { _has_stringbuilder = z; }
636 bool has_boxed_value() const { return _has_boxed_value; }
637 void set_has_boxed_value(bool z) { _has_boxed_value = z; }
638 bool has_reserved_stack_access() const { return _has_reserved_stack_access; }
639 void set_has_reserved_stack_access(bool z) { _has_reserved_stack_access = z; }
640 bool has_circular_inline_type() const { return _has_circular_inline_type; }
641 void set_has_circular_inline_type(bool z) { _has_circular_inline_type = z; }
642 uint max_vector_size() const { return _max_vector_size; }
643 void set_max_vector_size(uint s) { _max_vector_size = s; }
644 bool clear_upper_avx() const { return _clear_upper_avx; }
645 void set_clear_upper_avx(bool s) { _clear_upper_avx = s; }
646 void set_trap_count(uint r, uint c) { assert(r < trapHistLength, "oob"); _trap_hist[r] = c; }
647 uint trap_count(uint r) const { assert(r < trapHistLength, "oob"); return _trap_hist[r]; }
648 bool trap_can_recompile() const { return _trap_can_recompile; }
649 void set_trap_can_recompile(bool z) { _trap_can_recompile = z; }
650 uint decompile_count() const { return _decompile_count; }
651 void set_decompile_count(uint c) { _decompile_count = c; }
652 bool allow_range_check_smearing() const;
653 bool do_inlining() const { return _do_inlining; }
654 void set_do_inlining(bool z) { _do_inlining = z; }
655 bool do_scheduling() const { return _do_scheduling; }
656 void set_do_scheduling(bool z) { _do_scheduling = z; }
657 bool do_freq_based_layout() const{ return _do_freq_based_layout; }
658 void set_do_freq_based_layout(bool z){ _do_freq_based_layout = z; }
659 bool do_vector_loop() const { return _do_vector_loop; }
660 void set_do_vector_loop(bool z) { _do_vector_loop = z; }
661 bool use_cmove() const { return _use_cmove; }
662 void set_use_cmove(bool z) { _use_cmove = z; }
663 bool do_aliasing() const { return _do_aliasing; }
664 bool print_assembly() const { return _print_assembly; }
665 void set_print_assembly(bool z) { _print_assembly = z; }
666 bool print_inlining() const { return _print_inlining; }
667 void set_print_inlining(bool z) { _print_inlining = z; }
668 bool print_intrinsics() const { return _print_intrinsics; }
669 void set_print_intrinsics(bool z) { _print_intrinsics = z; }
670 uint max_node_limit() const { return (uint)_max_node_limit; }
671 void set_max_node_limit(uint n) { _max_node_limit = n; }
672 uint node_count_inlining_cutoff() const { return _node_count_inlining_cutoff; }
673 void set_node_count_inlining_cutoff(uint n) { _node_count_inlining_cutoff = 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 void set_flat_accesses() { _has_flat_accesses = true; }
677 bool flat_accesses_share_alias() const { return _flat_accesses_share_alias; }
678 void set_flat_accesses_share_alias(bool z) { _flat_accesses_share_alias = z; }
679 bool scalarize_in_safepoints() const { return _scalarize_in_safepoints; }
680 void set_scalarize_in_safepoints(bool z) { _scalarize_in_safepoints = z; }
681
682 // Support for scalarized inline type calling convention
683 bool has_scalarized_args() const { return _method != nullptr && _method->has_scalarized_args(); }
684 bool needs_stack_repair() const { return _method != nullptr && _method->c2_needs_stack_repair(); }
685 bool needs_nm_slot() const { return _needs_nm_slot; }
686 void set_needs_nm_slot(bool v) { _needs_nm_slot = v; }
687
688 bool has_monitors() const { return _has_monitors; }
689 void set_has_monitors(bool v) { _has_monitors = v; }
690 bool has_scoped_access() const { return _has_scoped_access; }
691 void set_has_scoped_access(bool v) { _has_scoped_access = v; }
692
693 // check the CompilerOracle for special behaviours for this compile
694 bool method_has_option(CompileCommandEnum option) const {
695 return method() != nullptr && method()->has_option(option);
696 }
697
698 #ifndef PRODUCT
699 uint next_igv_idx() { return _igv_idx++; }
700 bool trace_opto_output() const { return _trace_opto_output; }
701 void print_phase(const char* phase_name);
702 void print_ideal_ir(const char* compile_phase_name) const;
703 bool should_print_ideal() const { return _directive->PrintIdealOption; }
704 bool parsed_irreducible_loop() const { return _parsed_irreducible_loop; }
705 void set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; }
706 int _in_dump_cnt; // Required for dumping ir nodes.
707 #endif
809 bool coarsened_locks_consistent();
810 void mark_unbalanced_boxes() const;
811
812 bool post_loop_opts_phase() { return _post_loop_opts_phase; }
813 void set_post_loop_opts_phase() { _post_loop_opts_phase = true; }
814 void reset_post_loop_opts_phase() { _post_loop_opts_phase = false; }
815
816 #ifdef ASSERT
817 bool phase_verify_ideal_loop() const { return _phase_verify_ideal_loop; }
818 void set_phase_verify_ideal_loop() { _phase_verify_ideal_loop = true; }
819 void reset_phase_verify_ideal_loop() { _phase_verify_ideal_loop = false; }
820 #endif
821
822 bool allow_macro_nodes() { return _allow_macro_nodes; }
823 void reset_allow_macro_nodes() { _allow_macro_nodes = false; }
824
825 void record_for_post_loop_opts_igvn(Node* n);
826 void remove_from_post_loop_opts_igvn(Node* n);
827 void process_for_post_loop_opts_igvn(PhaseIterGVN& igvn);
828
829 // Keep track of inline type nodes for later processing
830 void add_inline_type(Node* n);
831 void remove_inline_type(Node* n);
832
833 bool clear_argument_if_only_used_as_buffer_at_calls(Node* result_cast, PhaseIterGVN& igvn);
834
835 void process_inline_types(PhaseIterGVN &igvn, bool remove = false);
836
837 void add_flat_access(Node* n);
838 void remove_flat_access(Node* n);
839 void process_flat_accesses(PhaseIterGVN& igvn);
840
841 template <class F>
842 void for_each_flat_access(F consumer) {
843 for (int i = _flat_access_nodes.length() - 1; i >= 0; i--) {
844 consumer(_flat_access_nodes.at(i));
845 }
846 }
847
848 void adjust_flat_array_access_aliases(PhaseIterGVN& igvn);
849
850 void record_unstable_if_trap(UnstableIfTrap* trap);
851 bool remove_unstable_if_trap(CallStaticJavaNode* unc, bool yield);
852 void remove_useless_unstable_if_traps(Unique_Node_List &useful);
853 void process_for_unstable_if_traps(PhaseIterGVN& igvn);
854
855 bool merge_stores_phase() { return _merge_stores_phase; }
856 void set_merge_stores_phase() { _merge_stores_phase = true; }
857 void record_for_merge_stores_igvn(Node* n);
858 void remove_from_merge_stores_igvn(Node* n);
859 void process_for_merge_stores_igvn(PhaseIterGVN& igvn);
860
861 void shuffle_late_inlines();
862 void shuffle_macro_nodes();
863 void sort_macro_nodes();
864
865 void mark_parse_predicate_nodes_useless(PhaseIterGVN& igvn);
866
867 // Are there candidate expensive nodes for optimization?
868 bool should_optimize_expensive_nodes(PhaseIterGVN &igvn);
869 // Check whether n1 and n2 are similar
1013 Arena* type_arena() { return _type_arena; }
1014 Dict* type_dict() { return _type_dict; }
1015 size_t type_last_size() { return _type_last_size; }
1016 int num_alias_types() { return _num_alias_types; }
1017
1018 void init_type_arena() { _type_arena = &_Compile_types; }
1019 void set_type_arena(Arena* a) { _type_arena = a; }
1020 void set_type_dict(Dict* d) { _type_dict = d; }
1021 void set_type_last_size(size_t sz) { _type_last_size = sz; }
1022
1023 const TypeFunc* last_tf(ciMethod* m) {
1024 return (m == _last_tf_m) ? _last_tf : nullptr;
1025 }
1026 void set_last_tf(ciMethod* m, const TypeFunc* tf) {
1027 assert(m != nullptr || tf == nullptr, "");
1028 _last_tf_m = m;
1029 _last_tf = tf;
1030 }
1031
1032 AliasType* alias_type(int idx) { assert(idx < num_alias_types(), "oob"); return _alias_types[idx]; }
1033 AliasType* alias_type(const TypePtr* adr_type, ciField* field = nullptr, bool uncached = false) { return find_alias_type(adr_type, false, field, uncached); }
1034 bool have_alias_type(const TypePtr* adr_type);
1035 AliasType* alias_type(ciField* field);
1036
1037 int get_alias_index(const TypePtr* at, bool uncached = false) { return alias_type(at, nullptr, uncached)->index(); }
1038 const TypePtr* get_adr_type(uint aidx) { return alias_type(aidx)->adr_type(); }
1039 int get_general_index(uint aidx) { return alias_type(aidx)->general_index(); }
1040
1041 // Building nodes
1042 void rethrow_exceptions(JVMState* jvms);
1043 void return_values(JVMState* jvms);
1044 JVMState* build_start_state(StartNode* start, const TypeFunc* tf);
1045
1046 // Decide how to build a call.
1047 // The profile factor is a discount to apply to this site's interp. profile.
1048 CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch,
1049 JVMState* jvms, bool allow_inline, float profile_factor, ciKlass* speculative_receiver_type = nullptr,
1050 bool allow_intrinsics = true);
1051 bool should_delay_inlining(ciMethod* call_method, JVMState* jvms) {
1052 return C->directive()->should_delay_inline(call_method) ||
1053 should_delay_string_inlining(call_method, jvms) ||
1054 should_delay_boxing_inlining(call_method, jvms) ||
1055 should_delay_vector_inlining(call_method, jvms);
1056 }
1057 bool should_delay_after_inlining_cutoff(ciMethod* callee, ciMethod* caller);
1268 // Number of outgoing stack slots killed above the out_preserve_stack_slots
1269 // for calls to C. Supports the var-args backing area for register parms.
1270 uint varargs_C_out_slots_killed() const;
1271
1272 // Number of Stack Slots consumed by a synchronization entry
1273 int sync_stack_slots() const;
1274
1275 // Compute the name of old_SP. See <arch>.ad for frame layout.
1276 OptoReg::Name compute_old_SP();
1277
1278 private:
1279 // Phase control:
1280 void Init(bool aliasing); // Prepare for a single compilation
1281 void Optimize(); // Given a graph, optimize it
1282 void Code_Gen(); // Generate code from a graph
1283
1284 // Management of the AliasType table.
1285 void grow_alias_types();
1286 AliasCacheEntry* probe_alias_cache(const TypePtr* adr_type);
1287 const TypePtr *flatten_alias_type(const TypePtr* adr_type) const;
1288 AliasType* find_alias_type(const TypePtr* adr_type, bool no_create, ciField* field, bool uncached = false);
1289
1290 void verify_top(Node*) const PRODUCT_RETURN;
1291
1292 // Intrinsic setup.
1293 CallGenerator* make_vm_intrinsic(ciMethod* m, bool is_virtual); // constructor
1294 int intrinsic_insertion_index(ciMethod* m, bool is_virtual, bool& found); // helper
1295 CallGenerator* find_intrinsic(ciMethod* m, bool is_virtual); // query fn
1296 void register_intrinsic(CallGenerator* cg); // update fn
1297
1298 #ifndef PRODUCT
1299 static juint _intrinsic_hist_count[];
1300 static jubyte _intrinsic_hist_flags[];
1301 #endif
1302 // Function calls made by the public function final_graph_reshaping.
1303 // No need to be made public as they are not called elsewhere.
1304 void final_graph_reshaping_impl(Node *n, Final_Reshape_Counts& frc, Unique_Node_List& dead_nodes);
1305 void final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& frc, uint nop, Unique_Node_List& dead_nodes);
1306 void final_graph_reshaping_walk(Node_Stack& nstack, Node* root, Final_Reshape_Counts& frc, Unique_Node_List& dead_nodes);
1307 void handle_div_mod_op(Node* n, BasicType bt, bool is_unsigned);
1308
1361 // Verify ADLC assumptions during startup
1362 static void adlc_verification() PRODUCT_RETURN;
1363
1364 // Definitions of pd methods
1365 static void pd_compiler2_init();
1366
1367 // Materialize reachability fences from reachability edges on safepoints.
1368 void expand_reachability_edges(Unique_Node_List& safepoints);
1369
1370 // Static parse-time type checking logic for gen_subtype_check:
1371 enum SubTypeCheckResult { SSC_always_false, SSC_always_true, SSC_easy_test, SSC_full_test };
1372 SubTypeCheckResult static_subtype_check(const TypeKlassPtr* superk, const TypeKlassPtr* subk, bool skip = StressReflectiveCode);
1373
1374 static Node* conv_I2X_index(PhaseGVN* phase, Node* offset, const TypeInt* sizetype,
1375 // Optional control dependency (for example, on range check)
1376 Node* ctrl = nullptr);
1377
1378 // Convert integer value to a narrowed long type dependent on ctrl (for example, a range check)
1379 static Node* constrained_convI2L(PhaseGVN* phase, Node* value, const TypeInt* itype, Node* ctrl, bool carry_dependency = false);
1380
1381 // Auxiliary method for randomized fuzzing/stressing
1382 int random();
1383 bool randomized_select(int count);
1384
1385 // seed random number generation and log the seed for repeatability.
1386 void initialize_stress_seed(const DirectiveSet* directive);
1387
1388 // supporting clone_map
1389 CloneMap& clone_map();
1390 void set_clone_map(Dict* d);
1391
1392 bool needs_clinit_barrier(ciField* ik, ciMethod* accessing_method);
1393 bool needs_clinit_barrier(ciMethod* ik, ciMethod* accessing_method);
1394 bool needs_clinit_barrier(ciInstanceKlass* ik, ciMethod* accessing_method);
1395
1396 #ifdef ASSERT
1397 VerifyMeetResult* _type_verify;
1398 void set_exception_backedge() { _exception_backedge = true; }
1399 bool has_exception_backedge() const { return _exception_backedge; }
1400 #endif
1401
|