src/hotspot/share/opto/macro.cpp
changeset 48595 5d699d81c10c
parent 48145 f913f6dba2d3
child 49449 ef5d5d343e2a
equal deleted inserted replaced
48594:4e4929530412 48595:5d699d81c10c
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 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.
   494     return new_phi;
   494     return new_phi;
   495 
   495 
   496   if (level <= 0) {
   496   if (level <= 0) {
   497     return NULL; // Give up: phi tree too deep
   497     return NULL; // Give up: phi tree too deep
   498   }
   498   }
   499   Node *start_mem = C->start()->proj_out(TypeFunc::Memory);
   499   Node *start_mem = C->start()->proj_out_or_null(TypeFunc::Memory);
   500   Node *alloc_mem = alloc->in(TypeFunc::Memory);
   500   Node *alloc_mem = alloc->in(TypeFunc::Memory);
   501 
   501 
   502   uint length = mem->req();
   502   uint length = mem->req();
   503   GrowableArray <Node *> values(length, length, NULL, false);
   503   GrowableArray <Node *> values(length, length, NULL, false);
   504 
   504 
   574   int instance_id = adr_t->instance_id();
   574   int instance_id = adr_t->instance_id();
   575   assert((uint)instance_id == alloc->_idx, "wrong allocation");
   575   assert((uint)instance_id == alloc->_idx, "wrong allocation");
   576 
   576 
   577   int alias_idx = C->get_alias_index(adr_t);
   577   int alias_idx = C->get_alias_index(adr_t);
   578   int offset = adr_t->offset();
   578   int offset = adr_t->offset();
   579   Node *start_mem = C->start()->proj_out(TypeFunc::Memory);
   579   Node *start_mem = C->start()->proj_out_or_null(TypeFunc::Memory);
   580   Node *alloc_ctrl = alloc->in(TypeFunc::Control);
   580   Node *alloc_ctrl = alloc->in(TypeFunc::Control);
   581   Node *alloc_mem = alloc->in(TypeFunc::Memory);
   581   Node *alloc_mem = alloc->in(TypeFunc::Memory);
   582   Arena *a = Thread::current()->resource_area();
   582   Arena *a = Thread::current()->resource_area();
   583   VectorSet visited(a);
   583   VectorSet visited(a);
   584 
   584 
   972   }
   972   }
   973   return true;
   973   return true;
   974 }
   974 }
   975 
   975 
   976 static void disconnect_projections(MultiNode* n, PhaseIterGVN& igvn) {
   976 static void disconnect_projections(MultiNode* n, PhaseIterGVN& igvn) {
   977   Node* ctl_proj = n->proj_out(TypeFunc::Control);
   977   Node* ctl_proj = n->proj_out_or_null(TypeFunc::Control);
   978   Node* mem_proj = n->proj_out(TypeFunc::Memory);
   978   Node* mem_proj = n->proj_out_or_null(TypeFunc::Memory);
   979   if (ctl_proj != NULL) {
   979   if (ctl_proj != NULL) {
   980     igvn.replace_node(ctl_proj, n->in(0));
   980     igvn.replace_node(ctl_proj, n->in(0));
   981   }
   981   }
   982   if (mem_proj != NULL) {
   982   if (mem_proj != NULL) {
   983     igvn.replace_node(mem_proj, n->in(TypeFunc::Memory));
   983     igvn.replace_node(mem_proj, n->in(TypeFunc::Memory));
  1084       uint oc1 = _resproj->outcnt();
  1084       uint oc1 = _resproj->outcnt();
  1085       if (use->is_Initialize()) {
  1085       if (use->is_Initialize()) {
  1086         // Eliminate Initialize node.
  1086         // Eliminate Initialize node.
  1087         InitializeNode *init = use->as_Initialize();
  1087         InitializeNode *init = use->as_Initialize();
  1088         assert(init->outcnt() <= 2, "only a control and memory projection expected");
  1088         assert(init->outcnt() <= 2, "only a control and memory projection expected");
  1089         Node *ctrl_proj = init->proj_out(TypeFunc::Control);
  1089         Node *ctrl_proj = init->proj_out_or_null(TypeFunc::Control);
  1090         if (ctrl_proj != NULL) {
  1090         if (ctrl_proj != NULL) {
  1091            assert(init->in(TypeFunc::Control) == _fallthroughcatchproj, "allocation control projection");
  1091            assert(init->in(TypeFunc::Control) == _fallthroughcatchproj, "allocation control projection");
  1092           _igvn.replace_node(ctrl_proj, _fallthroughcatchproj);
  1092           _igvn.replace_node(ctrl_proj, _fallthroughcatchproj);
  1093         }
  1093         }
  1094         Node *mem_proj = init->proj_out(TypeFunc::Memory);
  1094         Node *mem_proj = init->proj_out_or_null(TypeFunc::Memory);
  1095         if (mem_proj != NULL) {
  1095         if (mem_proj != NULL) {
  1096           Node *mem = init->in(TypeFunc::Memory);
  1096           Node *mem = init->in(TypeFunc::Memory);
  1097 #ifdef ASSERT
  1097 #ifdef ASSERT
  1098           if (mem->is_MergeMem()) {
  1098           if (mem->is_MergeMem()) {
  1099             assert(mem->in(TypeFunc::Memory) == _memproj_fallthrough, "allocation memory projection");
  1099             assert(mem->in(TypeFunc::Memory) == _memproj_fallthrough, "allocation memory projection");
  1196   return true;
  1196   return true;
  1197 }
  1197 }
  1198 
  1198 
  1199 bool PhaseMacroExpand::eliminate_boxing_node(CallStaticJavaNode *boxing) {
  1199 bool PhaseMacroExpand::eliminate_boxing_node(CallStaticJavaNode *boxing) {
  1200   // EA should remove all uses of non-escaping boxing node.
  1200   // EA should remove all uses of non-escaping boxing node.
  1201   if (!C->eliminate_boxing() || boxing->proj_out(TypeFunc::Parms) != NULL) {
  1201   if (!C->eliminate_boxing() || boxing->proj_out_or_null(TypeFunc::Parms) != NULL) {
  1202     return false;
  1202     return false;
  1203   }
  1203   }
  1204 
  1204 
  1205   assert(boxing->result_cast() == NULL, "unexpected boxing node result");
  1205   assert(boxing->result_cast() == NULL, "unexpected boxing node result");
  1206 
  1206 
  1578         // Add the MemBarStoreStore after the InitializeNode so that
  1578         // Add the MemBarStoreStore after the InitializeNode so that
  1579         // all stores performing the initialization that were moved
  1579         // all stores performing the initialization that were moved
  1580         // before the InitializeNode happen before the storestore
  1580         // before the InitializeNode happen before the storestore
  1581         // barrier.
  1581         // barrier.
  1582 
  1582 
  1583         Node* init_ctrl = init->proj_out(TypeFunc::Control);
  1583         Node* init_ctrl = init->proj_out_or_null(TypeFunc::Control);
  1584         Node* init_mem = init->proj_out(TypeFunc::Memory);
  1584         Node* init_mem = init->proj_out_or_null(TypeFunc::Memory);
  1585 
  1585 
  1586         MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot);
  1586         MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot);
  1587         transform_later(mb);
  1587         transform_later(mb);
  1588 
  1588 
  1589         Node* ctrl = new ProjNode(init,TypeFunc::Control);
  1589         Node* ctrl = new ProjNode(init,TypeFunc::Control);