ciObject.cpp revision 2739
1879N/A * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// This class represents an oop in the HotSpot virtual machine. 0N/A// Its subclasses are structured in a hierarchy which mirrors 0N/A// an aggregate of the VM's oop and klass hierarchies (see 0N/A// to a corresponding oop on the VM side and provides routines 0N/A// for accessing the information in its oop. By using the ciObject 0N/A// hierarchy for accessing oops in the VM, the compiler ensures 0N/A// that it is safe with respect to garbage collection; that is, 0N/A// GC and compilation can proceed independently without 0N/A// Within the VM, the oop and klass hierarchies are separate. 0N/A// The compiler interface does not preserve this separation -- 0N/A// the distinction between `klassOop' and `Klass' are not 0N/A// reflected in the interface and instead the Klass hierarchy 0N/A// is directly modeled as the subclasses of ciKlass. 0N/A// ------------------------------------------------------------------ 0N/A// ciObject::ciObject 0N/A// ------------------------------------------------------------------ 0N/A// ciObject::ciObject 0N/A// ------------------------------------------------------------------ 0N/A// ciObject::ciObject 0N/A// ------------------------------------------------------------------ 0N/A// ciObject::ciObject 0N/A// NULL variant. Used only by ciNullObject. 0N/A// ------------------------------------------------------------------ 0N/A// Get the ciKlass of this ciObject. 0N/A // When both _klass and _handle are NULL, we are dealing 0N/A // with the distinguished instance of ciNullObject. 0N/A // No one should ask it for its klass. 0N/A// ------------------------------------------------------------------ 0N/A// ciObject::set_ident 0N/A// Set the unique identity number of a ciObject. 0N/A// ------------------------------------------------------------------ 0N/A// Report the unique identity number of a ciObject. 0N/A// ------------------------------------------------------------------ 0N/A// Are two ciObjects equal? 0N/A// ------------------------------------------------------------------ 0N/A// A hash value for the convenience of compilers. 0N/A// Implementation note: we use the address of the ciObject as the 0N/A// basis for the hash. Use the _ident field, which is well-behaved. 0N/A return ident() *
31;
0N/A// ------------------------------------------------------------------ 989N/A// ciObject::constant_encoding 0N/A// The address which the compiler should embed into the 0N/A// generated code to represent this oop. This address 0N/A// is not the true address of the oop -- it will get patched 0N/A// during nmethod creation. 0N/A// Implementation note: we use the handle as the encoding. The 0N/A// nmethod constructor resolves the handle and patches in the oop. 0N/A// This method should be changed to return an generified address 0N/A// to discourage use of the JNI handle. 0N/A// ------------------------------------------------------------------ 989N/A// ciObject::can_be_constant 989N/A// ------------------------------------------------------------------ 989N/A// ciObject::should_be_constant() 2380N/A // We want Strings and Classes to be embeddable by default since 2380N/A // they used to be in the perm world. Not all Strings used to be 2380N/A // embeddable but there's no easy way to distinguish the interned 2380N/A // from the regulars ones so just treat them all that way. 2739N/A // We want to treat these aggressively. 0N/A// ------------------------------------------------------------------ 0N/A// Print debugging output about this ciObject. 0N/A// Implementation note: dispatch to the virtual print_impl behavior 0N/A// for this ciObject. 0N/A// ------------------------------------------------------------------ 0N/A// ciObject::print_oop 0N/A// Print debugging output about the oop this ciObject represents.