/* * Copyright (c) 2011, 2021, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// An InstanceMirrorKlass is a specialized InstanceKlass for // java.lang.Class instances. These instances are special because // they contain the static fields of the class in addition to the // normal fields of Class. This means they are variable sized // instances and need special logic for computing their size and for // iteration of their oops.
class InstanceMirrorKlass: public InstanceKlass { friendclass VMStructs; friendclass InstanceKlass;
// Returns the size of the instance including the extra static fields. virtual size_t oop_size(oop obj) const;
// Static field offset is an offset into the Heap, should be converted by // based on UseCompressedOop for traversal static HeapWord* start_of_static_fields(oop obj) { return (HeapWord*)(cast_from_oop<intptr_t>(obj) + offset_of_static_fields());
}
staticvoid init_offset_of_static_fields() { // Cache the offset of the static fields in the Class instance
assert(_offset_of_static_fields == 0, "once");
_offset_of_static_fields = InstanceMirrorKlass::cast(vmClasses::Class_klass())->size_helper() << LogHeapWordSize;
}
// Oop fields (and metadata) iterators // // The InstanceMirrorKlass iterators also visit the hidden Klass pointer.
// Iterate over the static fields. template <typename T, class OopClosureType> inlinevoid oop_oop_iterate_statics(oop obj, OopClosureType* closure);
// Forward iteration // Iterate over the oop fields and metadata. template <typename T, class OopClosureType> inlinevoid oop_oop_iterate(oop obj, OopClosureType* closure);
// Reverse iteration // Iterate over the oop fields and metadata. template <typename T, class OopClosureType> inlinevoid oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
// Bounded range iteration // Iterate over the oop fields and metadata. template <typename T, class OopClosureType> inlinevoid oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
private:
// Iterate over the static fields. template <typename T, class OopClosureType> inlinevoid oop_oop_iterate_statics_bounded(oop obj, OopClosureType* closure, MemRegion mr);
};
#endif// SHARE_OOPS_INSTANCEMIRRORKLASS_HPP
¤ Dauer der Verarbeitung: 0.37 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.