universe.hpp revision 2273
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu * This code is free software; you can redistribute it and/or modify it
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * under the terms of the GNU General Public License version 2 only, as
b4fbc96e05117839ca409f5f20f97b3ac872d1edTill Mossakowski * published by the Free Software Foundation.
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * This code is distributed in the hope that it will be useful, but WITHOUT
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f3a94a197960e548ecd6520bb768cb0d547457bbChristian Maeder * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * version 2 for more details (a copy is included in the LICENSE file that
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * accompanied this code).
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * You should have received a copy of the GNU General Public License version
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * 2 along with this work; if not, write to the Free Software Foundation,
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski * or visit www.oracle.com if you need additional information or have any
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski// Universe is a name space holding known system classes and objects in the VM.
3b48e17c1da54ee669e70b626d9fbc32ce495b2cChristian Maeder// Loaded classes are accessible through the SystemDictionary.
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski// The object heap is allocated and accessed through Universe, and various allocation
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski// support is provided. Allocation by the interpreter and compiled code is done inline
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowski// and bails out to Scavenge::invoke_and_allocate.
3b48e17c1da54ee669e70b626d9fbc32ce495b2cChristian Maeder// Common parts of a methodOop cache. This cache safely interacts with
23a0d43ca980983c7d7aebaa9f03bfe120be7de8Christian Maeder// the RedefineClasses API.
b3dca469a9e267d6d71acfdeca7bf284d0581dc7Till Mossakowskiclass CommonMethodOopCache : public CHeapObj {
5c358300e78157f4bfaf5415c70e1096a9205b61Christian Maeder // We save the klassOop and the idnum of methodOop in order to get
286f4deb69d3912337bb09dd7f81284d12912ce8Christian Maeder // the current cached methodOop.
f2c050360525df494e6115073b0edc4c443a847cMihai Codescu CommonMethodOopCache() { _klass = NULL; _method_idnum = -1; }
f2c050360525df494e6115073b0edc4c443a847cMihai Codescu ~CommonMethodOopCache() { _klass = NULL; _method_idnum = -1; }
bcd914850de931848b86d7728192a149f9c0108bChristian Maeder int method_idnum() const { return _method_idnum; }
e54c5af823b9775dd2c058185ea5bdf7593950faAndy Gimblett // GC support
5c358300e78157f4bfaf5415c70e1096a9205b61Christian Maeder void oops_do(OopClosure* f) { f->do_oop((oop*)&_klass); }
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder// A helper class for caching a methodOop when the user of the cache
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder// cares about all versions of the methodOop.
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reillyclass ActiveMethodOopsCache : public CommonMethodOopCache {
2b2f3b72e82e28b34db9c69af2d1ec38f228272eChristian Maeder // This subclass adds weak references to older versions of the
2b2f3b72e82e28b34db9c69af2d1ec38f228272eChristian Maeder // methodOop and a query method for a methodOop.
2b2f3b72e82e28b34db9c69af2d1ec38f228272eChristian Maeder // If the cached methodOop has not been redefined, then
struct NarrowOopStruct {
int _shift;
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 void universe2_init();
friend bool universe_post_init();
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
static objArrayOop preallocated_out_of_memory_errors() { return _preallocated_out_of_memory_error_array; }
static bool _verify_in_progress;
static void compute_verify_oop_data();
return _objectArrayKlassObj;
return _typeArrayKlassObjs[t];
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); }
static void set_narrow_oop_use_implicit_null_checks(bool use) { _narrow_oop._use_implicit_null_checks = use; }
enum NARROW_OOP_MODE {
UnscaledNarrowOop = 0,
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();
static void run_finalizers_on_exit();
static void print();
static void print_heap_at_SIGBREAK();
// The non-oop pattern (see compiledIC.hpp, etc)
static void* non_oop_word();
#ifdef HOTSWAP
_oop = o;
_bytesize = s;