src/hotspot/share/opto/callnode.cpp
changeset 48595 5d699d81c10c
parent 47216 71c04702a3d5
child 48976 324105aaeddf
equal deleted inserted replaced
48594:4e4929530412 48595:5d699d81c10c
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   770   }
   770   }
   771   if (t_oop->is_ptr_to_boxed_value()) {
   771   if (t_oop->is_ptr_to_boxed_value()) {
   772     ciKlass* boxing_klass = t_oop->klass();
   772     ciKlass* boxing_klass = t_oop->klass();
   773     if (is_CallStaticJava() && as_CallStaticJava()->is_boxing_method()) {
   773     if (is_CallStaticJava() && as_CallStaticJava()->is_boxing_method()) {
   774       // Skip unrelated boxing methods.
   774       // Skip unrelated boxing methods.
   775       Node* proj = proj_out(TypeFunc::Parms);
   775       Node* proj = proj_out_or_null(TypeFunc::Parms);
   776       if ((proj == NULL) || (phase->type(proj)->is_instptr()->klass() != boxing_klass)) {
   776       if ((proj == NULL) || (phase->type(proj)->is_instptr()->klass() != boxing_klass)) {
   777         return false;
   777         return false;
   778       }
   778       }
   779     }
   779     }
   780     if (is_CallJava() && as_CallJava()->method() != NULL) {
   780     if (is_CallJava() && as_CallJava()->method() != NULL) {
   782       if (meth->is_getter()) {
   782       if (meth->is_getter()) {
   783         return false;
   783         return false;
   784       }
   784       }
   785       // May modify (by reflection) if an boxing object is passed
   785       // May modify (by reflection) if an boxing object is passed
   786       // as argument or returned.
   786       // as argument or returned.
   787       Node* proj = returns_pointer() ? proj_out(TypeFunc::Parms) : NULL;
   787       Node* proj = returns_pointer() ? proj_out_or_null(TypeFunc::Parms) : NULL;
   788       if (proj != NULL) {
   788       if (proj != NULL) {
   789         const TypeInstPtr* inst_t = phase->type(proj)->isa_instptr();
   789         const TypeInstPtr* inst_t = phase->type(proj)->isa_instptr();
   790         if ((inst_t != NULL) && (!inst_t->klass_is_exact() ||
   790         if ((inst_t != NULL) && (!inst_t->klass_is_exact() ||
   791                                  (inst_t->klass() == boxing_klass))) {
   791                                  (inst_t->klass() == boxing_klass))) {
   792           return true;
   792           return true;
   822 // or 'this' if there are several CheckCastPP or unexpected uses
   822 // or 'this' if there are several CheckCastPP or unexpected uses
   823 // or returns NULL if there is no one.
   823 // or returns NULL if there is no one.
   824 Node *CallNode::result_cast() {
   824 Node *CallNode::result_cast() {
   825   Node *cast = NULL;
   825   Node *cast = NULL;
   826 
   826 
   827   Node *p = proj_out(TypeFunc::Parms);
   827   Node *p = proj_out_or_null(TypeFunc::Parms);
   828   if (p == NULL)
   828   if (p == NULL)
   829     return NULL;
   829     return NULL;
   830 
   830 
   831   for (DUIterator_Fast imax, i = p->fast_outs(imax); i < imax; i++) {
   831   for (DUIterator_Fast imax, i = p->fast_outs(imax); i < imax; i++) {
   832     Node *use = p->fast_out(i);
   832     Node *use = p->fast_out(i);
  1376   if (type->isa_int() && type->is_int()->_hi < 0) {
  1376   if (type->isa_int() && type->is_int()->_hi < 0) {
  1377     if (can_reshape) {
  1377     if (can_reshape) {
  1378       PhaseIterGVN *igvn = phase->is_IterGVN();
  1378       PhaseIterGVN *igvn = phase->is_IterGVN();
  1379       // Unreachable fall through path (negative array length),
  1379       // Unreachable fall through path (negative array length),
  1380       // the allocation can only throw so disconnect it.
  1380       // the allocation can only throw so disconnect it.
  1381       Node* proj = proj_out(TypeFunc::Control);
  1381       Node* proj = proj_out_or_null(TypeFunc::Control);
  1382       Node* catchproj = NULL;
  1382       Node* catchproj = NULL;
  1383       if (proj != NULL) {
  1383       if (proj != NULL) {
  1384         for (DUIterator_Fast imax, i = proj->fast_outs(imax); i < imax; i++) {
  1384         for (DUIterator_Fast imax, i = proj->fast_outs(imax); i < imax; i++) {
  1385           Node *cn = proj->fast_out(i);
  1385           Node *cn = proj->fast_out(i);
  1386           if (cn->is_Catch()) {
  1386           if (cn->is_Catch()) {
  1387             catchproj = cn->as_Multi()->proj_out(CatchProjNode::fall_through_index);
  1387             catchproj = cn->as_Multi()->proj_out_or_null(CatchProjNode::fall_through_index);
  1388             break;
  1388             break;
  1389           }
  1389           }
  1390         }
  1390         }
  1391       }
  1391       }
  1392       if (catchproj != NULL && catchproj->outcnt() > 0 &&
  1392       if (catchproj != NULL && catchproj->outcnt() > 0 &&
  1440       // Return NULL if new nodes are not allowed
  1440       // Return NULL if new nodes are not allowed
  1441       if (!allow_new_nodes) return NULL;
  1441       if (!allow_new_nodes) return NULL;
  1442       // Create a cast which is control dependent on the initialization to
  1442       // Create a cast which is control dependent on the initialization to
  1443       // propagate the fact that the array length must be positive.
  1443       // propagate the fact that the array length must be positive.
  1444       length = new CastIINode(length, narrow_length_type);
  1444       length = new CastIINode(length, narrow_length_type);
  1445       length->set_req(0, initialization()->proj_out(0));
  1445       length->set_req(0, initialization()->proj_out_or_null(0));
  1446     }
  1446     }
  1447   }
  1447   }
  1448 
  1448 
  1449   return length;
  1449   return length;
  1450 }
  1450 }