ciInstanceKlass.hpp revision 44
/*
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// ciInstanceKlass
//
// This class represents a klassOop in the HotSpot virtual machine
// whose Klass part is an instanceKlass. It may or may not
// be loaded.
class ciInstanceKlass : public ciKlass {
friend class ciEnv;
friend class ciMethod;
friend class ciField;
friend class ciBytecodeStream;
private:
bool _is_shared;
bool _is_initialized;
bool _is_linked;
bool _has_finalizer;
bool _has_subklass;
// Lazy fields get filled in only upon request.
protected:
instanceKlass* get_instanceKlass() const {
return (instanceKlass*)get_Klass();
}
const char* type_string() { return "ciInstanceKlass"; }
bool is_shared() { return _is_shared; }
bool compute_shared_is_initialized();
bool compute_shared_is_linked();
bool compute_shared_has_subklass();
int compute_nonstatic_fields();
public:
// Has this klass been initialized?
bool is_initialized() {
if (_is_shared && !_is_initialized) {
return is_loaded() && compute_shared_is_initialized();
}
return _is_initialized;
}
// Has this klass been linked?
bool is_linked() {
if (_is_shared && !_is_linked) {
return is_loaded() && compute_shared_is_linked();
}
return _is_linked;
}
// General klass information.
return _flags;
}
bool has_finalizer() {
return _has_finalizer; }
bool has_subklass() {
if (_is_shared && !_has_subklass) {
return false;
} else {
return compute_shared_has_subklass();
}
}
return _has_subklass;
}
jint size_helper() {
>> LogHeapWordSize);
}
return _nonstatic_field_size; }
return _nonstatic_oop_map_size; }
ciInstanceKlass* super();
jint nof_implementors() {
if (_is_shared) return compute_shared_nof_implementors();
return _nof_implementors;
}
// total number of nonstatic fields (including inherited):
int nof_nonstatic_fields() {
if (_nonstatic_fields == NULL)
return compute_nonstatic_fields();
else
return _nonstatic_fields->length();
}
// nth nonstatic field (presented by ascending address)
ciField* nonstatic_field_at(int i) {
return _nonstatic_fields->at(i);
}
bool has_finalizable_subclass();
bool contains_field_offset(int offset) {
}
// Get the instance of java.lang.Class corresponding to
// this klass. This instance is used for locking of
// synchronized static methods of this klass.
// Java access flags
// Note: To find a method from name and type strings, use ciSymbol::make,
// but consider adding to vmSymbols.hpp instead.
bool is_leaf_type();
ciInstanceKlass* implementor(int n);
// Is the defining class loader of this class the default loader?
bool uses_default_loader();
bool is_java_lang_Object();
// What kind of ciObject is this?
bool is_instance_klass() { return true; }
bool is_java_klass() { return true; }
};