/* * Copyright (c) 1997, 2022, 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. *
*/
// 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++. // oopDesc is abstract. // (see oopHierarchy for complete oop class hierarchy) // // no virtual functions allowed
// Forward declarations. class OopClosure; class FilteringClosure;
class PSPromotionManager; class ParCompactionManager;
class oopDesc { friendclass VMStructs; friendclass JVMCIVMStructs; private: volatile markWord _mark; union _metadata {
Klass* _klass;
narrowKlass _compressed_klass;
} _metadata;
// There may be ordering constraints on the initialization of fields that // make use of the C++ copy/assign incorrect.
NONCOPYABLE(oopDesc);
public: // Must be trivial; see verifying static assert after the class.
oopDesc() = default;
// For klass field compression staticinlinevoid set_klass_gap(HeapWord* mem, int z);
// size of object header, aligned to platform wordSize static constexpr int header_size() { returnsizeof(oopDesc)/HeapWordSize; }
// Returns whether this is an instance of k or an instance of a subclass of k inlinebool is_a(Klass* k) const;
// Returns the actual oop size of the object in machine words inline size_t size();
// Sometimes (for complicated concurrency-related reasons), it is useful // to be able to figure out the size of an object knowing its klass. inline size_t size_given_klass(Klass* klass);
// type test operations (inlined in oop.inline.hpp) inlinebool is_instance() const; inlinebool is_instanceRef() const; inlinebool is_stackChunk() const; inlinebool is_array() const; inlinebool is_objArray() const; inlinebool is_typeArray() const;
// type test operations that don't require inclusion of oop.inline.hpp. bool is_instance_noinline() const; bool is_instanceRef_noinline() const; bool is_stackChunk_noinline() const; bool is_array_noinline() const; bool is_objArray_noinline() const; bool is_typeArray_noinline() const;
// Standard compare function returns negative value if o1 < o2 // 0 if o1 == o2 // positive value if o1 > o2 inlinestaticint compare(oop o1, oop o2) { void* o1_addr = (void*)o1; void* o2_addr = (void*)o2; if (o1_addr < o2_addr) { return -1;
} elseif (o1_addr > o2_addr) { return 1;
} else { return 0;
}
}
// Access to fields in a instanceOop through these methods. template<DecoratorSet decorators>
oop obj_field_access(int offset) const;
oop obj_field(int offset) const;
// 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". inline oop forward_to_atomic(oop p, markWord compare, atomic_memory_order order = memory_order_conservative);
inline oop forwardee() const;
// Age of object during scavenge inline uint age() const; inlinevoid incr_age();
// identity hash; returns the identity hash key (computes it if necessary) inline intptr_t identity_hash();
intptr_t slow_identity_hash(); inlinebool fast_no_hash_check();
// marks are forwarded to stack when object is locked inlinebool has_displaced_mark() const; inline markWord displaced_mark() const; inlinevoid set_displaced_mark(markWord m);
// Checks if the mark word needs to be preserved inlinebool mark_must_be_preserved() const; inlinebool mark_must_be_preserved(markWord m) const;
// for error reporting staticvoid* load_klass_raw(oop obj); staticvoid* load_oop_raw(oop obj, int offset);
DEBUG_ONLY(bool size_might_change();)
};
// An oopDesc is not initialized via a constructor. Space is allocated in // the Java heap, and static functions provided here on HeapWord* are used // to fill in certain parts of that memory. The allocated memory is then // treated as referring to an oopDesc. For that to be valid, the oopDesc // class must have a trivial default constructor (C++14 3.8/1).
static_assert(std::is_trivially_default_constructible<oopDesc>::value, "required");
#endif// SHARE_OOPS_OOP_HPP
¤ Dauer der Verarbeitung: 0.14 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.