< prev index next >

src/hotspot/share/opto/macro.cpp

Print this page




 693                   use->as_ArrayCopy()->is_copyof_validated() ||
 694                   use->as_ArrayCopy()->is_copyofrange_validated()) &&
 695                  use->in(ArrayCopyNode::Dest) == res) {
 696         // ok to eliminate
 697       } else if (use->is_SafePoint()) {
 698         SafePointNode* sfpt = use->as_SafePoint();
 699         if (sfpt->is_Call() && sfpt->as_Call()->has_non_debug_use(res)) {
 700           // Object is passed as argument.
 701           DEBUG_ONLY(disq_node = use;)
 702           NOT_PRODUCT(fail_eliminate = "Object is passed as argument";)
 703           can_eliminate = false;
 704         }
 705         Node* sfptMem = sfpt->memory();
 706         if (sfptMem == NULL || sfptMem->is_top()) {
 707           DEBUG_ONLY(disq_node = use;)
 708           NOT_PRODUCT(fail_eliminate = "NULL or TOP memory";)
 709           can_eliminate = false;
 710         } else {
 711           safepoints.append_if_missing(sfpt);
 712         }


 713       } else if (use->Opcode() != Op_CastP2X) { // CastP2X is used by card mark
 714         if (use->is_Phi()) {
 715           if (use->outcnt() == 1 && use->unique_out()->Opcode() == Op_Return) {
 716             NOT_PRODUCT(fail_eliminate = "Object is return value";)
 717           } else {
 718             NOT_PRODUCT(fail_eliminate = "Object is referenced by Phi";)
 719           }
 720           DEBUG_ONLY(disq_node = use;)
 721         } else {
 722           if (use->Opcode() == Op_Return) {
 723             NOT_PRODUCT(fail_eliminate = "Object is return value";)
 724           } else {
 725             NOT_PRODUCT(fail_eliminate = "Object is referenced by node";)
 726           }
 727           DEBUG_ONLY(disq_node = use;)
 728         }
 729         can_eliminate = false;
 730       } else {
 731         assert(use->Opcode() == Op_CastP2X, "should be");
 732         assert(!use->has_out_with(Op_OrL), "should have been removed because oop is never null");


1027 
1028         _igvn.replace_node(callprojs->fallthrough_ioproj, ac->in(TypeFunc::I_O));
1029         _igvn.replace_node(callprojs->fallthrough_memproj, ac->in(TypeFunc::Memory));
1030         _igvn.replace_node(callprojs->fallthrough_catchproj, ac->in(TypeFunc::Control));
1031 
1032         // Set control to top. IGVN will remove the remaining projections
1033         ac->set_req(0, top());
1034         ac->replace_edge(res, top());
1035 
1036         // Disconnect src right away: it can help find new
1037         // opportunities for allocation elimination
1038         Node* src = ac->in(ArrayCopyNode::Src);
1039         ac->replace_edge(src, top());
1040         // src can be top at this point if src and dest of the
1041         // arraycopy were the same
1042         if (src->outcnt() == 0 && !src->is_top()) {
1043           _igvn.remove_dead_node(src);
1044         }
1045 
1046         _igvn._worklist.push(ac);




1047       } else {
1048         eliminate_gc_barrier(use);
1049       }
1050       j -= (oc1 - res->outcnt());
1051     }
1052     assert(res->outcnt() == 0, "all uses of allocated objects must be deleted");
1053     _igvn.remove_dead_node(res);
1054   }
1055 
1056   //
1057   // Process other users of allocation's projections
1058   //
1059   if (_resproj != NULL && _resproj->outcnt() != 0) {
1060     // First disconnect stores captured by Initialize node.
1061     // If Initialize node is eliminated first in the following code,
1062     // it will kill such stores and DUIterator_Last will assert.
1063     for (DUIterator_Fast jmax, j = _resproj->fast_outs(jmax);  j < jmax; j++) {
1064       Node *use = _resproj->fast_out(j);
1065       if (use->is_AddP()) {
1066         // raw memory addresses used only by the initialization




 693                   use->as_ArrayCopy()->is_copyof_validated() ||
 694                   use->as_ArrayCopy()->is_copyofrange_validated()) &&
 695                  use->in(ArrayCopyNode::Dest) == res) {
 696         // ok to eliminate
 697       } else if (use->is_SafePoint()) {
 698         SafePointNode* sfpt = use->as_SafePoint();
 699         if (sfpt->is_Call() && sfpt->as_Call()->has_non_debug_use(res)) {
 700           // Object is passed as argument.
 701           DEBUG_ONLY(disq_node = use;)
 702           NOT_PRODUCT(fail_eliminate = "Object is passed as argument";)
 703           can_eliminate = false;
 704         }
 705         Node* sfptMem = sfpt->memory();
 706         if (sfptMem == NULL || sfptMem->is_top()) {
 707           DEBUG_ONLY(disq_node = use;)
 708           NOT_PRODUCT(fail_eliminate = "NULL or TOP memory";)
 709           can_eliminate = false;
 710         } else {
 711           safepoints.append_if_missing(sfpt);
 712         }
 713       } else if (use->is_ValueType() && use->isa_ValueType()->get_oop() == res) {
 714         // ok to eliminate
 715       } else if (use->Opcode() != Op_CastP2X) { // CastP2X is used by card mark
 716         if (use->is_Phi()) {
 717           if (use->outcnt() == 1 && use->unique_out()->Opcode() == Op_Return) {
 718             NOT_PRODUCT(fail_eliminate = "Object is return value";)
 719           } else {
 720             NOT_PRODUCT(fail_eliminate = "Object is referenced by Phi";)
 721           }
 722           DEBUG_ONLY(disq_node = use;)
 723         } else {
 724           if (use->Opcode() == Op_Return) {
 725             NOT_PRODUCT(fail_eliminate = "Object is return value";)
 726           } else {
 727             NOT_PRODUCT(fail_eliminate = "Object is referenced by node";)
 728           }
 729           DEBUG_ONLY(disq_node = use;)
 730         }
 731         can_eliminate = false;
 732       } else {
 733         assert(use->Opcode() == Op_CastP2X, "should be");
 734         assert(!use->has_out_with(Op_OrL), "should have been removed because oop is never null");


1029 
1030         _igvn.replace_node(callprojs->fallthrough_ioproj, ac->in(TypeFunc::I_O));
1031         _igvn.replace_node(callprojs->fallthrough_memproj, ac->in(TypeFunc::Memory));
1032         _igvn.replace_node(callprojs->fallthrough_catchproj, ac->in(TypeFunc::Control));
1033 
1034         // Set control to top. IGVN will remove the remaining projections
1035         ac->set_req(0, top());
1036         ac->replace_edge(res, top());
1037 
1038         // Disconnect src right away: it can help find new
1039         // opportunities for allocation elimination
1040         Node* src = ac->in(ArrayCopyNode::Src);
1041         ac->replace_edge(src, top());
1042         // src can be top at this point if src and dest of the
1043         // arraycopy were the same
1044         if (src->outcnt() == 0 && !src->is_top()) {
1045           _igvn.remove_dead_node(src);
1046         }
1047 
1048         _igvn._worklist.push(ac);
1049       } else if (use->is_ValueType()) {
1050         assert(use->isa_ValueType()->get_oop() == res, "unexpected value type use");
1051          _igvn.rehash_node_delayed(use);
1052         use->isa_ValueType()->set_oop(_igvn.zerocon(T_VALUETYPE));
1053       } else {
1054         eliminate_gc_barrier(use);
1055       }
1056       j -= (oc1 - res->outcnt());
1057     }
1058     assert(res->outcnt() == 0, "all uses of allocated objects must be deleted");
1059     _igvn.remove_dead_node(res);
1060   }
1061 
1062   //
1063   // Process other users of allocation's projections
1064   //
1065   if (_resproj != NULL && _resproj->outcnt() != 0) {
1066     // First disconnect stores captured by Initialize node.
1067     // If Initialize node is eliminated first in the following code,
1068     // it will kill such stores and DUIterator_Last will assert.
1069     for (DUIterator_Fast jmax, j = _resproj->fast_outs(jmax);  j < jmax; j++) {
1070       Node *use = _resproj->fast_out(j);
1071       if (use->is_AddP()) {
1072         // raw memory addresses used only by the initialization


< prev index next >