Mercurial > hg > truffle
comparison src/share/vm/opto/locknode.hpp @ 4777:e9a5e0a812c8
7125896: Eliminate nested locks
Summary: Nested locks elimination done before lock nodes expansion by looking for outer locks of the same object.
Reviewed-by: never, twisti
author | kvn |
---|---|
date | Sat, 07 Jan 2012 13:26:43 -0800 |
parents | 1d1603768966 |
children | b0ff910edfc9 |
comparison
equal
deleted
inserted
replaced
4776:5da7201222d5 | 4777:e9a5e0a812c8 |
---|---|
47 # include "adfiles/ad_ppc.hpp" | 47 # include "adfiles/ad_ppc.hpp" |
48 #endif | 48 #endif |
49 | 49 |
50 //------------------------------BoxLockNode------------------------------------ | 50 //------------------------------BoxLockNode------------------------------------ |
51 class BoxLockNode : public Node { | 51 class BoxLockNode : public Node { |
52 public: | |
53 const int _slot; | 52 const int _slot; |
54 RegMask _inmask; | 53 RegMask _inmask; |
55 bool _is_eliminated; // indicates this lock was safely eliminated | 54 bool _is_eliminated; // indicates this lock was safely eliminated |
56 | 55 |
56 public: | |
57 BoxLockNode( int lock ); | 57 BoxLockNode( int lock ); |
58 virtual int Opcode() const; | 58 virtual int Opcode() const; |
59 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | 59 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; |
60 virtual uint size(PhaseRegAlloc *ra_) const; | 60 virtual uint size(PhaseRegAlloc *ra_) const; |
61 virtual const RegMask &in_RegMask(uint) const; | 61 virtual const RegMask &in_RegMask(uint) const; |
64 virtual uint hash() const; | 64 virtual uint hash() const; |
65 virtual uint cmp( const Node &n ) const; | 65 virtual uint cmp( const Node &n ) const; |
66 virtual const class Type *bottom_type() const { return TypeRawPtr::BOTTOM; } | 66 virtual const class Type *bottom_type() const { return TypeRawPtr::BOTTOM; } |
67 virtual uint ideal_reg() const { return Op_RegP; } | 67 virtual uint ideal_reg() const { return Op_RegP; } |
68 | 68 |
69 static OptoReg::Name stack_slot(Node* box_node); | 69 static OptoReg::Name reg(Node* box_node); |
70 static BoxLockNode* box_node(Node* box_node); | |
71 static bool same_slot(Node* box1, Node* box2); | |
72 int stack_slot() const { return _slot; } | |
70 | 73 |
71 bool is_eliminated() { return _is_eliminated; } | 74 bool is_eliminated() const { return _is_eliminated; } |
72 // mark lock as eliminated. | 75 // mark lock as eliminated. |
73 void set_eliminated() { _is_eliminated = true; } | 76 void set_eliminated() { _is_eliminated = true; } |
77 | |
78 // Is BoxLock node used for one simple lock region? | |
79 bool is_simple_lock_region(LockNode** unique_lock, Node* obj); | |
74 | 80 |
75 #ifndef PRODUCT | 81 #ifndef PRODUCT |
76 virtual void format( PhaseRegAlloc *, outputStream *st ) const; | 82 virtual void format( PhaseRegAlloc *, outputStream *st ) const; |
77 virtual void dump_spec(outputStream *st) const { st->print(" Lock %d",_slot); } | 83 virtual void dump_spec(outputStream *st) const { st->print(" Lock %d",_slot); } |
78 #endif | 84 #endif |
89 init_class_id(Class_FastLock); | 95 init_class_id(Class_FastLock); |
90 _counters = NULL; | 96 _counters = NULL; |
91 } | 97 } |
92 Node* obj_node() const { return in(1); } | 98 Node* obj_node() const { return in(1); } |
93 Node* box_node() const { return in(2); } | 99 Node* box_node() const { return in(2); } |
100 void set_box_node(Node* box) { set_req(2, box); } | |
94 | 101 |
95 // FastLock and FastUnlockNode do not hash, we need one for each correspoding | 102 // FastLock and FastUnlockNode do not hash, we need one for each correspoding |
96 // LockNode/UnLockNode to avoid creating Phi's. | 103 // LockNode/UnLockNode to avoid creating Phi's. |
97 virtual uint hash() const ; // { return NO_HASH; } | 104 virtual uint hash() const ; // { return NO_HASH; } |
98 virtual uint cmp( const Node &n ) const ; // Always fail, except on self | 105 virtual uint cmp( const Node &n ) const ; // Always fail, except on self |