< prev index next >

src/share/vm/opto/node.hpp

Print this page
rev 9821 : 8146612: C2: Precedence edges specification violated
Reviewed-by:
   1 /*
   2  * Copyright (c) 1997, 2015, 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  *


 406     Node** p = &_in[i];    // cache this._in, across the del_out call
 407     if (*p != NULL)  (*p)->del_out((Node *)this);
 408     (*p) = n;
 409     if (n != NULL)      n->add_out((Node *)this);
 410     Compile::current()->record_modified_node(this);
 411   }
 412   // Light version of set_req() to init inputs after node creation.
 413   void init_req( uint i, Node *n ) {
 414     assert( i == 0 && this == n ||
 415             is_not_dead(n), "can not use dead node");
 416     assert( i < _cnt, "oob");
 417     assert( !VerifyHashTableKeys || _hash_lock == 0,
 418             "remove node from hash table before modifying it");
 419     assert( _in[i] == NULL, "sanity");
 420     _in[i] = n;
 421     if (n != NULL)      n->add_out((Node *)this);
 422     Compile::current()->record_modified_node(this);
 423   }
 424   // Find first occurrence of n among my edges:
 425   int find_edge(Node* n);










 426   int replace_edge(Node* old, Node* neww);
 427   int replace_edges_in_range(Node* old, Node* neww, int start, int end);
 428   // NULL out all inputs to eliminate incoming Def-Use edges.
 429   // Return the number of edges between 'n' and 'this'
 430   int  disconnect_inputs(Node *n, Compile *c);
 431 
 432   // Quickly, return true if and only if I am Compile::current()->top().
 433   bool is_top() const {
 434     assert((this == (Node*) Compile::current()->top()) == (_out == NULL), "");
 435     return (_out == NULL);
 436   }
 437   // Reaffirm invariants for is_top.  (Only from Compile::set_cached_top_node.)
 438   void setup_is_top();
 439 
 440   // Strip away casting.  (It is depth-limited.)
 441   Node* uncast() const;
 442   // Return whether two Nodes are equivalent, after stripping casting.
 443   bool eqv_uncast(const Node* n) const {
 444     return (this->uncast() == n->uncast());
 445   }


 475     #if OPTO_DU_ITERATOR_ASSERT
 476     debug_only(_last_del = n; ++_del_tick);
 477     #endif
 478   }
 479 
 480 public:
 481   // Globally replace this node by a given new node, updating all uses.
 482   void replace_by(Node* new_node);
 483   // Globally replace this node by a given new node, updating all uses
 484   // and cutting input edges of old node.
 485   void subsume_by(Node* new_node, Compile* c) {
 486     replace_by(new_node);
 487     disconnect_inputs(NULL, c);
 488   }
 489   void set_req_X( uint i, Node *n, PhaseIterGVN *igvn );
 490   // Find the one non-null required input.  RegionNode only
 491   Node *nonnull_req() const;
 492   // Add or remove precedence edges
 493   void add_prec( Node *n );
 494   void rm_prec( uint i );


 495   void set_prec( uint i, Node *n ) {
 496     assert( is_not_dead(n), "can not use dead node");
 497     assert( i >= _cnt, "not a precedence edge");






 498     if (_in[i] != NULL) _in[i]->del_out((Node *)this);
 499     _in[i] = n;
 500     if (n != NULL) n->add_out((Node *)this);
 501   }

 502   // Set this node's index, used by cisc_version to replace current node
 503   void set_idx(uint new_idx) {
 504     const node_idx_t* ref = &_idx;
 505     *(node_idx_t*)ref = new_idx;
 506   }
 507   // Swap input edge order.  (Edge indexes i1 and i2 are usually 1 and 2.)
 508   void swap_edges(uint i1, uint i2) {
 509     debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
 510     // Def-Use info is unchanged
 511     Node* n1 = in(i1);
 512     Node* n2 = in(i2);
 513     _in[i1] = n2;
 514     _in[i2] = n1;
 515     // If this node is in the hash table, make sure it doesn't need a rehash.
 516     assert(check_hash == NO_HASH || check_hash == hash(), "edge swap must preserve hash code");
 517   }
 518 
 519   // Iterators over input Nodes for a Node X are written as:
 520   // for( i = 0; i < X.req(); i++ ) ... X[i] ...
 521   // NOTE: Required edges can contain embedded NULL pointers.


   1 /*
   2  * Copyright (c) 1997, 2016, 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  *


 406     Node** p = &_in[i];    // cache this._in, across the del_out call
 407     if (*p != NULL)  (*p)->del_out((Node *)this);
 408     (*p) = n;
 409     if (n != NULL)      n->add_out((Node *)this);
 410     Compile::current()->record_modified_node(this);
 411   }
 412   // Light version of set_req() to init inputs after node creation.
 413   void init_req( uint i, Node *n ) {
 414     assert( i == 0 && this == n ||
 415             is_not_dead(n), "can not use dead node");
 416     assert( i < _cnt, "oob");
 417     assert( !VerifyHashTableKeys || _hash_lock == 0,
 418             "remove node from hash table before modifying it");
 419     assert( _in[i] == NULL, "sanity");
 420     _in[i] = n;
 421     if (n != NULL)      n->add_out((Node *)this);
 422     Compile::current()->record_modified_node(this);
 423   }
 424   // Find first occurrence of n among my edges:
 425   int find_edge(Node* n);
 426   int find_prec_edge(Node* n) {
 427     for (uint i = req(); i < len(); i++) {
 428       if (_in[i] == n) return i;
 429       if (_in[i] == NULL) {
 430         DEBUG_ONLY( while ((++i) < len()) assert(_in[i] == NULL, "Gap in prec edges!"); )
 431         break;
 432       }
 433     }
 434     return -1;
 435   }
 436   int replace_edge(Node* old, Node* neww);
 437   int replace_edges_in_range(Node* old, Node* neww, int start, int end);
 438   // NULL out all inputs to eliminate incoming Def-Use edges.
 439   // Return the number of edges between 'n' and 'this'
 440   int  disconnect_inputs(Node *n, Compile *c);
 441 
 442   // Quickly, return true if and only if I am Compile::current()->top().
 443   bool is_top() const {
 444     assert((this == (Node*) Compile::current()->top()) == (_out == NULL), "");
 445     return (_out == NULL);
 446   }
 447   // Reaffirm invariants for is_top.  (Only from Compile::set_cached_top_node.)
 448   void setup_is_top();
 449 
 450   // Strip away casting.  (It is depth-limited.)
 451   Node* uncast() const;
 452   // Return whether two Nodes are equivalent, after stripping casting.
 453   bool eqv_uncast(const Node* n) const {
 454     return (this->uncast() == n->uncast());
 455   }


 485     #if OPTO_DU_ITERATOR_ASSERT
 486     debug_only(_last_del = n; ++_del_tick);
 487     #endif
 488   }
 489 
 490 public:
 491   // Globally replace this node by a given new node, updating all uses.
 492   void replace_by(Node* new_node);
 493   // Globally replace this node by a given new node, updating all uses
 494   // and cutting input edges of old node.
 495   void subsume_by(Node* new_node, Compile* c) {
 496     replace_by(new_node);
 497     disconnect_inputs(NULL, c);
 498   }
 499   void set_req_X( uint i, Node *n, PhaseIterGVN *igvn );
 500   // Find the one non-null required input.  RegionNode only
 501   Node *nonnull_req() const;
 502   // Add or remove precedence edges
 503   void add_prec( Node *n );
 504   void rm_prec( uint i );
 505 
 506   // Note: prec(i) will not necessarily point to n if edge already exists.
 507   void set_prec( uint i, Node *n ) {
 508     assert( is_not_dead(n), "can not use dead node");
 509     assert( i >= _cnt, "not a precedence edge");
 510     // Avoid spec violation: multiple prec edge.
 511     if (_in[i] == n) return;
 512     if (n == NULL || find_prec_edge(n) != -1) {
 513       rm_prec(i);
 514       return;
 515     }
 516     if (_in[i] != NULL) _in[i]->del_out((Node *)this);
 517     _in[i] = n;
 518     if (n != NULL) n->add_out((Node *)this);
 519   }
 520 
 521   // Set this node's index, used by cisc_version to replace current node
 522   void set_idx(uint new_idx) {
 523     const node_idx_t* ref = &_idx;
 524     *(node_idx_t*)ref = new_idx;
 525   }
 526   // Swap input edge order.  (Edge indexes i1 and i2 are usually 1 and 2.)
 527   void swap_edges(uint i1, uint i2) {
 528     debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
 529     // Def-Use info is unchanged
 530     Node* n1 = in(i1);
 531     Node* n2 = in(i2);
 532     _in[i1] = n2;
 533     _in[i2] = n1;
 534     // If this node is in the hash table, make sure it doesn't need a rehash.
 535     assert(check_hash == NO_HASH || check_hash == hash(), "edge swap must preserve hash code");
 536   }
 537 
 538   // Iterators over input Nodes for a Node X are written as:
 539   // for( i = 0; i < X.req(); i++ ) ... X[i] ...
 540   // NOTE: Required edges can contain embedded NULL pointers.


< prev index next >