< prev index next >

src/hotspot/share/opto/escape.cpp

Print this page
rev 48535 : [mq]: 8194987
   1 /*
   2  * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


3209   //  Phase 2:  Process MemNode's from memnode_worklist. compute new address type and
3210   //            compute new values for Memory inputs  (the Memory inputs are not
3211   //            actually updated until phase 4.)
3212   if (memnode_worklist.length() == 0)
3213     return;  // nothing to do
3214   while (memnode_worklist.length() != 0) {
3215     Node *n = memnode_worklist.pop();
3216     if (visited.test_set(n->_idx))
3217       continue;
3218     if (n->is_Phi() || n->is_ClearArray()) {
3219       // we don't need to do anything, but the users must be pushed
3220     } else if (n->is_MemBar()) { // Initialize, MemBar nodes
3221       // we don't need to do anything, but the users must be pushed
3222       n = n->as_MemBar()->proj_out(TypeFunc::Memory);
3223       if (n == NULL)
3224         continue;
3225     } else if (n->Opcode() == Op_StrCompressedCopy ||
3226                n->Opcode() == Op_EncodeISOArray) {
3227       // get the memory projection
3228       n = n->find_out_with(Op_SCMemProj);
3229       assert(n->Opcode() == Op_SCMemProj, "memory projection required");
3230     } else {
3231       assert(n->is_Mem(), "memory node required.");
3232       Node *addr = n->in(MemNode::Address);
3233       const Type *addr_t = igvn->type(addr);
3234       if (addr_t == Type::TOP)
3235         continue;
3236       assert (addr_t->isa_ptr() != NULL, "pointer type required.");
3237       int alias_idx = _compile->get_alias_index(addr_t->is_ptr());
3238       assert ((uint)alias_idx < new_index_end, "wrong alias index");
3239       Node *mem = find_inst_mem(n->in(MemNode::Memory), alias_idx, orig_phis);
3240       if (_compile->failing()) {
3241         return;
3242       }
3243       if (mem != n->in(MemNode::Memory)) {
3244         // We delay the memory edge update since we need old one in
3245         // MergeMem code below when instances memory slices are separated.
3246         set_map(n, mem);
3247       }
3248       if (n->is_Load()) {
3249         continue;  // don't push users
3250       } else if (n->is_LoadStore()) {
3251         // get the memory projection
3252         n = n->find_out_with(Op_SCMemProj);
3253         assert(n->Opcode() == Op_SCMemProj, "memory projection required");
3254       }
3255     }
3256     // push user on appropriate worklist
3257     for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
3258       Node *use = n->fast_out(i);
3259       if (use->is_Phi() || use->is_ClearArray()) {
3260         memnode_worklist.append_if_missing(use);
3261       } else if (use->is_Mem() && use->in(MemNode::Memory) == n) {
3262         if (use->Opcode() == Op_StoreCM) // Ignore cardmark stores
3263           continue;
3264         memnode_worklist.append_if_missing(use);
3265       } else if (use->is_MemBar()) {
3266         if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge
3267           memnode_worklist.append_if_missing(use);
3268         }
3269 #ifdef ASSERT
3270       } else if(use->is_Mem()) {
3271         assert(use->in(MemNode::Memory) != n, "EA: missing memory path");
3272       } else if (use->is_MergeMem()) {
3273         assert(_mergemem_worklist.contains(use->as_MergeMem()), "EA: missing MergeMem node in the worklist");


   1 /*
   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.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


3209   //  Phase 2:  Process MemNode's from memnode_worklist. compute new address type and
3210   //            compute new values for Memory inputs  (the Memory inputs are not
3211   //            actually updated until phase 4.)
3212   if (memnode_worklist.length() == 0)
3213     return;  // nothing to do
3214   while (memnode_worklist.length() != 0) {
3215     Node *n = memnode_worklist.pop();
3216     if (visited.test_set(n->_idx))
3217       continue;
3218     if (n->is_Phi() || n->is_ClearArray()) {
3219       // we don't need to do anything, but the users must be pushed
3220     } else if (n->is_MemBar()) { // Initialize, MemBar nodes
3221       // we don't need to do anything, but the users must be pushed
3222       n = n->as_MemBar()->proj_out(TypeFunc::Memory);
3223       if (n == NULL)
3224         continue;
3225     } else if (n->Opcode() == Op_StrCompressedCopy ||
3226                n->Opcode() == Op_EncodeISOArray) {
3227       // get the memory projection
3228       n = n->find_out_with(Op_SCMemProj);
3229       assert(n != NULL && n->Opcode() == Op_SCMemProj, "memory projection required");
3230     } else {
3231       assert(n->is_Mem(), "memory node required.");
3232       Node *addr = n->in(MemNode::Address);
3233       const Type *addr_t = igvn->type(addr);
3234       if (addr_t == Type::TOP)
3235         continue;
3236       assert (addr_t->isa_ptr() != NULL, "pointer type required.");
3237       int alias_idx = _compile->get_alias_index(addr_t->is_ptr());
3238       assert ((uint)alias_idx < new_index_end, "wrong alias index");
3239       Node *mem = find_inst_mem(n->in(MemNode::Memory), alias_idx, orig_phis);
3240       if (_compile->failing()) {
3241         return;
3242       }
3243       if (mem != n->in(MemNode::Memory)) {
3244         // We delay the memory edge update since we need old one in
3245         // MergeMem code below when instances memory slices are separated.
3246         set_map(n, mem);
3247       }
3248       if (n->is_Load()) {
3249         continue;  // don't push users
3250       } else if (n->is_LoadStore()) {
3251         // get the memory projection
3252         n = n->find_out_with(Op_SCMemProj);
3253         assert(n != NULL && n->Opcode() == Op_SCMemProj, "memory projection required");
3254       }
3255     }
3256     // push user on appropriate worklist
3257     for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
3258       Node *use = n->fast_out(i);
3259       if (use->is_Phi() || use->is_ClearArray()) {
3260         memnode_worklist.append_if_missing(use);
3261       } else if (use->is_Mem() && use->in(MemNode::Memory) == n) {
3262         if (use->Opcode() == Op_StoreCM) // Ignore cardmark stores
3263           continue;
3264         memnode_worklist.append_if_missing(use);
3265       } else if (use->is_MemBar()) {
3266         if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge
3267           memnode_worklist.append_if_missing(use);
3268         }
3269 #ifdef ASSERT
3270       } else if(use->is_Mem()) {
3271         assert(use->in(MemNode::Memory) != n, "EA: missing memory path");
3272       } else if (use->is_MergeMem()) {
3273         assert(_mergemem_worklist.contains(use->as_MergeMem()), "EA: missing MergeMem node in the worklist");


< prev index next >