comparison src/share/vm/opto/compile.hpp @ 1080:7c57aead6d3e

6892658: C2 should optimize some stringbuilder patterns Reviewed-by: kvn, twisti
author never
date Thu, 12 Nov 2009 09:24:21 -0800
parents 89e0543e1737
children b2b6a9bf6238
comparison
equal deleted inserted replaced
1078:8e7adf982378 1080:7c57aead6d3e
147 int _major_progress; // Count of something big happening 147 int _major_progress; // Count of something big happening
148 bool _deopt_happens; // TRUE if de-optimization CAN happen 148 bool _deopt_happens; // TRUE if de-optimization CAN happen
149 bool _has_loops; // True if the method _may_ have some loops 149 bool _has_loops; // True if the method _may_ have some loops
150 bool _has_split_ifs; // True if the method _may_ have some split-if 150 bool _has_split_ifs; // True if the method _may_ have some split-if
151 bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores. 151 bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores.
152 bool _has_stringbuilder; // True StringBuffers or StringBuilders are allocated
152 uint _trap_hist[trapHistLength]; // Cumulative traps 153 uint _trap_hist[trapHistLength]; // Cumulative traps
153 bool _trap_can_recompile; // Have we emitted a recompiling trap? 154 bool _trap_can_recompile; // Have we emitted a recompiling trap?
154 uint _decompile_count; // Cumulative decompilation counts. 155 uint _decompile_count; // Cumulative decompilation counts.
155 bool _do_inlining; // True if we intend to do inlining 156 bool _do_inlining; // True if we intend to do inlining
156 bool _do_scheduling; // True if we intend to do scheduling 157 bool _do_scheduling; // True if we intend to do scheduling
216 217
217 // Parsing, optimization 218 // Parsing, optimization
218 PhaseGVN* _initial_gvn; // Results of parse-time PhaseGVN 219 PhaseGVN* _initial_gvn; // Results of parse-time PhaseGVN
219 Unique_Node_List* _for_igvn; // Initial work-list for next round of Iterative GVN 220 Unique_Node_List* _for_igvn; // Initial work-list for next round of Iterative GVN
220 WarmCallInfo* _warm_calls; // Sorted work-list for heat-based inlining. 221 WarmCallInfo* _warm_calls; // Sorted work-list for heat-based inlining.
222
223 GrowableArray<CallGenerator*> _late_inlines; // List of CallGenerators to be revisited after
224 // main parsing has finished.
221 225
222 // Matching, CFG layout, allocation, code generation 226 // Matching, CFG layout, allocation, code generation
223 PhaseCFG* _cfg; // Results of CFG finding 227 PhaseCFG* _cfg; // Results of CFG finding
224 bool _select_24_bit_instr; // We selected an instruction with a 24-bit result 228 bool _select_24_bit_instr; // We selected an instruction with a 24-bit result
225 bool _in_24_bit_fp_mode; // We are emitting instructions with 24-bit results 229 bool _in_24_bit_fp_mode; // We are emitting instructions with 24-bit results
296 void set_has_loops(bool z) { _has_loops = z; } 300 void set_has_loops(bool z) { _has_loops = z; }
297 bool has_split_ifs() const { return _has_split_ifs; } 301 bool has_split_ifs() const { return _has_split_ifs; }
298 void set_has_split_ifs(bool z) { _has_split_ifs = z; } 302 void set_has_split_ifs(bool z) { _has_split_ifs = z; }
299 bool has_unsafe_access() const { return _has_unsafe_access; } 303 bool has_unsafe_access() const { return _has_unsafe_access; }
300 void set_has_unsafe_access(bool z) { _has_unsafe_access = z; } 304 void set_has_unsafe_access(bool z) { _has_unsafe_access = z; }
305 bool has_stringbuilder() const { return _has_stringbuilder; }
306 void set_has_stringbuilder(bool z) { _has_stringbuilder = z; }
301 void set_trap_count(uint r, uint c) { assert(r < trapHistLength, "oob"); _trap_hist[r] = c; } 307 void set_trap_count(uint r, uint c) { assert(r < trapHistLength, "oob"); _trap_hist[r] = c; }
302 uint trap_count(uint r) const { assert(r < trapHistLength, "oob"); return _trap_hist[r]; } 308 uint trap_count(uint r) const { assert(r < trapHistLength, "oob"); return _trap_hist[r]; }
303 bool trap_can_recompile() const { return _trap_can_recompile; } 309 bool trap_can_recompile() const { return _trap_can_recompile; }
304 void set_trap_can_recompile(bool z) { _trap_can_recompile = z; } 310 void set_trap_can_recompile(bool z) { _trap_can_recompile = z; }
305 uint decompile_count() const { return _decompile_count; } 311 uint decompile_count() const { return _decompile_count; }
473 JVMState* build_start_state(StartNode* start, const TypeFunc* tf); 479 JVMState* build_start_state(StartNode* start, const TypeFunc* tf);
474 480
475 // Decide how to build a call. 481 // Decide how to build a call.
476 // The profile factor is a discount to apply to this site's interp. profile. 482 // The profile factor is a discount to apply to this site's interp. profile.
477 CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, float profile_factor); 483 CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, float profile_factor);
484 bool should_delay_inlining(ciMethod* call_method, JVMState* jvms);
478 485
479 // Report if there were too many traps at a current method and bci. 486 // Report if there were too many traps at a current method and bci.
480 // Report if a trap was recorded, and/or PerMethodTrapLimit was exceeded. 487 // Report if a trap was recorded, and/or PerMethodTrapLimit was exceeded.
481 // If there is no MDO at all, report no trap unless told to assume it. 488 // If there is no MDO at all, report no trap unless told to assume it.
482 bool too_many_traps(ciMethod* method, int bci, Deoptimization::DeoptReason reason); 489 bool too_many_traps(ciMethod* method, int bci, Deoptimization::DeoptReason reason);
493 Unique_Node_List* for_igvn() { return _for_igvn; } 500 Unique_Node_List* for_igvn() { return _for_igvn; }
494 inline void record_for_igvn(Node* n); // Body is after class Unique_Node_List. 501 inline void record_for_igvn(Node* n); // Body is after class Unique_Node_List.
495 void set_initial_gvn(PhaseGVN *gvn) { _initial_gvn = gvn; } 502 void set_initial_gvn(PhaseGVN *gvn) { _initial_gvn = gvn; }
496 void set_for_igvn(Unique_Node_List *for_igvn) { _for_igvn = for_igvn; } 503 void set_for_igvn(Unique_Node_List *for_igvn) { _for_igvn = for_igvn; }
497 504
505 // Replace n by nn using initial_gvn, calling hash_delete and
506 // record_for_igvn as needed.
507 void gvn_replace_by(Node* n, Node* nn);
508
509
498 void identify_useful_nodes(Unique_Node_List &useful); 510 void identify_useful_nodes(Unique_Node_List &useful);
499 void remove_useless_nodes (Unique_Node_List &useful); 511 void remove_useless_nodes (Unique_Node_List &useful);
500 512
501 WarmCallInfo* warm_calls() const { return _warm_calls; } 513 WarmCallInfo* warm_calls() const { return _warm_calls; }
502 void set_warm_calls(WarmCallInfo* l) { _warm_calls = l; } 514 void set_warm_calls(WarmCallInfo* l) { _warm_calls = l; }
503 WarmCallInfo* pop_warm_call(); 515 WarmCallInfo* pop_warm_call();
516
517 // Record this CallGenerator for inlining at the end of parsing.
518 void add_late_inline(CallGenerator* cg) { _late_inlines.push(cg); }
504 519
505 // Matching, CFG layout, allocation, code generation 520 // Matching, CFG layout, allocation, code generation
506 PhaseCFG* cfg() { return _cfg; } 521 PhaseCFG* cfg() { return _cfg; }
507 bool select_24_bit_instr() const { return _select_24_bit_instr; } 522 bool select_24_bit_instr() const { return _select_24_bit_instr; }
508 bool in_24_bit_fp_mode() const { return _in_24_bit_fp_mode; } 523 bool in_24_bit_fp_mode() const { return _in_24_bit_fp_mode; }