hotspot/src/share/vm/opto/escape.cpp
changeset 46630 75aa3e39d02c
parent 46525 3a5c833a43de
equal deleted inserted replaced
46629:8eeacdc76bf2 46630:75aa3e39d02c
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
     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.
     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.
   510       const Type *adr_type = igvn->type(adr);
   510       const Type *adr_type = igvn->type(adr);
   511       adr_type = adr_type->make_ptr();
   511       adr_type = adr_type->make_ptr();
   512       if (adr_type == NULL) {
   512       if (adr_type == NULL) {
   513         break; // skip dead nodes
   513         break; // skip dead nodes
   514       }
   514       }
   515       if (adr_type->isa_oopptr() ||
   515       if (   adr_type->isa_oopptr()
   516           (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) &&
   516           || (   (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass)
   517                         (adr_type == TypeRawPtr::NOTNULL &&
   517               && adr_type == TypeRawPtr::NOTNULL
   518                          adr->in(AddPNode::Address)->is_Proj() &&
   518               && adr->in(AddPNode::Address)->is_Proj()
   519                          adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
   519               && adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
   520         delayed_worklist->push(n); // Process it later.
   520         delayed_worklist->push(n); // Process it later.
   521 #ifdef ASSERT
   521 #ifdef ASSERT
   522         assert(adr->is_AddP(), "expecting an AddP");
   522         assert(adr->is_AddP(), "expecting an AddP");
   523         if (adr_type == TypeRawPtr::NOTNULL) {
   523         if (adr_type == TypeRawPtr::NOTNULL) {
   524           // Verify a raw address for a store captured by Initialize node.
   524           // Verify a raw address for a store captured by Initialize node.
   723 #endif
   723 #endif
   724       if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN ||
   724       if (opcode == Op_GetAndSetP || opcode == Op_GetAndSetN ||
   725           opcode == Op_CompareAndExchangeN || opcode == Op_CompareAndExchangeP) {
   725           opcode == Op_CompareAndExchangeN || opcode == Op_CompareAndExchangeP) {
   726         add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL);
   726         add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL);
   727       }
   727       }
   728       if (adr_type->isa_oopptr() ||
   728       if (   adr_type->isa_oopptr()
   729           (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass) &&
   729           || (   (opcode == Op_StoreP || opcode == Op_StoreN || opcode == Op_StoreNKlass)
   730                         (adr_type == TypeRawPtr::NOTNULL &&
   730               && adr_type == TypeRawPtr::NOTNULL
   731                          adr->in(AddPNode::Address)->is_Proj() &&
   731               && adr->in(AddPNode::Address)->is_Proj()
   732                          adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
   732               && adr->in(AddPNode::Address)->in(0)->is_Allocate())) {
   733         // Point Address to Value
   733         // Point Address to Value
   734         PointsToNode* adr_ptn = ptnode_adr(adr->_idx);
   734         PointsToNode* adr_ptn = ptnode_adr(adr->_idx);
   735         assert(adr_ptn != NULL &&
   735         assert(adr_ptn != NULL &&
   736                adr_ptn->as_Field()->is_oop(), "node should be registered");
   736                adr_ptn->as_Field()->is_oop(), "node should be registered");
   737         Node *val = n->in(MemNode::ValueIn);
   737         Node *val = n->in(MemNode::ValueIn);
  1962   // Sets are disjoint.
  1962   // Sets are disjoint.
  1963   bool set1_has_unknown_ptr = ptn1->points_to(phantom_obj);
  1963   bool set1_has_unknown_ptr = ptn1->points_to(phantom_obj);
  1964   bool set2_has_unknown_ptr = ptn2->points_to(phantom_obj);
  1964   bool set2_has_unknown_ptr = ptn2->points_to(phantom_obj);
  1965   bool set1_has_null_ptr    = ptn1->points_to(null_obj);
  1965   bool set1_has_null_ptr    = ptn1->points_to(null_obj);
  1966   bool set2_has_null_ptr    = ptn2->points_to(null_obj);
  1966   bool set2_has_null_ptr    = ptn2->points_to(null_obj);
  1967   if (set1_has_unknown_ptr && set2_has_null_ptr ||
  1967   if ((set1_has_unknown_ptr && set2_has_null_ptr) ||
  1968       set2_has_unknown_ptr && set1_has_null_ptr) {
  1968       (set2_has_unknown_ptr && set1_has_null_ptr)) {
  1969     // Check nullness of unknown object.
  1969     // Check nullness of unknown object.
  1970     return NULL;
  1970     return NULL;
  1971   }
  1971   }
  1972 
  1972 
  1973   // Disjointness by itself is not sufficient since
  1973   // Disjointness by itself is not sufficient since
  2622         // Don't move related membars.
  2622         // Don't move related membars.
  2623         record_for_optimizer(use);
  2623         record_for_optimizer(use);
  2624         continue;
  2624         continue;
  2625       }
  2625       }
  2626       tp = use->as_MemBar()->adr_type()->isa_ptr();
  2626       tp = use->as_MemBar()->adr_type()->isa_ptr();
  2627       if (tp != NULL && C->get_alias_index(tp) == alias_idx ||
  2627       if ((tp != NULL && C->get_alias_index(tp) == alias_idx) ||
  2628           alias_idx == general_idx) {
  2628           alias_idx == general_idx) {
  2629         continue; // Nothing to do
  2629         continue; // Nothing to do
  2630       }
  2630       }
  2631       // Move to general memory slice.
  2631       // Move to general memory slice.
  2632       uint orig_uniq = C->unique();
  2632       uint orig_uniq = C->unique();