Mercurial > hg > graal-compiler
annotate src/share/vm/opto/locknode.cpp @ 987:00977607da34
6879921: CTW failure jdk6_18/hotspot/src/share/vm/utilities/globalDefinitions.cpp:268
Summary: filter out non-primitives before deciding whether two ops can be packed
Reviewed-by: kvn, never
author | cfang |
---|---|
date | Tue, 15 Sep 2009 11:09:34 -0700 |
parents | 98cb887364d3 |
children | c18cbe5936b8 |
rev | line source |
---|---|
0 | 1 /* |
196 | 2 * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. |
0 | 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_locknode.cpp.incl" | |
27 | |
28 //============================================================================= | |
29 const RegMask &BoxLockNode::in_RegMask(uint i) const { | |
30 return _inmask; | |
31 } | |
32 | |
33 const RegMask &BoxLockNode::out_RegMask() const { | |
34 return *Matcher::idealreg2regmask[Op_RegP]; | |
35 } | |
36 | |
37 uint BoxLockNode::size_of() const { return sizeof(*this); } | |
38 | |
66
6dbf1a175d6b
6672848: (Escape Analysis) improve lock elimination with EA
kvn
parents:
0
diff
changeset
|
39 BoxLockNode::BoxLockNode( int slot ) : Node( Compile::current()->root() ), |
6dbf1a175d6b
6672848: (Escape Analysis) improve lock elimination with EA
kvn
parents:
0
diff
changeset
|
40 _slot(slot), _is_eliminated(false) { |
0 | 41 init_class_id(Class_BoxLock); |
42 init_flags(Flag_rematerialize); | |
43 OptoReg::Name reg = OptoReg::stack2reg(_slot); | |
44 _inmask.Insert(reg); | |
45 } | |
46 | |
460
424f9bfe6b96
6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
196
diff
changeset
|
47 //-----------------------------hash-------------------------------------------- |
424f9bfe6b96
6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
196
diff
changeset
|
48 uint BoxLockNode::hash() const { |
424f9bfe6b96
6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
196
diff
changeset
|
49 return Node::hash() + _slot + (_is_eliminated ? Compile::current()->fixed_slots() : 0); |
424f9bfe6b96
6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
196
diff
changeset
|
50 } |
424f9bfe6b96
6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
196
diff
changeset
|
51 |
0 | 52 //------------------------------cmp-------------------------------------------- |
53 uint BoxLockNode::cmp( const Node &n ) const { | |
54 const BoxLockNode &bn = (const BoxLockNode &)n; | |
460
424f9bfe6b96
6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
kvn
parents:
196
diff
changeset
|
55 return bn._slot == _slot && bn._is_eliminated == _is_eliminated; |
0 | 56 } |
57 | |
58 OptoReg::Name BoxLockNode::stack_slot(Node* box_node) { | |
59 // Chase down the BoxNode | |
60 while (!box_node->is_BoxLock()) { | |
61 // if (box_node->is_SpillCopy()) { | |
62 // Node *m = box_node->in(1); | |
63 // if (m->is_Mach() && m->as_Mach()->ideal_Opcode() == Op_StoreP) { | |
64 // box_node = m->in(m->as_Mach()->operand_index(2)); | |
65 // continue; | |
66 // } | |
67 // } | |
68 assert(box_node->is_SpillCopy() || box_node->is_Phi(), "Bad spill of Lock."); | |
69 box_node = box_node->in(1); | |
70 } | |
71 return box_node->in_RegMask(0).find_first_elem(); | |
72 } | |
73 | |
74 //============================================================================= | |
75 //-----------------------------hash-------------------------------------------- | |
76 uint FastLockNode::hash() const { return NO_HASH; } | |
77 | |
78 //------------------------------cmp-------------------------------------------- | |
79 uint FastLockNode::cmp( const Node &n ) const { | |
80 return (&n == this); // Always fail except on self | |
81 } | |
82 | |
83 //============================================================================= | |
84 //-----------------------------hash-------------------------------------------- | |
85 uint FastUnlockNode::hash() const { return NO_HASH; } | |
86 | |
87 //------------------------------cmp-------------------------------------------- | |
88 uint FastUnlockNode::cmp( const Node &n ) const { | |
89 return (&n == this); // Always fail except on self | |
90 } | |
91 | |
92 // | |
93 // Create a counter which counts the number of times this lock is acquired | |
94 // | |
95 void FastLockNode::create_lock_counter(JVMState* state) { | |
96 BiasedLockingNamedCounter* blnc = (BiasedLockingNamedCounter*) | |
97 OptoRuntime::new_named_counter(state, NamedCounter::BiasedLockingCounter); | |
98 _counters = blnc->counters(); | |
99 } | |
100 | |
101 //============================================================================= | |
102 //------------------------------do_monitor_enter------------------------------- | |
103 void Parse::do_monitor_enter() { | |
104 kill_dead_locals(); | |
105 | |
106 // Null check; get casted pointer. | |
107 Node *obj = do_null_check(peek(), T_OBJECT); | |
108 // Check for locking null object | |
109 if (stopped()) return; | |
110 | |
111 // the monitor object is not part of debug info expression stack | |
112 pop(); | |
113 | |
114 // Insert a FastLockNode which takes as arguments the current thread pointer, | |
115 // the obj pointer & the address of the stack slot pair used for the lock. | |
116 shared_lock(obj); | |
117 } | |
118 | |
119 //------------------------------do_monitor_exit-------------------------------- | |
120 void Parse::do_monitor_exit() { | |
121 kill_dead_locals(); | |
122 | |
123 pop(); // Pop oop to unlock | |
605 | 124 // Because monitors are guaranteed paired (else we bail out), we know |
0 | 125 // the matching Lock for this Unlock. Hence we know there is no need |
126 // for a null check on Unlock. | |
127 shared_unlock(map()->peek_monitor_box(), map()->peek_monitor_obj()); | |
128 } |