src/share/vm/opto/replacednodes.hpp

Fri, 11 Jul 2014 19:51:36 -0400

author
drchase
date
Fri, 11 Jul 2014 19:51:36 -0400
changeset 7161
fc2c88ea11a9
parent 7041
411e30e5fbb8
child 8723
9f5da1a1724c
permissions
-rw-r--r--

8036588: VerifyFieldClosure fails instanceKlass:3133
Summary: Changed deopt live-pointer test to use returns-object instead of live-and-returns-object
Reviewed-by: iveresov, kvn, jrose

roland@7041 1 /*
roland@7041 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
roland@7041 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
roland@7041 4 *
roland@7041 5 * This code is free software; you can redistribute it and/or modify it
roland@7041 6 * under the terms of the GNU General Public License version 2 only, as
roland@7041 7 * published by the Free Software Foundation.
roland@7041 8 *
roland@7041 9 * This code is distributed in the hope that it will be useful, but WITHOUT
roland@7041 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
roland@7041 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
roland@7041 12 * version 2 for more details (a copy is included in the LICENSE file that
roland@7041 13 * accompanied this code).
roland@7041 14 *
roland@7041 15 * You should have received a copy of the GNU General Public License version
roland@7041 16 * 2 along with this work; if not, write to the Free Software Foundation,
roland@7041 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
roland@7041 18 *
roland@7041 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
roland@7041 20 * or visit www.oracle.com if you need additional information or have any
roland@7041 21 * questions.
roland@7041 22 *
roland@7041 23 */
roland@7041 24
roland@7041 25 #ifndef SHARE_VM_OPTO_REPLACEDNODES_HPP
roland@7041 26 #define SHARE_VM_OPTO_REPLACEDNODES_HPP
roland@7041 27
roland@7041 28 #include "opto/connode.hpp"
roland@7041 29
roland@7041 30 // During parsing, when a node is "improved",
roland@7041 31 // GraphKit::replace_in_map() is called to update the current map so
roland@7041 32 // that the improved node is used from that point
roland@7041 33 // on. GraphKit::replace_in_map() doesn't operate on the callers maps
roland@7041 34 // and so some optimization opportunities may be lost. The
roland@7041 35 // ReplacedNodes class addresses that problem.
roland@7041 36 //
roland@7041 37 // A ReplacedNodes object is a list of pair of nodes. Every
roland@7041 38 // SafePointNode carries a ReplacedNodes object. Every time
roland@7041 39 // GraphKit::replace_in_map() is called, a new pair of nodes is pushed
roland@7041 40 // on the list of replaced nodes. When control flow paths merge, their
roland@7041 41 // replaced nodes are also merged. When parsing exits a method to
roland@7041 42 // return to a caller, the replaced nodes on the exit path are used to
roland@7041 43 // update the caller's map.
roland@7041 44 class ReplacedNodes VALUE_OBJ_CLASS_SPEC {
roland@7041 45 private:
roland@7041 46 class ReplacedNode VALUE_OBJ_CLASS_SPEC {
roland@7041 47 private:
roland@7041 48 Node* _initial;
roland@7041 49 Node* _improved;
roland@7041 50 public:
roland@7041 51 ReplacedNode() : _initial(NULL), _improved(NULL) {}
roland@7041 52 ReplacedNode(Node* initial, Node* improved) : _initial(initial), _improved(improved) {}
roland@7041 53 Node* initial() const { return _initial; }
roland@7041 54 Node* improved() const { return _improved; }
roland@7041 55
roland@7041 56 bool operator==(const ReplacedNode& other) {
roland@7041 57 return _initial == other._initial && _improved == other._improved;
roland@7041 58 }
roland@7041 59 };
roland@7041 60 GrowableArray<ReplacedNode>* _replaced_nodes;
roland@7041 61
roland@7041 62 void allocate_if_necessary();
roland@7041 63 bool has_node(const ReplacedNode& r) const;
roland@7041 64 bool has_target_node(Node* n) const;
roland@7041 65
roland@7041 66 public:
roland@7041 67 ReplacedNodes()
roland@7041 68 : _replaced_nodes(NULL) {}
roland@7041 69
roland@7041 70 void clone();
roland@7041 71 void record(Node* initial, Node* improved);
roland@7041 72 void transfer_from(const ReplacedNodes& other, uint idx);
roland@7041 73 void reset();
roland@7041 74 void apply(Node* n);
roland@7041 75 void merge_with(const ReplacedNodes& other);
roland@7041 76 bool is_empty() const;
roland@7041 77 void dump(outputStream *st) const;
roland@7041 78 void apply(Compile* C, Node* ctl);
roland@7041 79 };
roland@7041 80
roland@7041 81 #endif // SHARE_VM_OPTO_REPLACEDNODES_HPP

mercurial