Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/loopnode.cpp @ 17:ff5961f4c095
6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
Reviewed-by: kvn, rasbold
author | never |
---|---|
date | Wed, 05 Dec 2007 09:01:00 -0800 |
parents | a61af66fc99e |
children | 76256d272075 |
comparison
equal
deleted
inserted
replaced
16:f8236e79048a | 17:ff5961f4c095 |
---|---|
649 Node* pred = use_ctrl; | 649 Node* pred = use_ctrl; |
650 uint if_cnt = 0; | 650 uint if_cnt = 0; |
651 while (if_cnt < if_limit) { | 651 while (if_cnt < if_limit) { |
652 if ((pred->Opcode() == Op_IfTrue || pred->Opcode() == Op_IfFalse)) { | 652 if ((pred->Opcode() == Op_IfTrue || pred->Opcode() == Op_IfFalse)) { |
653 if_cnt++; | 653 if_cnt++; |
654 const TypeInt* if_t = filtered_type_at_if(val, pred); | 654 const TypeInt* if_t = IfNode::filtered_int_type(&_igvn, val, pred); |
655 if (if_t != NULL) { | 655 if (if_t != NULL) { |
656 if (rtn_t == NULL) { | 656 if (rtn_t == NULL) { |
657 rtn_t = if_t; | 657 rtn_t = if_t; |
658 } else { | 658 } else { |
659 rtn_t = rtn_t->join(if_t)->is_int(); | 659 rtn_t = rtn_t->join(if_t)->is_int(); |
671 } | 671 } |
672 } | 672 } |
673 return rtn_t; | 673 return rtn_t; |
674 } | 674 } |
675 | 675 |
676 | |
677 //------------------------------filtered_type_at_if-------------------------------- | |
678 // Return a possibly more restrictive type for val based on condition control flow for an if | |
679 const TypeInt* PhaseIdealLoop::filtered_type_at_if( Node* val, Node *if_proj) { | |
680 assert(if_proj && | |
681 (if_proj->Opcode() == Op_IfTrue || if_proj->Opcode() == Op_IfFalse), "expecting an if projection"); | |
682 if (if_proj->in(0) && if_proj->in(0)->is_If()) { | |
683 IfNode* iff = if_proj->in(0)->as_If(); | |
684 if (iff->in(1) && iff->in(1)->is_Bool()) { | |
685 BoolNode* bol = iff->in(1)->as_Bool(); | |
686 if (bol->in(1) && bol->in(1)->is_Cmp()) { | |
687 const CmpNode* cmp = bol->in(1)->as_Cmp(); | |
688 if (cmp->in(1) == val) { | |
689 const TypeInt* cmp2_t = _igvn.type(cmp->in(2))->isa_int(); | |
690 if (cmp2_t != NULL) { | |
691 jint lo = cmp2_t->_lo; | |
692 jint hi = cmp2_t->_hi; | |
693 BoolTest::mask msk = if_proj->Opcode() == Op_IfTrue ? bol->_test._test : bol->_test.negate(); | |
694 switch (msk) { | |
695 case BoolTest::ne: | |
696 // Can't refine type | |
697 return NULL; | |
698 case BoolTest::eq: | |
699 return cmp2_t; | |
700 case BoolTest::lt: | |
701 lo = TypeInt::INT->_lo; | |
702 if (hi - 1 < hi) { | |
703 hi = hi - 1; | |
704 } | |
705 break; | |
706 case BoolTest::le: | |
707 lo = TypeInt::INT->_lo; | |
708 break; | |
709 case BoolTest::gt: | |
710 if (lo + 1 > lo) { | |
711 lo = lo + 1; | |
712 } | |
713 hi = TypeInt::INT->_hi; | |
714 break; | |
715 case BoolTest::ge: | |
716 // lo unchanged | |
717 hi = TypeInt::INT->_hi; | |
718 break; | |
719 } | |
720 const TypeInt* rtn_t = TypeInt::make(lo, hi, cmp2_t->_widen); | |
721 return rtn_t; | |
722 } | |
723 } | |
724 } | |
725 } | |
726 } | |
727 return NULL; | |
728 } | |
729 | 676 |
730 //------------------------------dump_spec-------------------------------------- | 677 //------------------------------dump_spec-------------------------------------- |
731 // Dump special per-node info | 678 // Dump special per-node info |
732 #ifndef PRODUCT | 679 #ifndef PRODUCT |
733 void CountedLoopEndNode::dump_spec(outputStream *st) const { | 680 void CountedLoopEndNode::dump_spec(outputStream *st) const { |