src/share/vm/opto/replacednodes.hpp

Wed, 03 Jun 2015 14:22:57 +0200

author
roland
date
Wed, 03 Jun 2015 14:22:57 +0200
changeset 7859
c1c199dde5c9
parent 7041
411e30e5fbb8
child 8723
9f5da1a1724c
permissions
-rw-r--r--

8077504: Unsafe load can loose control dependency and cause crash
Summary: Node::depends_only_on_test() should return false for Unsafe loads
Reviewed-by: kvn, adinn

     1 /*
     2  * Copyright (c) 2014, 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  *
    23  */
    25 #ifndef SHARE_VM_OPTO_REPLACEDNODES_HPP
    26 #define SHARE_VM_OPTO_REPLACEDNODES_HPP
    28 #include "opto/connode.hpp"
    30 // During parsing, when a node is "improved",
    31 // GraphKit::replace_in_map() is called to update the current map so
    32 // that the improved node is used from that point
    33 // on. GraphKit::replace_in_map() doesn't operate on the callers maps
    34 // and so some optimization opportunities may be lost. The
    35 // ReplacedNodes class addresses that problem.
    36 //
    37 // A ReplacedNodes object is a list of pair of nodes. Every
    38 // SafePointNode carries a ReplacedNodes object. Every time
    39 // GraphKit::replace_in_map() is called, a new pair of nodes is pushed
    40 // on the list of replaced nodes. When control flow paths merge, their
    41 // replaced nodes are also merged. When parsing exits a method to
    42 // return to a caller, the replaced nodes on the exit path are used to
    43 // update the caller's map.
    44 class ReplacedNodes VALUE_OBJ_CLASS_SPEC {
    45  private:
    46   class ReplacedNode VALUE_OBJ_CLASS_SPEC {
    47   private:
    48     Node* _initial;
    49     Node* _improved;
    50   public:
    51     ReplacedNode() : _initial(NULL), _improved(NULL) {}
    52     ReplacedNode(Node* initial, Node* improved) : _initial(initial), _improved(improved) {}
    53     Node* initial() const  { return _initial; }
    54     Node* improved() const { return _improved; }
    56     bool operator==(const ReplacedNode& other) {
    57       return _initial == other._initial && _improved == other._improved;
    58     }
    59   };
    60   GrowableArray<ReplacedNode>* _replaced_nodes;
    62   void allocate_if_necessary();
    63   bool has_node(const ReplacedNode& r) const;
    64   bool has_target_node(Node* n) const;
    66  public:
    67   ReplacedNodes()
    68     : _replaced_nodes(NULL) {}
    70   void clone();
    71   void record(Node* initial, Node* improved);
    72   void transfer_from(const ReplacedNodes& other, uint idx);
    73   void reset();
    74   void apply(Node* n);
    75   void merge_with(const ReplacedNodes& other);
    76   bool is_empty() const;
    77   void dump(outputStream *st) const;
    78   void apply(Compile* C, Node* ctl);
    79 };
    81 #endif // SHARE_VM_OPTO_REPLACEDNODES_HPP

mercurial