oop.hpp revision 518
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * This code is free software; you can redistribute it and/or modify it * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or // oopDesc is the top baseclass for objects classes. The {name}Desc classes describe // the format of Java objects so the fields can be accessed from C++. // (see oopHierarchy for complete oop class hierarchy) // no virtual functions allowed // store into oop with store check // store into oop without store check // Fast access to barrier set. Must be initialized. // Used only to re-initialize the mark word (e.g., of promoted // objects during a GC) -- requires a valid klass pointer // For klass field compression // For when the klass pointer is being used as a linked list "next" field. // size of object header, aligned to platform wordSize // Returns whether this is an instance of k or an instance of a subclass of k // Returns the actual oop size of the object // Sometimes (for complicated concurrency-related reasons), it is useful // to be able to figure out the size of an object knowing its klass. // Some perm gen objects are not parseble immediately after // installation of their klass pointer. // Some perm gen objects that have been allocated and initialized // can be changed by the VM when not at a safe point (class rededfinition // is an example). Such objects should not be examined by the // concurrent processing of a garbage collector if is_conc_safe() // field addresses in oop // Need this as public for garbage collection. // Decode an oop pointer from a narrowOop if compressed. // These are overloaded for oop and narrowOop as are the other functions // below so that they can be called in template functions. // Encode an oop pointer to a narrow oop. The or_null versions accept // null oop pointer, others do not in order to eliminate the // null checking branches. // Load an oop out of the Java heap // Load an oop out of Java heap and decode it to an uncompressed oop. // Store an oop into the heap. // Encode oop if UseCompressedOops and store into the heap. // Access to fields in a instanceOop through these methods. // printing functions for VM debugging // printing on default output stream // return the print strings // verification operations // tells whether this oop is partially constructed (gc during class loading) // Apply "MarkSweep::mark_and_push" to (the address of) every non-NULL // reference field in "this". // Forward pointer operations for scavenge // Like "forward_to", but inserts the forwarding pointer atomically. // Exactly one thread succeeds in inserting the forwarding pointer, and // this call returns "NULL" for that thread; any other thread has the // value of the forwarding pointer returned and does not modify "this". // Age of object during scavenge // Adjust all pointers in this object to point at it's forwarded location and // return the size of this oop. This is used by the MarkSweep collector. // Fast access to barrier set // iterators, returns size of object // identity hash; returns the identity hash key (computes it if necessary) // NOTE with the introduction of UseBiasedLocking that identity_hash() might reach a // safepoint if called on a biased object. Calling code must be aware of that. // marks are forwarded to stack when object is locked