1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)locknode.cpp 1.49 07/05/17 15:59:05 JVM"
3 #endif
4 /*
5 * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
26 */
27
28 #include "incls/_precompiled.incl"
29 #include "incls/_locknode.cpp.incl"
30
31 //=============================================================================
32 const RegMask &BoxLockNode::in_RegMask(uint i) const {
33 return _inmask;
34 }
35
36 const RegMask &BoxLockNode::out_RegMask() const {
37 return *Matcher::idealreg2regmask[Op_RegP];
38 }
39
40 uint BoxLockNode::size_of() const { return sizeof(*this); }
41
42 BoxLockNode::BoxLockNode( int slot ) : Node( Compile::current()->root() ), _slot(slot) {
43 init_class_id(Class_BoxLock);
44 init_flags(Flag_rematerialize);
45 OptoReg::Name reg = OptoReg::stack2reg(_slot);
46 _inmask.Insert(reg);
47 }
48
49 //------------------------------cmp--------------------------------------------
50 uint BoxLockNode::cmp( const Node &n ) const {
51 const BoxLockNode &bn = (const BoxLockNode &)n;
52 return bn._slot == _slot;
53 }
54
55 OptoReg::Name BoxLockNode::stack_slot(Node* box_node) {
56 // Chase down the BoxNode
57 while (!box_node->is_BoxLock()) {
58 // if (box_node->is_SpillCopy()) {
59 // Node *m = box_node->in(1);
60 // if (m->is_Mach() && m->as_Mach()->ideal_Opcode() == Op_StoreP) {
61 // box_node = m->in(m->as_Mach()->operand_index(2));
62 // continue;
63 // }
64 // }
65 assert(box_node->is_SpillCopy() || box_node->is_Phi(), "Bad spill of Lock.");
66 box_node = box_node->in(1);
67 }
68 return box_node->in_RegMask(0).find_first_elem();
69 }
70
71 //=============================================================================
72 //-----------------------------hash--------------------------------------------
|
1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)locknode.cpp 1.49 07/05/17 15:59:05 JVM"
3 #endif
4 /*
5 * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
26 */
27
28 #include "incls/_precompiled.incl"
29 #include "incls/_locknode.cpp.incl"
30
31 //=============================================================================
32 const RegMask &BoxLockNode::in_RegMask(uint i) const {
33 return _inmask;
34 }
35
36 const RegMask &BoxLockNode::out_RegMask() const {
37 return *Matcher::idealreg2regmask[Op_RegP];
38 }
39
40 uint BoxLockNode::size_of() const { return sizeof(*this); }
41
42 BoxLockNode::BoxLockNode( int slot ) : Node( Compile::current()->root() ),
43 _slot(slot), _is_eliminated(false) {
44 init_class_id(Class_BoxLock);
45 init_flags(Flag_rematerialize);
46 OptoReg::Name reg = OptoReg::stack2reg(_slot);
47 _inmask.Insert(reg);
48 }
49
50 //-----------------------------hash--------------------------------------------
51 uint BoxLockNode::hash() const {
52 return Node::hash() + _slot + (_is_eliminated ? Compile::current()->fixed_slots() : 0);
53 }
54
55 //------------------------------cmp--------------------------------------------
56 uint BoxLockNode::cmp( const Node &n ) const {
57 const BoxLockNode &bn = (const BoxLockNode &)n;
58 return bn._slot == _slot && bn._is_eliminated == _is_eliminated;
59 }
60
61 OptoReg::Name BoxLockNode::stack_slot(Node* box_node) {
62 // Chase down the BoxNode
63 while (!box_node->is_BoxLock()) {
64 // if (box_node->is_SpillCopy()) {
65 // Node *m = box_node->in(1);
66 // if (m->is_Mach() && m->as_Mach()->ideal_Opcode() == Op_StoreP) {
67 // box_node = m->in(m->as_Mach()->operand_index(2));
68 // continue;
69 // }
70 // }
71 assert(box_node->is_SpillCopy() || box_node->is_Phi(), "Bad spill of Lock.");
72 box_node = box_node->in(1);
73 }
74 return box_node->in_RegMask(0).find_first_elem();
75 }
76
77 //=============================================================================
78 //-----------------------------hash--------------------------------------------
|