src/share/vm/opto/locknode.cpp

Fri, 22 Feb 2008 17:55:13 -0800

author
kvn
date
Fri, 22 Feb 2008 17:55:13 -0800
changeset 463
67914967a4b5
parent 435
a61af66fc99e
child 501
6dbf1a175d6b
permissions
-rw-r--r--

6650373: Assert in methodOopDesc::make_adapters()
Summary: AdapterHandlerLibrary::get_create_adapter_index() returns incorrect value (-2) when CodeCache is full.
Reviewed-by: sgoldman

     1 /*
     2  * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
     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  */
    25 #include "incls/_precompiled.incl"
    26 #include "incls/_locknode.cpp.incl"
    28 //=============================================================================
    29 const RegMask &BoxLockNode::in_RegMask(uint i) const {
    30   return _inmask;
    31 }
    33 const RegMask &BoxLockNode::out_RegMask() const {
    34   return *Matcher::idealreg2regmask[Op_RegP];
    35 }
    37 uint BoxLockNode::size_of() const { return sizeof(*this); }
    39 BoxLockNode::BoxLockNode( int slot ) : Node( Compile::current()->root() ), _slot(slot) {
    40   init_class_id(Class_BoxLock);
    41   init_flags(Flag_rematerialize);
    42   OptoReg::Name reg = OptoReg::stack2reg(_slot);
    43   _inmask.Insert(reg);
    44 }
    46 //------------------------------cmp--------------------------------------------
    47 uint BoxLockNode::cmp( const Node &n ) const {
    48   const BoxLockNode &bn = (const BoxLockNode &)n;
    49   return bn._slot == _slot;
    50 }
    52 OptoReg::Name BoxLockNode::stack_slot(Node* box_node) {
    53   // Chase down the BoxNode
    54   while (!box_node->is_BoxLock()) {
    55     //    if (box_node->is_SpillCopy()) {
    56     //      Node *m = box_node->in(1);
    57     //      if (m->is_Mach() && m->as_Mach()->ideal_Opcode() == Op_StoreP) {
    58     //        box_node = m->in(m->as_Mach()->operand_index(2));
    59     //        continue;
    60     //      }
    61     //    }
    62     assert(box_node->is_SpillCopy() || box_node->is_Phi(), "Bad spill of Lock.");
    63     box_node = box_node->in(1);
    64   }
    65   return box_node->in_RegMask(0).find_first_elem();
    66 }
    68 //=============================================================================
    69 //-----------------------------hash--------------------------------------------
    70 uint FastLockNode::hash() const { return NO_HASH; }
    72 //------------------------------cmp--------------------------------------------
    73 uint FastLockNode::cmp( const Node &n ) const {
    74   return (&n == this);                // Always fail except on self
    75 }
    77 //=============================================================================
    78 //-----------------------------hash--------------------------------------------
    79 uint FastUnlockNode::hash() const { return NO_HASH; }
    81 //------------------------------cmp--------------------------------------------
    82 uint FastUnlockNode::cmp( const Node &n ) const {
    83   return (&n == this);                // Always fail except on self
    84 }
    86 //
    87 // Create a counter which counts the number of times this lock is acquired
    88 //
    89 void FastLockNode::create_lock_counter(JVMState* state) {
    90   BiasedLockingNamedCounter* blnc = (BiasedLockingNamedCounter*)
    91            OptoRuntime::new_named_counter(state, NamedCounter::BiasedLockingCounter);
    92   _counters = blnc->counters();
    93 }
    95 //=============================================================================
    96 //------------------------------do_monitor_enter-------------------------------
    97 void Parse::do_monitor_enter() {
    98   kill_dead_locals();
   100   // Null check; get casted pointer.
   101   Node *obj = do_null_check(peek(), T_OBJECT);
   102   // Check for locking null object
   103   if (stopped()) return;
   105   // the monitor object is not part of debug info expression stack
   106   pop();
   108   // Insert a FastLockNode which takes as arguments the current thread pointer,
   109   // the obj pointer & the address of the stack slot pair used for the lock.
   110   shared_lock(obj);
   111 }
   113 //------------------------------do_monitor_exit--------------------------------
   114 void Parse::do_monitor_exit() {
   115   kill_dead_locals();
   117   pop();                        // Pop oop to unlock
   118   // Because monitors are guarenteed paired (else we bail out), we know
   119   // the matching Lock for this Unlock.  Hence we know there is no need
   120   // for a null check on Unlock.
   121   shared_unlock(map()->peek_monitor_box(), map()->peek_monitor_obj());
   122 }

mercurial