/* * 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. *
*/
// Universe is a name space holding known system classes and objects in the VM. // // Loaded classes are accessible through the SystemDictionary. // // The object heap is allocated and accessed through Universe, and various allocation // support is provided. Allocation by the interpreter and compiled code is done inline // and bails out to Scavenge::invoke_and_allocate.
class CollectedHeap; class DeferredObjAllocEvent; class OopStorage; class ReservedHeapSpace;
// A helper class for caching a Method* when the user of the cache // only cares about the latest version of the Method*. This cache safely // interacts with the RedefineClasses API.
class LatestMethodCache : public CHeapObj<mtClass> { // We save the Klass* and the idnum of Method* in order to get // the current cached Method*. private:
Klass* _klass; int _method_idnum;
// CDS support. Replace the klass in this with the archive version // could use this for Enhanced Class Redefinition also. void serialize(SerializeClosure* f) {
f->do_ptr((void**)&_klass);
} void metaspace_pointers_do(MetaspaceClosure* it);
};
class Universe: AllStatic { // Ugh. Universe is much too friendly. friendclass MarkSweep; friendclass oopDesc; friendclass ClassLoader; friendclass SystemDictionary; friendclass ReservedHeapSpace; friendclass VMStructs; friendclass VM_PopulateDumpSharedSpace; friendclass Metaspace; friendclass MetaspaceShared; friendclass vmClasses;
private: // Known classes in the VM static Klass* _typeArrayKlassObjs[T_LONG+1]; static Klass* _objectArrayKlassObj; // Special int-Array that represents filler objects that are used by GC to overwrite // dead objects. References to them are generally an error. static Klass* _fillerArrayKlassObj;
// Known objects in the VM static OopHandle _main_thread_group; // Reference to the main thread group object static OopHandle _system_thread_group; // Reference to the system thread group object
static OopHandle _the_empty_class_array; // Canonicalized obj array of type java.lang.Class static OopHandle _the_null_string; // A cache of "null" as a Java string static OopHandle _the_min_jint_string; // A cache of "-2147483648" as a Java string
static OopHandle _the_null_sentinel; // A unique object pointer unused except as a sentinel for null.
// preallocated error objects (no backtrace) static OopHandle _out_of_memory_errors;
// preallocated cause message for delayed StackOverflowError static OopHandle _delayed_stack_overflow_error_message;
static LatestMethodCache* _finalizer_register_cache; // static method for registering finalizable objects static LatestMethodCache* _loader_addClass_cache; // method for registering loaded classes in class loader vector static LatestMethodCache* _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError() method static LatestMethodCache* _throw_no_such_method_error_cache; // Unsafe.throwNoSuchMethodError() method static LatestMethodCache* _do_stack_walk_cache; // method for stack walker callback
static Array<int>* _the_empty_int_array; // Canonicalized int array static Array<u2>* _the_empty_short_array; // Canonicalized short array static Array<Klass*>* _the_empty_klass_array; // Canonicalized klass array static Array<InstanceKlass*>* _the_empty_instance_klass_array; // Canonicalized instance klass array static Array<Method*>* _the_empty_method_array; // Canonicalized method array
// References waiting to be transferred to the ReferenceHandler static OopHandle _reference_pending_list;
// The particular choice of collected heap. static CollectedHeap* _collectedHeap;
static intptr_t _non_oop_bits;
// array of dummy objects used with +FullGCAlot
debug_only(static OopHandle _fullgc_alot_dummy_array;)
debug_only(staticint _fullgc_alot_dummy_next;)
// Compiler/dispatch support staticint _base_vtable_size; // Java vtbl size of klass Object (in words)
// Initialization staticbool _bootstrapping; // true during genesis staticbool _module_initialized; // true after call_initPhase2 called staticbool _fully_initialized; // true after universe_init and initialize_vtables called
// the array of preallocated errors with backtraces static objArrayOop preallocated_out_of_memory_errors();
static objArrayOop out_of_memory_errors(); // generate an out of memory error; if possible using an error with preallocated backtrace; // otherwise return the given default error. static oop gen_out_of_memory_error(oop default_err);
// Table of primitive type mirrors, excluding T_OBJECT and T_ARRAY // but including T_VOID, hence the index including T_VOID static OopHandle _basic_type_mirrors[T_VOID+1];
#if INCLUDE_CDS_JAVA_HEAP // Each slot i stores an index that can be used to restore _basic_type_mirrors[i] // from the archive heap using HeapShared::get_root(int) staticint _archived_basic_type_mirror_indices[T_VOID+1]; #endif
// Reference pending list manipulation. Access is protected by // Heap_lock. The getter, setter and predicate require the caller // owns the lock. Swap is used by parallel non-concurrent reference // processing threads, where some higher level controller owns // Heap_lock, so requires the lock is locked, but not necessarily by // the current thread. static oop reference_pending_list(); staticvoid clear_reference_pending_list(); staticbool has_reference_pending_list(); static oop swap_reference_pending_list(oop list);
// OutOfMemoryError support. Returns an error with the required message. The returned error // may or may not have a backtrace. If error has a backtrace then the stack trace is already // filled in. static oop out_of_memory_error_java_heap(); static oop out_of_memory_error_c_heap(); static oop out_of_memory_error_metaspace(); static oop out_of_memory_error_class_metaspace(); static oop out_of_memory_error_array_size(); static oop out_of_memory_error_gc_overhead_limit(); static oop out_of_memory_error_realloc_objects();
// Throw default _out_of_memory_error_retry object as it will never propagate out of the VM static oop out_of_memory_error_retry(); static oop delayed_stack_overflow_error_message();
// If it's a certain type of OOME object staticbool is_out_of_memory_error_metaspace(oop ex_obj); staticbool is_out_of_memory_error_class_metaspace(oop ex_obj);
// The particular choice of collected heap. static CollectedHeap* heap() { return _collectedHeap; }
// CDS support staticvoid serialize(SerializeClosure* f);
// Apply the closure to all klasses for basic types (classes not present in // SystemDictionary). staticvoid basic_type_classes_do(KlassClosure* closure); staticvoid metaspace_pointers_do(MetaspaceClosure* it);
// Change the number of dummy objects kept reachable by the full gc dummy // array; this should trigger relocation in a sliding compaction collector.
debug_only(staticbool release_fullgc_alot_dummy();) // The non-oop pattern (see compiledIC.hpp, etc) staticvoid* non_oop_word(); staticbool contains_non_oop_word(void* p);
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.