644 assert( from_idx < _cnt, "oob" );
645 _indices[from_idx] = to_idx;
646 }
647 void extend( uint from_idx, uint to_idx );
648
649 uint Size() const { return _cnt; }
650
651 uint Find( uint idx ) {
652 assert( idx < 65536, "Must fit into uint");
653 uint uf_idx = lookup(idx);
654 return (uf_idx == idx) ? uf_idx : Find_compress(idx);
655 }
656 uint Find_compress( uint idx );
657 uint Find_const( uint idx ) const;
658 void Union( uint idx1, uint idx2 );
659
660 };
661
662 //----------------------------BlockProbPair---------------------------
663 // Ordered pair of Node*.
664 class BlockProbPair VALUE_OBJ_CLASS_SPEC {
665 protected:
666 Block* _target; // block target
667 double _prob; // probability of edge to block
668 public:
669 BlockProbPair() : _target(NULL), _prob(0.0) {}
670 BlockProbPair(Block* b, double p) : _target(b), _prob(p) {}
671
672 Block* get_target() const { return _target; }
673 double get_prob() const { return _prob; }
674 };
675
676 //------------------------------CFGLoop-------------------------------------------
677 class CFGLoop : public CFGElement {
678 friend class VMStructs;
679 int _id;
680 int _depth;
681 CFGLoop *_parent; // root of loop tree is the method level "pseudo" loop, it's parent is null
682 CFGLoop *_sibling; // null terminated list
683 CFGLoop *_child; // first child, use child's sibling to visit all immediately nested loops
684 GrowableArray<CFGElement*> _members; // list of members of loop
|
644 assert( from_idx < _cnt, "oob" );
645 _indices[from_idx] = to_idx;
646 }
647 void extend( uint from_idx, uint to_idx );
648
649 uint Size() const { return _cnt; }
650
651 uint Find( uint idx ) {
652 assert( idx < 65536, "Must fit into uint");
653 uint uf_idx = lookup(idx);
654 return (uf_idx == idx) ? uf_idx : Find_compress(idx);
655 }
656 uint Find_compress( uint idx );
657 uint Find_const( uint idx ) const;
658 void Union( uint idx1, uint idx2 );
659
660 };
661
662 //----------------------------BlockProbPair---------------------------
663 // Ordered pair of Node*.
664 class BlockProbPair {
665 protected:
666 Block* _target; // block target
667 double _prob; // probability of edge to block
668 public:
669 BlockProbPair() : _target(NULL), _prob(0.0) {}
670 BlockProbPair(Block* b, double p) : _target(b), _prob(p) {}
671
672 Block* get_target() const { return _target; }
673 double get_prob() const { return _prob; }
674 };
675
676 //------------------------------CFGLoop-------------------------------------------
677 class CFGLoop : public CFGElement {
678 friend class VMStructs;
679 int _id;
680 int _depth;
681 CFGLoop *_parent; // root of loop tree is the method level "pseudo" loop, it's parent is null
682 CFGLoop *_sibling; // null terminated list
683 CFGLoop *_child; // first child, use child's sibling to visit all immediately nested loops
684 GrowableArray<CFGElement*> _members; // list of members of loop
|