/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "opto/locknode.hpp"
#include "opto/rootnode.hpp"
#include "opto/runtime.hpp"
//=============================================================================
return _inmask;
}
}
}
//-----------------------------hash--------------------------------------------
if (EliminateNestedLocks)
return NO_HASH; // Each locked region has own BoxLock node
}
//------------------------------cmp--------------------------------------------
if (EliminateNestedLocks)
return (&n == this); // Always fail except on self
}
// Chase down the BoxNode after RA which may spill box nodes.
while (!box->is_BoxLock()) {
// if (box_node->is_SpillCopy()) {
// Node *m = box_node->in(1);
// if (m->is_Mach() && m->as_Mach()->ideal_Opcode() == Op_StoreP) {
// box_node = m->in(m->as_Mach()->operand_index(2));
// continue;
// }
// }
// Only BoxLock nodes with the same stack slot are merged.
// So it is enough to trace one path to find the slot value.
}
return box->as_BoxLock();
}
}
// Is BoxLock node used for one simple lock region (same box and obj)?
bool has_one_lock = false;
if (n->is_AbstractLock()) {
// Check lock's box since box could be referenced by Lock's debug info.
has_one_lock = true;
has_one_lock = false;
}
}
} else {
return false; // Different objects
}
}
}
}
#ifdef ASSERT
// Verify that FastLock and Safepoint reference only this lock region.
if (n->is_FastLock()) {
}
// Don't check monitor info in safepoints since the referenced object could
// be different from the locked object. It could be Phi node of different
// cast nodes which point to this locked object.
// We assume that no other objects could be referenced in monitor info
// associated with this BoxLock node because all associated locks and
// unlocks are reference only this one object.
}
#endif
*unique_lock = lock;
}
return true;
}
//=============================================================================
//-----------------------------hash--------------------------------------------
//------------------------------cmp--------------------------------------------
return (&n == this); // Always fail except on self
}
//=============================================================================
//-----------------------------hash--------------------------------------------
//------------------------------cmp--------------------------------------------
return (&n == this); // Always fail except on self
}
//
// Create a counter which counts the number of times this lock is acquired
//
}
//=============================================================================
//------------------------------do_monitor_enter-------------------------------
// Null check; get casted pointer.
// Check for locking null object
if (stopped()) return;
// the monitor object is not part of debug info expression stack
pop();
// Insert a FastLockNode which takes as arguments the current thread pointer,
// the obj pointer & the address of the stack slot pair used for the lock.
}
//------------------------------do_monitor_exit--------------------------------
pop(); // Pop oop to unlock
// Because monitors are guaranteed paired (else we bail out), we know
// the matching Lock for this Unlock. Hence we know there is no need
// for a null check on Unlock.
}