< prev index next >

src/share/vm/opto/escape.cpp

Print this page
rev 12906 : [mq]: gc_interface


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/bcEscapeAnalyzer.hpp"
  27 #include "compiler/compileLog.hpp"

  28 #include "libadt/vectset.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "opto/c2compiler.hpp"
  32 #include "opto/arraycopynode.hpp"
  33 #include "opto/callnode.hpp"
  34 #include "opto/cfgnode.hpp"
  35 #include "opto/compile.hpp"
  36 #include "opto/escape.hpp"
  37 #include "opto/phaseX.hpp"
  38 #include "opto/movenode.hpp"
  39 #include "opto/rootnode.hpp"
  40 
  41 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
  42   _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
  43   _in_worklist(C->comp_arena()),
  44   _next_pidx(0),
  45   _collecting(true),
  46   _verify(false),
  47   _compile(C),


 960           assert(aat == Type::TOP || aat == TypePtr::NULL_PTR ||
 961                  aat->isa_ptr() != NULL, "expecting an Ptr");
 962           bool arg_has_oops = aat->isa_oopptr() &&
 963                               (aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() ||
 964                                (aat->isa_aryptr() && aat->isa_aryptr()->klass()->is_obj_array_klass()));
 965           if (i == TypeFunc::Parms) {
 966             src_has_oops = arg_has_oops;
 967           }
 968           //
 969           // src or dst could be j.l.Object when other is basic type array:
 970           //
 971           //   arraycopy(char[],0,Object*,0,size);
 972           //   arraycopy(Object*,0,char[],0,size);
 973           //
 974           // Don't add edges in such cases.
 975           //
 976           bool arg_is_arraycopy_dest = src_has_oops && is_arraycopy &&
 977                                        arg_has_oops && (i > TypeFunc::Parms);
 978 #ifdef ASSERT
 979           if (!(is_arraycopy ||

 980                 (call->as_CallLeaf()->_name != NULL &&
 981                  (strcmp(call->as_CallLeaf()->_name, "g1_wb_pre")  == 0 ||
 982                   strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 ||
 983                   strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||
 984                   strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 ||
 985                   strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 ||
 986                   strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
 987                   strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||
 988                   strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 ||
 989                   strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 ||
 990                   strcmp(call->as_CallLeaf()->_name, "counterMode_AESCrypt") == 0 ||
 991                   strcmp(call->as_CallLeaf()->_name, "ghash_processBlocks") == 0 ||
 992                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 ||
 993                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 ||
 994                   strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 ||
 995                   strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 ||
 996                   strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 ||
 997                   strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 ||
 998                   strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 ||
 999                   strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 ||
1000                   strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 ||
1001                   strcmp(call->as_CallLeaf()->_name, "montgomery_multiply") == 0 ||
1002                   strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0 ||
1003                   strcmp(call->as_CallLeaf()->_name, "vectorizedMismatch") == 0)


3251       } else if (use->is_MemBar()) {
3252         if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge
3253           memnode_worklist.append_if_missing(use);
3254         }
3255 #ifdef ASSERT
3256       } else if(use->is_Mem()) {
3257         assert(use->in(MemNode::Memory) != n, "EA: missing memory path");
3258       } else if (use->is_MergeMem()) {
3259         assert(_mergemem_worklist.contains(use->as_MergeMem()), "EA: missing MergeMem node in the worklist");
3260       } else if (use->Opcode() == Op_EncodeISOArray) {
3261         if (use->in(MemNode::Memory) == n || use->in(3) == n) {
3262           // EncodeISOArray overwrites destination array
3263           memnode_worklist.append_if_missing(use);
3264         }
3265       } else {
3266         uint op = use->Opcode();
3267         if ((use->in(MemNode::Memory) == n) &&
3268             (op == Op_StrCompressedCopy || op == Op_StrInflatedCopy)) {
3269           // They overwrite memory edge corresponding to destination array,
3270           memnode_worklist.append_if_missing(use);
3271         } else if (!(op == Op_StoreCM ||
3272               (op == Op_CallLeaf && use->as_CallLeaf()->_name != NULL &&
3273                strcmp(use->as_CallLeaf()->_name, "g1_wb_pre") == 0) ||
3274               op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives ||
3275               op == Op_StrCompressedCopy || op == Op_StrInflatedCopy ||
3276               op == Op_StrEquals || op == Op_StrIndexOf || op == Op_StrIndexOfChar)) {
3277           n->dump();
3278           use->dump();
3279           assert(false, "EA: missing memory path");
3280         }
3281 #endif
3282       }
3283     }
3284   }
3285 
3286   //  Phase 3:  Process MergeMem nodes from mergemem_worklist.
3287   //            Walk each memory slice moving the first node encountered of each
3288   //            instance type to the the input corresponding to its alias index.
3289   uint length = _mergemem_worklist.length();
3290   for( uint next = 0; next < length; ++next ) {
3291     MergeMemNode* nmm = _mergemem_worklist.at(next);
3292     assert(!visited.test_set(nmm->_idx), "should not be visited before");
3293     // Note: we don't want to use MergeMemStream here because we only want to




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/bcEscapeAnalyzer.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "gc/shared/c2BarrierSetCodeGen.hpp"
  29 #include "libadt/vectset.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "opto/c2compiler.hpp"
  33 #include "opto/arraycopynode.hpp"
  34 #include "opto/callnode.hpp"
  35 #include "opto/cfgnode.hpp"
  36 #include "opto/compile.hpp"
  37 #include "opto/escape.hpp"
  38 #include "opto/phaseX.hpp"
  39 #include "opto/movenode.hpp"
  40 #include "opto/rootnode.hpp"
  41 
  42 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
  43   _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
  44   _in_worklist(C->comp_arena()),
  45   _next_pidx(0),
  46   _collecting(true),
  47   _verify(false),
  48   _compile(C),


 961           assert(aat == Type::TOP || aat == TypePtr::NULL_PTR ||
 962                  aat->isa_ptr() != NULL, "expecting an Ptr");
 963           bool arg_has_oops = aat->isa_oopptr() &&
 964                               (aat->isa_oopptr()->klass() == NULL || aat->isa_instptr() ||
 965                                (aat->isa_aryptr() && aat->isa_aryptr()->klass()->is_obj_array_klass()));
 966           if (i == TypeFunc::Parms) {
 967             src_has_oops = arg_has_oops;
 968           }
 969           //
 970           // src or dst could be j.l.Object when other is basic type array:
 971           //
 972           //   arraycopy(char[],0,Object*,0,size);
 973           //   arraycopy(Object*,0,char[],0,size);
 974           //
 975           // Don't add edges in such cases.
 976           //
 977           bool arg_is_arraycopy_dest = src_has_oops && is_arraycopy &&
 978                                        arg_has_oops && (i > TypeFunc::Parms);
 979 #ifdef ASSERT
 980           if (!(is_arraycopy ||
 981                 Universe::heap()->barrier_set()->c2_code_gen()->is_gc_barrier_node(call) ||
 982                 (call->as_CallLeaf()->_name != NULL &&
 983                  (strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 ||


 984                   strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32C") == 0 ||
 985                   strcmp(call->as_CallLeaf()->_name, "updateBytesAdler32") == 0 ||
 986                   strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 ||
 987                   strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 ||
 988                   strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 ||
 989                   strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_decryptAESCrypt") == 0 ||
 990                   strcmp(call->as_CallLeaf()->_name, "counterMode_AESCrypt") == 0 ||
 991                   strcmp(call->as_CallLeaf()->_name, "ghash_processBlocks") == 0 ||
 992                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompress") == 0 ||
 993                   strcmp(call->as_CallLeaf()->_name, "sha1_implCompressMB") == 0 ||
 994                   strcmp(call->as_CallLeaf()->_name, "sha256_implCompress") == 0 ||
 995                   strcmp(call->as_CallLeaf()->_name, "sha256_implCompressMB") == 0 ||
 996                   strcmp(call->as_CallLeaf()->_name, "sha512_implCompress") == 0 ||
 997                   strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 ||
 998                   strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 ||
 999                   strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 ||
1000                   strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 ||
1001                   strcmp(call->as_CallLeaf()->_name, "montgomery_multiply") == 0 ||
1002                   strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0 ||
1003                   strcmp(call->as_CallLeaf()->_name, "vectorizedMismatch") == 0)


3251       } else if (use->is_MemBar()) {
3252         if (use->in(TypeFunc::Memory) == n) { // Ignore precedent edge
3253           memnode_worklist.append_if_missing(use);
3254         }
3255 #ifdef ASSERT
3256       } else if(use->is_Mem()) {
3257         assert(use->in(MemNode::Memory) != n, "EA: missing memory path");
3258       } else if (use->is_MergeMem()) {
3259         assert(_mergemem_worklist.contains(use->as_MergeMem()), "EA: missing MergeMem node in the worklist");
3260       } else if (use->Opcode() == Op_EncodeISOArray) {
3261         if (use->in(MemNode::Memory) == n || use->in(3) == n) {
3262           // EncodeISOArray overwrites destination array
3263           memnode_worklist.append_if_missing(use);
3264         }
3265       } else {
3266         uint op = use->Opcode();
3267         if ((use->in(MemNode::Memory) == n) &&
3268             (op == Op_StrCompressedCopy || op == Op_StrInflatedCopy)) {
3269           // They overwrite memory edge corresponding to destination array,
3270           memnode_worklist.append_if_missing(use);
3271         } else if (!(Universe::heap()->barrier_set()->c2_code_gen()->is_gc_barrier_node(use) ||


3272               op == Op_AryEq || op == Op_StrComp || op == Op_HasNegatives ||
3273               op == Op_StrCompressedCopy || op == Op_StrInflatedCopy ||
3274               op == Op_StrEquals || op == Op_StrIndexOf || op == Op_StrIndexOfChar)) {
3275           n->dump();
3276           use->dump();
3277           assert(false, "EA: missing memory path");
3278         }
3279 #endif
3280       }
3281     }
3282   }
3283 
3284   //  Phase 3:  Process MergeMem nodes from mergemem_worklist.
3285   //            Walk each memory slice moving the first node encountered of each
3286   //            instance type to the the input corresponding to its alias index.
3287   uint length = _mergemem_worklist.length();
3288   for( uint next = 0; next < length; ++next ) {
3289     MergeMemNode* nmm = _mergemem_worklist.at(next);
3290     assert(!visited.test_set(nmm->_idx), "should not be visited before");
3291     // Note: we don't want to use MergeMemStream here because we only want to


< prev index next >