Fri, 12 Feb 2010 15:27:36 -0800
Merge
duke@435 | 1 | /* |
xdono@631 | 2 | * Copyright 1999-2008 Sun Microsystems, Inc. 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 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | //------------------------------BoxLockNode------------------------------------ |
duke@435 | 26 | class BoxLockNode : public Node { |
duke@435 | 27 | public: |
duke@435 | 28 | const int _slot; |
duke@435 | 29 | RegMask _inmask; |
kvn@501 | 30 | bool _is_eliminated; // indicates this lock was safely eliminated |
duke@435 | 31 | |
duke@435 | 32 | BoxLockNode( int lock ); |
duke@435 | 33 | virtual int Opcode() const; |
duke@435 | 34 | virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; |
duke@435 | 35 | virtual uint size(PhaseRegAlloc *ra_) const; |
duke@435 | 36 | virtual const RegMask &in_RegMask(uint) const; |
duke@435 | 37 | virtual const RegMask &out_RegMask() const; |
duke@435 | 38 | virtual uint size_of() const; |
kvn@895 | 39 | virtual uint hash() const; |
duke@435 | 40 | virtual uint cmp( const Node &n ) const; |
duke@435 | 41 | virtual const class Type *bottom_type() const { return TypeRawPtr::BOTTOM; } |
duke@435 | 42 | virtual uint ideal_reg() const { return Op_RegP; } |
duke@435 | 43 | |
duke@435 | 44 | static OptoReg::Name stack_slot(Node* box_node); |
duke@435 | 45 | |
kvn@501 | 46 | bool is_eliminated() { return _is_eliminated; } |
kvn@501 | 47 | // mark lock as eliminated. |
kvn@501 | 48 | void set_eliminated() { _is_eliminated = true; } |
kvn@501 | 49 | |
duke@435 | 50 | #ifndef PRODUCT |
duke@435 | 51 | virtual void format( PhaseRegAlloc *, outputStream *st ) const; |
duke@435 | 52 | virtual void dump_spec(outputStream *st) const { st->print(" Lock %d",_slot); } |
duke@435 | 53 | #endif |
duke@435 | 54 | }; |
duke@435 | 55 | |
duke@435 | 56 | //------------------------------FastLockNode----------------------------------- |
duke@435 | 57 | class FastLockNode: public CmpNode { |
duke@435 | 58 | private: |
duke@435 | 59 | BiasedLockingCounters* _counters; |
duke@435 | 60 | |
duke@435 | 61 | public: |
duke@435 | 62 | FastLockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) { |
duke@435 | 63 | init_req(0,ctrl); |
duke@435 | 64 | init_class_id(Class_FastLock); |
duke@435 | 65 | _counters = NULL; |
duke@435 | 66 | } |
duke@435 | 67 | Node* obj_node() const { return in(1); } |
duke@435 | 68 | Node* box_node() const { return in(2); } |
duke@435 | 69 | |
duke@435 | 70 | // FastLock and FastUnlockNode do not hash, we need one for each correspoding |
duke@435 | 71 | // LockNode/UnLockNode to avoid creating Phi's. |
duke@435 | 72 | virtual uint hash() const ; // { return NO_HASH; } |
duke@435 | 73 | virtual uint cmp( const Node &n ) const ; // Always fail, except on self |
duke@435 | 74 | virtual int Opcode() const; |
duke@435 | 75 | virtual const Type *Value( PhaseTransform *phase ) const { return TypeInt::CC; } |
duke@435 | 76 | const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;} |
duke@435 | 77 | |
duke@435 | 78 | void create_lock_counter(JVMState* s); |
duke@435 | 79 | BiasedLockingCounters* counters() const { return _counters; } |
duke@435 | 80 | }; |
duke@435 | 81 | |
duke@435 | 82 | |
duke@435 | 83 | //------------------------------FastUnlockNode--------------------------------- |
duke@435 | 84 | class FastUnlockNode: public CmpNode { |
duke@435 | 85 | public: |
duke@435 | 86 | FastUnlockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) { |
duke@435 | 87 | init_req(0,ctrl); |
duke@435 | 88 | init_class_id(Class_FastUnlock); |
duke@435 | 89 | } |
duke@435 | 90 | Node* obj_node() const { return in(1); } |
duke@435 | 91 | Node* box_node() const { return in(2); } |
duke@435 | 92 | |
duke@435 | 93 | |
duke@435 | 94 | // FastLock and FastUnlockNode do not hash, we need one for each correspoding |
duke@435 | 95 | // LockNode/UnLockNode to avoid creating Phi's. |
duke@435 | 96 | virtual uint hash() const ; // { return NO_HASH; } |
duke@435 | 97 | virtual uint cmp( const Node &n ) const ; // Always fail, except on self |
duke@435 | 98 | virtual int Opcode() const; |
duke@435 | 99 | virtual const Type *Value( PhaseTransform *phase ) const { return TypeInt::CC; } |
duke@435 | 100 | const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;} |
duke@435 | 101 | |
duke@435 | 102 | }; |