512 Block* _succ;
513 public:
514 SuccIter() : _pred(NULL), _index(-1), _succ(NULL) {}
515 SuccIter(Block* pred) : _pred(pred), _index(-1), _succ(NULL) { next(); }
516 int index() { return _index; }
517 Block* pred() { return _pred; } // Return predecessor
518 bool done() { return _index < 0; } // Finished?
519 Block* succ() { return _succ; } // Return current successor
520 void next(); // Advance
521 void set_succ(Block* succ); // Update current successor
522 bool is_normal_ctrl() { return index() < _pred->successors()->length(); }
523 };
524
525 // A basic block
526 class Block : public ResourceObj {
527 private:
528 ciBlock* _ciblock;
529 GrowableArray<Block*>* _exceptions;
530 GrowableArray<ciInstanceKlass*>* _exc_klasses;
531 GrowableArray<Block*>* _successors;
532 StateVector* _state;
533 JsrSet* _jsrs;
534
535 int _trap_bci;
536 int _trap_index;
537
538 // pre_order, assigned at first visit. Used as block ID and "visited" tag
539 int _pre_order;
540
541 // A post-order, used to compute the reverse post order (RPO) provided to the client
542 int _post_order; // used to compute rpo
543
544 // Has this block been cloned for a loop backedge?
545 bool _backedge_copy;
546
547 // This block is entry to irreducible loop.
548 bool _irreducible_entry;
549
550 // This block has monitor entry point.
551 bool _has_monitorenter;
600 // Find outermost loop with same loop head
601 Loop* lp = loop();
602 while (lp->parent() != NULL) {
603 if (lp->parent()->head() != lp->head()) break;
604 lp = lp->parent();
605 }
606 return !lp->def_locals()->test(v);
607 }
608 LocalSet* def_locals() { return _state->def_locals(); }
609 const LocalSet* def_locals() const { return _state->def_locals(); }
610
611 // Get the successors for this Block.
612 GrowableArray<Block*>* successors(ciBytecodeStream* str,
613 StateVector* state,
614 JsrSet* jsrs);
615 GrowableArray<Block*>* successors() {
616 assert(_successors != NULL, "must be filled in");
617 return _successors;
618 }
619
620 // Get the exceptional successors for this Block.
621 GrowableArray<Block*>* exceptions() {
622 if (_exceptions == NULL) {
623 compute_exceptions();
624 }
625 return _exceptions;
626 }
627
628 // Get the exception klasses corresponding to the
629 // exceptional successors for this Block.
630 GrowableArray<ciInstanceKlass*>* exc_klasses() {
631 if (_exc_klasses == NULL) {
632 compute_exceptions();
633 }
634 return _exc_klasses;
635 }
636
637 // Is this Block compatible with a given JsrSet?
638 bool is_compatible_with(JsrSet* other) {
639 return _jsrs->is_compatible_with(other);
923
924 // Perform the type flow analysis, creating and cloning Blocks as
925 // necessary.
926 void flow_types();
927
928 // Perform the depth first type flow analysis. Helper for flow_types.
929 void df_flow_types(Block* start,
930 bool do_flow,
931 StateVector* temp_vector,
932 JsrSet* temp_set);
933
934 // Incrementally build loop tree.
935 void build_loop_tree(Block* blk);
936
937 // Create the block map, which indexes blocks in pre_order.
938 void map_blocks();
939
940 public:
941 // Perform type inference flow analysis.
942 void do_flow();
943
944 void print_on(outputStream* st) const PRODUCT_RETURN;
945
946 void rpo_print_on(outputStream* st) const PRODUCT_RETURN;
947 };
948
949 #endif // SHARE_VM_CI_CITYPEFLOW_HPP
|
512 Block* _succ;
513 public:
514 SuccIter() : _pred(NULL), _index(-1), _succ(NULL) {}
515 SuccIter(Block* pred) : _pred(pred), _index(-1), _succ(NULL) { next(); }
516 int index() { return _index; }
517 Block* pred() { return _pred; } // Return predecessor
518 bool done() { return _index < 0; } // Finished?
519 Block* succ() { return _succ; } // Return current successor
520 void next(); // Advance
521 void set_succ(Block* succ); // Update current successor
522 bool is_normal_ctrl() { return index() < _pred->successors()->length(); }
523 };
524
525 // A basic block
526 class Block : public ResourceObj {
527 private:
528 ciBlock* _ciblock;
529 GrowableArray<Block*>* _exceptions;
530 GrowableArray<ciInstanceKlass*>* _exc_klasses;
531 GrowableArray<Block*>* _successors;
532 GrowableArray<Block*>* _predecessors;
533 StateVector* _state;
534 JsrSet* _jsrs;
535
536 int _trap_bci;
537 int _trap_index;
538
539 // pre_order, assigned at first visit. Used as block ID and "visited" tag
540 int _pre_order;
541
542 // A post-order, used to compute the reverse post order (RPO) provided to the client
543 int _post_order; // used to compute rpo
544
545 // Has this block been cloned for a loop backedge?
546 bool _backedge_copy;
547
548 // This block is entry to irreducible loop.
549 bool _irreducible_entry;
550
551 // This block has monitor entry point.
552 bool _has_monitorenter;
601 // Find outermost loop with same loop head
602 Loop* lp = loop();
603 while (lp->parent() != NULL) {
604 if (lp->parent()->head() != lp->head()) break;
605 lp = lp->parent();
606 }
607 return !lp->def_locals()->test(v);
608 }
609 LocalSet* def_locals() { return _state->def_locals(); }
610 const LocalSet* def_locals() const { return _state->def_locals(); }
611
612 // Get the successors for this Block.
613 GrowableArray<Block*>* successors(ciBytecodeStream* str,
614 StateVector* state,
615 JsrSet* jsrs);
616 GrowableArray<Block*>* successors() {
617 assert(_successors != NULL, "must be filled in");
618 return _successors;
619 }
620
621 GrowableArray<Block*>* predecessors() {
622 assert(_predecessors != NULL, "must be filled in");
623 return _predecessors;
624 }
625
626 // Get the exceptional successors for this Block.
627 GrowableArray<Block*>* exceptions() {
628 if (_exceptions == NULL) {
629 compute_exceptions();
630 }
631 return _exceptions;
632 }
633
634 // Get the exception klasses corresponding to the
635 // exceptional successors for this Block.
636 GrowableArray<ciInstanceKlass*>* exc_klasses() {
637 if (_exc_klasses == NULL) {
638 compute_exceptions();
639 }
640 return _exc_klasses;
641 }
642
643 // Is this Block compatible with a given JsrSet?
644 bool is_compatible_with(JsrSet* other) {
645 return _jsrs->is_compatible_with(other);
929
930 // Perform the type flow analysis, creating and cloning Blocks as
931 // necessary.
932 void flow_types();
933
934 // Perform the depth first type flow analysis. Helper for flow_types.
935 void df_flow_types(Block* start,
936 bool do_flow,
937 StateVector* temp_vector,
938 JsrSet* temp_set);
939
940 // Incrementally build loop tree.
941 void build_loop_tree(Block* blk);
942
943 // Create the block map, which indexes blocks in pre_order.
944 void map_blocks();
945
946 public:
947 // Perform type inference flow analysis.
948 void do_flow();
949
950 // Determine if bci is dominated by dom_bci
951 bool is_dominated_by(int bci, int dom_bci);
952
953 void print_on(outputStream* st) const PRODUCT_RETURN;
954
955 void rpo_print_on(outputStream* st) const PRODUCT_RETURN;
956 };
957
958 #endif // SHARE_VM_CI_CITYPEFLOW_HPP
|