/*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_MEMORY_UNIVERSE_HPP
#define SHARE_VM_MEMORY_UNIVERSE_HPP
#include "runtime/handles.hpp"
#include "utilities/growableArray.hpp"
// 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;
// Common parts of a methodOop cache. This cache safely interacts with
// the RedefineClasses API.
//
// We save the klassOop and the idnum of methodOop in order to get
// the current cached methodOop.
private:
int _method_idnum;
public:
// GC support
};
// A helper class for caching a methodOop when the user of the cache
// cares about all versions of the methodOop.
//
// This subclass adds weak references to older versions of the
// methodOop and a query method for a methodOop.
private:
// If the cached methodOop has not been redefined, then
// _prev_methods will be NULL. If all of the previous
// versions of the method have been collected, then
// _prev_methods can have a length of zero.
public:
};
// A helper class for caching a methodOop when the user of the cache
// only cares about the latest version of the methodOop.
//
// This subclass adds a getter method for the latest methodOop.
public:
};
// For UseCompressedOops.
struct NarrowOopStruct {
// Base address for oop-within-java-object materialization.
// NULL if using wide oops or zero based narrow oops.
// 0 if using wide oops or zero based unscaled narrow oops,
// LogMinObjAlignmentInBytes otherwise.
int _shift;
// Generate code with implicit null checks for narrow oops.
};
enum VerifyOption {
VerifyOption_Default = 0,
// G1
};
// Ugh. Universe is much too friendly.
friend class MarkSweep;
friend class oopDesc;
friend class ClassLoader;
friend class Arguments;
friend class SystemDictionary;
friend class VMStructs;
friend class CompactingPermGenGen;
friend class VM_PopulateDumpSharedSpace;
friend jint universe_init();
friend void universe2_init();
friend bool universe_post_init();
private:
// Known classes in the VM
// Known objects in the VM
// Primitive objects
static objArrayOop _the_array_interfaces_array; // Canonicalized 2-array of cloneable & serializable klasses
static LatestMethodOopCache* _finalizer_register_cache; // static method for registering finalizable objects
static LatestMethodOopCache* _loader_addClass_cache; // method for registering loaded classes in class loader vector
// array of preallocated error objects with backtrace
// number of preallocated error objects available for use
// The object used as an exception dummy when exceptions are thrown for
// the vm thread.
// The particular choice of collected heap.
// For UseCompressedOops.
// array of dummy objects used with +FullGCAlot
// index of next entry to clear
debug_only(static int _fullgc_alot_dummy_next;)
// Initialization
// the array of preallocated errors with backtraces
static objArrayOop preallocated_out_of_memory_errors() { return _preallocated_out_of_memory_error_array; }
// generate an out of memory error; if possible using an error with preallocated backtrace;
// otherwise return the given default error.
// Historic gc information
static jint initialize_heap();
static void initialize_basic_type_mirrors(TRAPS);
static void fixup_mirrors(TRAPS);
static void reinitialize_itables(TRAPS);
static void compute_base_vtable_size(); // compute vtable size of class Object
// Mirrors for primitive classes (created eagerly)
return m;
}
// Debugging
static bool _verify_in_progress;
static void compute_verify_oop_data();
public:
// Known classes in the VM
return _objectArrayKlassObj;
}
return _typeArrayKlassObjs[t];
}
// Known objects in the VM
// table of same
return check_mirror(_mirrors[t]);
}
// 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() { return gen_out_of_memory_error(_out_of_memory_error_java_heap); }
static oop out_of_memory_error_perm_gen() { return gen_out_of_memory_error(_out_of_memory_error_perm_gen); }
static oop out_of_memory_error_array_size() { return gen_out_of_memory_error(_out_of_memory_error_array_size); }
static oop out_of_memory_error_gc_overhead_limit() { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit); }
// Accessors needed for fast allocation
// The particular choice of collected heap.
// For UseCompressedOops
static void set_narrow_oop_use_implicit_null_checks(bool use) { _narrow_oop._use_implicit_null_checks = use; }
// Narrow Oop encoding mode:
// 0 - Use 32-bits oops without encoding when
// NarrowOopHeapBaseMin + heap_size < 4Gb
// 1 - Use zero based compressed oops with encoding when
// NarrowOopHeapBaseMin + heap_size < 32Gb
// 2 - Use compressed oops with heap base + encoding.
enum NARROW_OOP_MODE {
UnscaledNarrowOop = 0,
};
static NARROW_OOP_MODE narrow_oop_mode();
// Historic gc information
static size_t get_heap_free_at_last_gc() { return _heap_capacity_at_last_gc - _heap_used_at_last_gc; }
static void update_heap_info_at_gc();
// Testers
static bool on_page_boundary(void* addr);
// Finalizer support.
static void run_finalizers_on_exit();
// Iteration
// Apply "f" to the addresses of all the direct heap pointers maintained
// as static fields of "Universe".
// Apply "f" to all klasses for basic types (classes not present in
// SystemDictionary).
static void basic_type_classes_do(void f(klassOop));
// Apply "f" to all system klasses (classes not present in SystemDictionary).
static void system_classes_do(void f(klassOop));
// For sharing -- fill in a list of known vtable pointers.
// Debugging
}
static void verify() {
verify(false /* silent */);
}
// The default behavior is to call print_on() on gclog_or_tty.
static void print();
// The extended parameter determines which method on the heap will
// be called: print_on() (extended == false) or print_extended_on()
// (extended == true).
static void print_heap_at_SIGBREAK();
// 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(static bool release_fullgc_alot_dummy();)
// The non-oop pattern (see compiledIC.hpp, etc)
static void* non_oop_word();
// Oop verification (see MacroAssembler::verify_oop)
// Flushing and deoptimization
#ifdef HOTSWAP
// Flushing and deoptimization in case of evolution
#endif // HOTSWAP
// Support for fullspeed debugging
// Compiler support
};
private:
public:
_oop = o;
_bytesize = s;
}
}
};
#endif // SHARE_VM_MEMORY_UNIVERSE_HPP