comparison src/share/vm/opto/compile.hpp @ 7473:d092d1b31229

8005071: Incremental inlining for JSR 292 Summary: post parse inlining driven by number of live nodes. Reviewed-by: twisti, kvn, jrose
author roland
date Sun, 23 Dec 2012 17:08:22 +0100
parents ad5dd04754ee
children 5698813d45eb
comparison
equal deleted inserted replaced
7445:cd962e15c08e 7473:d092d1b31229
278 // For deopt 278 // For deopt
279 int _orig_pc_slot; 279 int _orig_pc_slot;
280 int _orig_pc_slot_offset_in_bytes; 280 int _orig_pc_slot_offset_in_bytes;
281 281
282 int _major_progress; // Count of something big happening 282 int _major_progress; // Count of something big happening
283 bool _inlining_progress; // progress doing incremental inlining?
284 bool _inlining_incrementally;// Are we doing incremental inlining (post parse)
283 bool _has_loops; // True if the method _may_ have some loops 285 bool _has_loops; // True if the method _may_ have some loops
284 bool _has_split_ifs; // True if the method _may_ have some split-if 286 bool _has_split_ifs; // True if the method _may_ have some split-if
285 bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores. 287 bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores.
286 bool _has_stringbuilder; // True StringBuffers or StringBuilders are allocated 288 bool _has_stringbuilder; // True StringBuffers or StringBuilders are allocated
287 int _max_vector_size; // Maximum size of generated vectors 289 int _max_vector_size; // Maximum size of generated vectors
365 // Parsing, optimization 367 // Parsing, optimization
366 PhaseGVN* _initial_gvn; // Results of parse-time PhaseGVN 368 PhaseGVN* _initial_gvn; // Results of parse-time PhaseGVN
367 Unique_Node_List* _for_igvn; // Initial work-list for next round of Iterative GVN 369 Unique_Node_List* _for_igvn; // Initial work-list for next round of Iterative GVN
368 WarmCallInfo* _warm_calls; // Sorted work-list for heat-based inlining. 370 WarmCallInfo* _warm_calls; // Sorted work-list for heat-based inlining.
369 371
370 GrowableArray<CallGenerator*> _late_inlines; // List of CallGenerators to be revisited after 372 GrowableArray<CallGenerator*> _late_inlines; // List of CallGenerators to be revisited after
371 // main parsing has finished. 373 // main parsing has finished.
374 GrowableArray<CallGenerator*> _string_late_inlines; // same but for string operations
375
376 int _late_inlines_pos; // Where in the queue should the next late inlining candidate go (emulate depth first inlining)
377 uint _number_of_mh_late_inlines; // number of method handle late inlining still pending
378
372 379
373 // Inlining may not happen in parse order which would make 380 // Inlining may not happen in parse order which would make
374 // PrintInlining output confusing. Keep track of PrintInlining 381 // PrintInlining output confusing. Keep track of PrintInlining
375 // pieces in order. 382 // pieces in order.
376 class PrintInliningBuffer : public ResourceObj { 383 class PrintInliningBuffer : public ResourceObj {
489 496
490 // Control of this compilation. 497 // Control of this compilation.
491 int fixed_slots() const { assert(_fixed_slots >= 0, ""); return _fixed_slots; } 498 int fixed_slots() const { assert(_fixed_slots >= 0, ""); return _fixed_slots; }
492 void set_fixed_slots(int n) { _fixed_slots = n; } 499 void set_fixed_slots(int n) { _fixed_slots = n; }
493 int major_progress() const { return _major_progress; } 500 int major_progress() const { return _major_progress; }
501 void set_inlining_progress(bool z) { _inlining_progress = z; }
502 int inlining_progress() const { return _inlining_progress; }
503 void set_inlining_incrementally(bool z) { _inlining_incrementally = z; }
504 int inlining_incrementally() const { return _inlining_incrementally; }
494 void set_major_progress() { _major_progress++; } 505 void set_major_progress() { _major_progress++; }
495 void clear_major_progress() { _major_progress = 0; } 506 void clear_major_progress() { _major_progress = 0; }
496 int num_loop_opts() const { return _num_loop_opts; } 507 int num_loop_opts() const { return _num_loop_opts; }
497 void set_num_loop_opts(int n) { _num_loop_opts = n; } 508 void set_num_loop_opts(int n) { _num_loop_opts = n; }
498 int max_inline_size() const { return _max_inline_size; } 509 int max_inline_size() const { return _max_inline_size; }
727 void return_values(JVMState* jvms); 738 void return_values(JVMState* jvms);
728 JVMState* build_start_state(StartNode* start, const TypeFunc* tf); 739 JVMState* build_start_state(StartNode* start, const TypeFunc* tf);
729 740
730 // Decide how to build a call. 741 // Decide how to build a call.
731 // The profile factor is a discount to apply to this site's interp. profile. 742 // The profile factor is a discount to apply to this site's interp. profile.
732 CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true); 743 CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true, bool delayed_forbidden = false);
733 bool should_delay_inlining(ciMethod* call_method, JVMState* jvms); 744 bool should_delay_inlining(ciMethod* call_method, JVMState* jvms);
734 745
735 // Report if there were too many traps at a current method and bci. 746 // Report if there were too many traps at a current method and bci.
736 // Report if a trap was recorded, and/or PerMethodTrapLimit was exceeded. 747 // Report if a trap was recorded, and/or PerMethodTrapLimit was exceeded.
737 // If there is no MDO at all, report no trap unless told to assume it. 748 // If there is no MDO at all, report no trap unless told to assume it.
763 WarmCallInfo* warm_calls() const { return _warm_calls; } 774 WarmCallInfo* warm_calls() const { return _warm_calls; }
764 void set_warm_calls(WarmCallInfo* l) { _warm_calls = l; } 775 void set_warm_calls(WarmCallInfo* l) { _warm_calls = l; }
765 WarmCallInfo* pop_warm_call(); 776 WarmCallInfo* pop_warm_call();
766 777
767 // Record this CallGenerator for inlining at the end of parsing. 778 // Record this CallGenerator for inlining at the end of parsing.
768 void add_late_inline(CallGenerator* cg) { _late_inlines.push(cg); } 779 void add_late_inline(CallGenerator* cg) {
780 _late_inlines.insert_before(_late_inlines_pos, cg);
781 _late_inlines_pos++;
782 }
783
784 void prepend_late_inline(CallGenerator* cg) {
785 _late_inlines.insert_before(0, cg);
786 }
787
788 void add_string_late_inline(CallGenerator* cg) {
789 _string_late_inlines.push(cg);
790 }
791
792 void remove_useless_late_inlines(GrowableArray<CallGenerator*>* inlines, Unique_Node_List &useful);
769 793
770 void dump_inlining(); 794 void dump_inlining();
795
796 bool over_inlining_cutoff() const {
797 if (!inlining_incrementally()) {
798 return unique() > (uint)NodeCountInliningCutoff;
799 } else {
800 return live_nodes() > (uint)LiveNodeCountInliningCutoff;
801 }
802 }
803
804 void inc_number_of_mh_late_inlines() { _number_of_mh_late_inlines++; }
805 void dec_number_of_mh_late_inlines() { assert(_number_of_mh_late_inlines > 0, "_number_of_mh_late_inlines < 0 !"); _number_of_mh_late_inlines--; }
806 bool has_mh_late_inlines() const { return _number_of_mh_late_inlines > 0; }
807
808 void inline_incrementally_one(PhaseIterGVN& igvn);
809 void inline_incrementally(PhaseIterGVN& igvn);
810 void inline_string_calls(bool parse_time);
771 811
772 // Matching, CFG layout, allocation, code generation 812 // Matching, CFG layout, allocation, code generation
773 PhaseCFG* cfg() { return _cfg; } 813 PhaseCFG* cfg() { return _cfg; }
774 bool select_24_bit_instr() const { return _select_24_bit_instr; } 814 bool select_24_bit_instr() const { return _select_24_bit_instr; }
775 bool in_24_bit_fp_mode() const { return _in_24_bit_fp_mode; } 815 bool in_24_bit_fp_mode() const { return _in_24_bit_fp_mode; }