Mercurial > hg > truffle
comparison src/share/vm/opto/block.hpp @ 14499:1077c8270209
8033260: assert(lrg._area >= 0.0) failed: negative spill area
Summary: Change type from float to double on block frequency, and add check for +Inf - +Inf operation
Reviewed-by: kvn, roland
author | adlertz |
---|---|
date | Tue, 25 Feb 2014 17:51:27 +0100 |
parents | abec000618bf |
children | 4ca6dc0799b6 |
comparison
equal
deleted
inserted
replaced
14498:04e7587c97dc | 14499:1077c8270209 |
---|---|
88 | 88 |
89 | 89 |
90 class CFGElement : public ResourceObj { | 90 class CFGElement : public ResourceObj { |
91 friend class VMStructs; | 91 friend class VMStructs; |
92 public: | 92 public: |
93 float _freq; // Execution frequency (estimate) | 93 double _freq; // Execution frequency (estimate) |
94 | 94 |
95 CFGElement() : _freq(0.0f) {} | 95 CFGElement() : _freq(0.0) {} |
96 virtual bool is_block() { return false; } | 96 virtual bool is_block() { return false; } |
97 virtual bool is_loop() { return false; } | 97 virtual bool is_loop() { return false; } |
98 Block* as_Block() { assert(is_block(), "must be block"); return (Block*)this; } | 98 Block* as_Block() { assert(is_block(), "must be block"); return (Block*)this; } |
99 CFGLoop* as_CFGLoop() { assert(is_loop(), "must be loop"); return (CFGLoop*)this; } | 99 CFGLoop* as_CFGLoop() { assert(is_loop(), "must be loop"); return (CFGLoop*)this; } |
100 }; | 100 }; |
200 uint compute_loop_alignment(); | 200 uint compute_loop_alignment(); |
201 | 201 |
202 // BLOCK_FREQUENCY is a sentinel to mark uses of constant block frequencies. | 202 // BLOCK_FREQUENCY is a sentinel to mark uses of constant block frequencies. |
203 // It is currently also used to scale such frequencies relative to | 203 // It is currently also used to scale such frequencies relative to |
204 // FreqCountInvocations relative to the old value of 1500. | 204 // FreqCountInvocations relative to the old value of 1500. |
205 #define BLOCK_FREQUENCY(f) ((f * (float) 1500) / FreqCountInvocations) | 205 #define BLOCK_FREQUENCY(f) ((f * (double) 1500) / FreqCountInvocations) |
206 | 206 |
207 // Register Pressure (estimate) for Splitting heuristic | 207 // Register Pressure (estimate) for Splitting heuristic |
208 uint _reg_pressure; | 208 uint _reg_pressure; |
209 uint _ihrp_index; | 209 uint _ihrp_index; |
210 uint _freg_pressure; | 210 uint _freg_pressure; |
391 | 391 |
392 // Loop from the root | 392 // Loop from the root |
393 CFGLoop* _root_loop; | 393 CFGLoop* _root_loop; |
394 | 394 |
395 // Outmost loop frequency | 395 // Outmost loop frequency |
396 float _outer_loop_frequency; | 396 double _outer_loop_frequency; |
397 | 397 |
398 // Per node latency estimation, valid only during GCM | 398 // Per node latency estimation, valid only during GCM |
399 GrowableArray<uint>* _node_latency; | 399 GrowableArray<uint>* _node_latency; |
400 | 400 |
401 // Build a proper looking cfg. Return count of basic blocks | 401 // Build a proper looking cfg. Return count of basic blocks |
506 uint get_latency_for_node(Node* node) { | 506 uint get_latency_for_node(Node* node) { |
507 return _node_latency->at_grow(node->_idx); | 507 return _node_latency->at_grow(node->_idx); |
508 } | 508 } |
509 | 509 |
510 // Get the outer most frequency | 510 // Get the outer most frequency |
511 float get_outer_loop_frequency() const { | 511 double get_outer_loop_frequency() const { |
512 return _outer_loop_frequency; | 512 return _outer_loop_frequency; |
513 } | 513 } |
514 | 514 |
515 // Get the root node of the CFG | 515 // Get the root node of the CFG |
516 RootNode* get_root_node() const { | 516 RootNode* get_root_node() const { |
654 //----------------------------BlockProbPair--------------------------- | 654 //----------------------------BlockProbPair--------------------------- |
655 // Ordered pair of Node*. | 655 // Ordered pair of Node*. |
656 class BlockProbPair VALUE_OBJ_CLASS_SPEC { | 656 class BlockProbPair VALUE_OBJ_CLASS_SPEC { |
657 protected: | 657 protected: |
658 Block* _target; // block target | 658 Block* _target; // block target |
659 float _prob; // probability of edge to block | 659 double _prob; // probability of edge to block |
660 public: | 660 public: |
661 BlockProbPair() : _target(NULL), _prob(0.0) {} | 661 BlockProbPair() : _target(NULL), _prob(0.0) {} |
662 BlockProbPair(Block* b, float p) : _target(b), _prob(p) {} | 662 BlockProbPair(Block* b, double p) : _target(b), _prob(p) {} |
663 | 663 |
664 Block* get_target() const { return _target; } | 664 Block* get_target() const { return _target; } |
665 float get_prob() const { return _prob; } | 665 double get_prob() const { return _prob; } |
666 }; | 666 }; |
667 | 667 |
668 //------------------------------CFGLoop------------------------------------------- | 668 //------------------------------CFGLoop------------------------------------------- |
669 class CFGLoop : public CFGElement { | 669 class CFGLoop : public CFGElement { |
670 friend class VMStructs; | 670 friend class VMStructs; |
673 CFGLoop *_parent; // root of loop tree is the method level "pseudo" loop, it's parent is null | 673 CFGLoop *_parent; // root of loop tree is the method level "pseudo" loop, it's parent is null |
674 CFGLoop *_sibling; // null terminated list | 674 CFGLoop *_sibling; // null terminated list |
675 CFGLoop *_child; // first child, use child's sibling to visit all immediately nested loops | 675 CFGLoop *_child; // first child, use child's sibling to visit all immediately nested loops |
676 GrowableArray<CFGElement*> _members; // list of members of loop | 676 GrowableArray<CFGElement*> _members; // list of members of loop |
677 GrowableArray<BlockProbPair> _exits; // list of successor blocks and their probabilities | 677 GrowableArray<BlockProbPair> _exits; // list of successor blocks and their probabilities |
678 float _exit_prob; // probability any loop exit is taken on a single loop iteration | 678 double _exit_prob; // probability any loop exit is taken on a single loop iteration |
679 void update_succ_freq(Block* b, float freq); | 679 void update_succ_freq(Block* b, double freq); |
680 | 680 |
681 public: | 681 public: |
682 CFGLoop(int id) : | 682 CFGLoop(int id) : |
683 CFGElement(), | 683 CFGElement(), |
684 _id(id), | 684 _id(id), |
700 } | 700 } |
701 Block* backedge_block(); // Return the block on the backedge of the loop (else NULL) | 701 Block* backedge_block(); // Return the block on the backedge of the loop (else NULL) |
702 void compute_loop_depth(int depth); | 702 void compute_loop_depth(int depth); |
703 void compute_freq(); // compute frequency with loop assuming head freq 1.0f | 703 void compute_freq(); // compute frequency with loop assuming head freq 1.0f |
704 void scale_freq(); // scale frequency by loop trip count (including outer loops) | 704 void scale_freq(); // scale frequency by loop trip count (including outer loops) |
705 float outer_loop_freq() const; // frequency of outer loop | 705 double outer_loop_freq() const; // frequency of outer loop |
706 bool in_loop_nest(Block* b); | 706 bool in_loop_nest(Block* b); |
707 float trip_count() const { return 1.0f / _exit_prob; } | 707 double trip_count() const { return 1.0 / _exit_prob; } |
708 virtual bool is_loop() { return true; } | 708 virtual bool is_loop() { return true; } |
709 int id() { return _id; } | 709 int id() { return _id; } |
710 | 710 |
711 #ifndef PRODUCT | 711 #ifndef PRODUCT |
712 void dump( ) const; | 712 void dump( ) const; |
721 class CFGEdge : public ResourceObj { | 721 class CFGEdge : public ResourceObj { |
722 friend class VMStructs; | 722 friend class VMStructs; |
723 private: | 723 private: |
724 Block * _from; // Source basic block | 724 Block * _from; // Source basic block |
725 Block * _to; // Destination basic block | 725 Block * _to; // Destination basic block |
726 float _freq; // Execution frequency (estimate) | 726 double _freq; // Execution frequency (estimate) |
727 int _state; | 727 int _state; |
728 bool _infrequent; | 728 bool _infrequent; |
729 int _from_pct; | 729 int _from_pct; |
730 int _to_pct; | 730 int _to_pct; |
731 | 731 |
740 open, // initial edge state; unprocessed | 740 open, // initial edge state; unprocessed |
741 connected, // edge used to connect two traces together | 741 connected, // edge used to connect two traces together |
742 interior // edge is interior to trace (could be backedge) | 742 interior // edge is interior to trace (could be backedge) |
743 }; | 743 }; |
744 | 744 |
745 CFGEdge(Block *from, Block *to, float freq, int from_pct, int to_pct) : | 745 CFGEdge(Block *from, Block *to, double freq, int from_pct, int to_pct) : |
746 _from(from), _to(to), _freq(freq), | 746 _from(from), _to(to), _freq(freq), |
747 _from_pct(from_pct), _to_pct(to_pct), _state(open) { | 747 _from_pct(from_pct), _to_pct(to_pct), _state(open) { |
748 _infrequent = from_infrequent() || to_infrequent(); | 748 _infrequent = from_infrequent() || to_infrequent(); |
749 } | 749 } |
750 | 750 |
751 float freq() const { return _freq; } | 751 double freq() const { return _freq; } |
752 Block* from() const { return _from; } | 752 Block* from() const { return _from; } |
753 Block* to () const { return _to; } | 753 Block* to () const { return _to; } |
754 int infrequent() const { return _infrequent; } | 754 int infrequent() const { return _infrequent; } |
755 int state() const { return _state; } | 755 int state() const { return _state; } |
756 | 756 |