src/share/vm/opto/locknode.hpp

Wed, 13 Aug 2014 11:00:22 +0200

author
roland
date
Wed, 13 Aug 2014 11:00:22 +0200
changeset 7041
411e30e5fbb8
parent 6518
62c54fcc0a35
child 6876
710a3c8b516e
child 7598
ddce0b7cee93
permissions
-rw-r--r--

8026796: Make replace_in_map() on parent maps generic
Summary: propagate node replacements along control flow edges to callers
Reviewed-by: kvn, vlivanov

duke@435 1 /*
mikael@4153 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_OPTO_LOCKNODE_HPP
stefank@2314 26 #define SHARE_VM_OPTO_LOCKNODE_HPP
stefank@2314 27
stefank@2314 28 #include "opto/node.hpp"
stefank@2314 29 #include "opto/opcodes.hpp"
stefank@2314 30 #include "opto/subnode.hpp"
stefank@2314 31 #ifdef TARGET_ARCH_MODEL_x86_32
stefank@2314 32 # include "adfiles/ad_x86_32.hpp"
stefank@2314 33 #endif
stefank@2314 34 #ifdef TARGET_ARCH_MODEL_x86_64
stefank@2314 35 # include "adfiles/ad_x86_64.hpp"
stefank@2314 36 #endif
stefank@2314 37 #ifdef TARGET_ARCH_MODEL_sparc
stefank@2314 38 # include "adfiles/ad_sparc.hpp"
stefank@2314 39 #endif
stefank@2314 40 #ifdef TARGET_ARCH_MODEL_zero
stefank@2314 41 # include "adfiles/ad_zero.hpp"
stefank@2314 42 #endif
bobv@2508 43 #ifdef TARGET_ARCH_MODEL_arm
bobv@2508 44 # include "adfiles/ad_arm.hpp"
bobv@2508 45 #endif
goetz@6441 46 #ifdef TARGET_ARCH_MODEL_ppc_32
goetz@6441 47 # include "adfiles/ad_ppc_32.hpp"
goetz@6441 48 #endif
goetz@6441 49 #ifdef TARGET_ARCH_MODEL_ppc_64
goetz@6441 50 # include "adfiles/ad_ppc_64.hpp"
bobv@2508 51 #endif
stefank@2314 52
duke@435 53 //------------------------------BoxLockNode------------------------------------
duke@435 54 class BoxLockNode : public Node {
kvn@3419 55 const int _slot; // stack slot
kvn@3419 56 RegMask _inmask; // OptoReg corresponding to stack slot
kvn@3419 57 bool _is_eliminated; // Associated locks were safely eliminated
duke@435 58
kvn@3406 59 public:
duke@435 60 BoxLockNode( int lock );
duke@435 61 virtual int Opcode() const;
duke@435 62 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
duke@435 63 virtual uint size(PhaseRegAlloc *ra_) const;
duke@435 64 virtual const RegMask &in_RegMask(uint) const;
duke@435 65 virtual const RegMask &out_RegMask() const;
duke@435 66 virtual uint size_of() const;
kvn@895 67 virtual uint hash() const;
duke@435 68 virtual uint cmp( const Node &n ) const;
duke@435 69 virtual const class Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
duke@435 70 virtual uint ideal_reg() const { return Op_RegP; }
duke@435 71
kvn@3406 72 static OptoReg::Name reg(Node* box_node);
kvn@3406 73 static BoxLockNode* box_node(Node* box_node);
kvn@3419 74 static bool same_slot(Node* box1, Node* box2) {
kvn@3419 75 return box1->as_BoxLock()->_slot == box2->as_BoxLock()->_slot;
kvn@3419 76 }
kvn@3406 77 int stack_slot() const { return _slot; }
duke@435 78
kvn@3406 79 bool is_eliminated() const { return _is_eliminated; }
kvn@501 80 // mark lock as eliminated.
kvn@3406 81 void set_eliminated() { _is_eliminated = true; }
kvn@3406 82
kvn@3406 83 // Is BoxLock node used for one simple lock region?
kvn@3406 84 bool is_simple_lock_region(LockNode** unique_lock, Node* obj);
kvn@501 85
duke@435 86 #ifndef PRODUCT
duke@435 87 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
duke@435 88 virtual void dump_spec(outputStream *st) const { st->print(" Lock %d",_slot); }
duke@435 89 #endif
duke@435 90 };
duke@435 91
duke@435 92 //------------------------------FastLockNode-----------------------------------
duke@435 93 class FastLockNode: public CmpNode {
duke@435 94 private:
kvn@6429 95 BiasedLockingCounters* _counters;
kvn@6429 96 RTMLockingCounters* _rtm_counters; // RTM lock counters for inflated locks
kvn@6429 97 RTMLockingCounters* _stack_rtm_counters; // RTM lock counters for stack locks
duke@435 98
duke@435 99 public:
duke@435 100 FastLockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) {
duke@435 101 init_req(0,ctrl);
duke@435 102 init_class_id(Class_FastLock);
duke@435 103 _counters = NULL;
kvn@6429 104 _rtm_counters = NULL;
kvn@6429 105 _stack_rtm_counters = NULL;
duke@435 106 }
duke@435 107 Node* obj_node() const { return in(1); }
duke@435 108 Node* box_node() const { return in(2); }
kvn@3406 109 void set_box_node(Node* box) { set_req(2, box); }
duke@435 110
duke@435 111 // FastLock and FastUnlockNode do not hash, we need one for each correspoding
duke@435 112 // LockNode/UnLockNode to avoid creating Phi's.
duke@435 113 virtual uint hash() const ; // { return NO_HASH; }
kvn@6429 114 virtual uint size_of() const;
duke@435 115 virtual uint cmp( const Node &n ) const ; // Always fail, except on self
duke@435 116 virtual int Opcode() const;
duke@435 117 virtual const Type *Value( PhaseTransform *phase ) const { return TypeInt::CC; }
duke@435 118 const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;}
duke@435 119
duke@435 120 void create_lock_counter(JVMState* s);
kvn@6429 121 void create_rtm_lock_counter(JVMState* state);
kvn@6429 122 BiasedLockingCounters* counters() const { return _counters; }
kvn@6429 123 RTMLockingCounters* rtm_counters() const { return _rtm_counters; }
kvn@6429 124 RTMLockingCounters* stack_rtm_counters() const { return _stack_rtm_counters; }
duke@435 125 };
duke@435 126
duke@435 127
duke@435 128 //------------------------------FastUnlockNode---------------------------------
duke@435 129 class FastUnlockNode: public CmpNode {
duke@435 130 public:
duke@435 131 FastUnlockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) {
duke@435 132 init_req(0,ctrl);
duke@435 133 init_class_id(Class_FastUnlock);
duke@435 134 }
duke@435 135 Node* obj_node() const { return in(1); }
duke@435 136 Node* box_node() const { return in(2); }
duke@435 137
duke@435 138
duke@435 139 // FastLock and FastUnlockNode do not hash, we need one for each correspoding
duke@435 140 // LockNode/UnLockNode to avoid creating Phi's.
duke@435 141 virtual uint hash() const ; // { return NO_HASH; }
duke@435 142 virtual uint cmp( const Node &n ) const ; // Always fail, except on self
duke@435 143 virtual int Opcode() const;
duke@435 144 virtual const Type *Value( PhaseTransform *phase ) const { return TypeInt::CC; }
duke@435 145 const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;}
duke@435 146
duke@435 147 };
stefank@2314 148
stefank@2314 149 #endif // SHARE_VM_OPTO_LOCKNODE_HPP

mercurial