/*
* 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 "ci/ciObject.hpp"
#include "ci/ciUtilities.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
#include "oops/oop.inline2.hpp"
// ciObject
//
// This class represents an oop in the HotSpot virtual machine.
// Its subclasses are structured in a hierarchy which mirrors
// an aggregate of the VM's oop and klass hierarchies (see
// oopHierarchy.hpp). Each instance of ciObject holds a handle
// to a corresponding oop on the VM side and provides routines
// for accessing the information in its oop. By using the ciObject
// hierarchy for accessing oops in the VM, the compiler ensures
// that it is safe with respect to garbage collection; that is,
// GC and compilation can proceed independently without
// interference.
//
// Within the VM, the oop and klass hierarchies are separate.
// The compiler interface does not preserve this separation --
// the distinction between `klassOop' and `Klass' are not
// reflected in the interface and instead the Klass hierarchy
// is directly modeled as the subclasses of ciKlass.
// ------------------------------------------------------------------
// ciObject::ciObject
if (ciObjectFactory::is_initialized()) {
} else {
}
_ident = 0;
init_flags_from(o);
}
// ------------------------------------------------------------------
// ciObject::ciObject
//
if (ciObjectFactory::is_initialized()) {
} else {
}
_ident = 0;
init_flags_from(h());
}
// ------------------------------------------------------------------
// ciObject::ciObject
//
_ident = 0;
}
// ------------------------------------------------------------------
// ciObject::ciObject
//
// NULL variant. Used only by ciNullObject.
_ident = 0;
}
// ------------------------------------------------------------------
// ciObject::klass
//
// Get the ciKlass of this ciObject.
// When both _klass and _handle are NULL, we are dealing
// with the distinguished instance of ciNullObject.
// No one should ask it for its klass.
return NULL;
}
);
}
return _klass;
}
// ------------------------------------------------------------------
// ciObject::set_ident
//
// Set the unique identity number of a ciObject.
}
// ------------------------------------------------------------------
// ciObject::ident
//
// Report the unique identity number of a ciObject.
return id;
}
// ------------------------------------------------------------------
// ciObject::equals
//
// Are two ciObjects equal?
return (this == obj);
}
// ------------------------------------------------------------------
// ciObject::hash
//
// A hash value for the convenience of compilers.
//
// Implementation note: we use the address of the ciObject as the
// basis for the hash. Use the _ident field, which is well-behaved.
return ident() * 31;
}
// ------------------------------------------------------------------
// ciObject::constant_encoding
//
// The address which the compiler should embed into the
// generated code to represent this oop. This address
// is not the true address of the oop -- it will get patched
// during nmethod creation.
//
//
//
// Implementation note: we use the handle as the encoding. The
// nmethod constructor resolves the handle and patches in the oop.
//
// This method should be changed to return an generified address
// to discourage use of the JNI handle.
return handle();
}
// ------------------------------------------------------------------
// ciObject::can_be_constant
bool ciObject::can_be_constant() {
}
// ------------------------------------------------------------------
// ciObject::should_be_constant()
bool ciObject::should_be_constant() {
if (is_null_object()) return true;
if (!JavaObjectsInPerm) {
// We want Strings and Classes to be embeddable by default since
// they used to be in the perm world. Not all Strings used to be
// embeddable but there's no easy way to distinguish the interned
// from the regulars ones so just treat them all that way.
return true;
}
}
if (EnableInvokeDynamic &&
// We want to treat these aggressively.
return true;
}
}
// ------------------------------------------------------------------
// ciObject::print
//
// Print debugging output about this ciObject.
//
// Implementation note: dispatch to the virtual print_impl behavior
// for this ciObject.
(address)this);
}
// ------------------------------------------------------------------
// ciObject::print_oop
//
// Print debugging output about the oop this ciObject represents.
if (is_null_object()) {
} else if (!is_loaded()) {
} else {
}
}