2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2012-03-14 20:06:48 -07:00
|
|
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* 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.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "precompiled.hpp"
|
|
|
|
#include "classfile/javaClasses.hpp"
|
|
|
|
#include "classfile/systemDictionary.hpp"
|
|
|
|
#include "classfile/verifier.hpp"
|
|
|
|
#include "classfile/vmSymbols.hpp"
|
|
|
|
#include "compiler/compileBroker.hpp"
|
|
|
|
#include "gc_implementation/shared/markSweep.inline.hpp"
|
|
|
|
#include "gc_interface/collectedHeap.inline.hpp"
|
|
|
|
#include "interpreter/oopMapCache.hpp"
|
|
|
|
#include "interpreter/rewriter.hpp"
|
|
|
|
#include "jvmtifiles/jvmti.h"
|
|
|
|
#include "memory/genOopClosures.inline.hpp"
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#include "memory/metadataFactory.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "memory/oopFactory.hpp"
|
2011-09-10 17:29:02 -07:00
|
|
|
#include "oops/fieldStreams.hpp"
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#include "oops/instanceClassLoaderKlass.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "oops/instanceKlass.hpp"
|
2011-03-18 16:00:34 -07:00
|
|
|
#include "oops/instanceMirrorKlass.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "oops/instanceOop.hpp"
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#include "oops/klass.inline.hpp"
|
|
|
|
#include "oops/method.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "oops/oop.inline.hpp"
|
2011-01-27 16:11:27 -08:00
|
|
|
#include "oops/symbol.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "prims/jvmtiExport.hpp"
|
|
|
|
#include "prims/jvmtiRedefineClassesTrace.hpp"
|
|
|
|
#include "runtime/fieldDescriptor.hpp"
|
|
|
|
#include "runtime/handles.inline.hpp"
|
|
|
|
#include "runtime/javaCalls.hpp"
|
|
|
|
#include "runtime/mutexLocker.hpp"
|
|
|
|
#include "services/threadService.hpp"
|
|
|
|
#include "utilities/dtrace.hpp"
|
|
|
|
#ifdef TARGET_OS_FAMILY_linux
|
|
|
|
# include "thread_linux.inline.hpp"
|
|
|
|
#endif
|
|
|
|
#ifdef TARGET_OS_FAMILY_solaris
|
|
|
|
# include "thread_solaris.inline.hpp"
|
|
|
|
#endif
|
|
|
|
#ifdef TARGET_OS_FAMILY_windows
|
|
|
|
# include "thread_windows.inline.hpp"
|
|
|
|
#endif
|
2011-09-25 16:03:29 -07:00
|
|
|
#ifdef TARGET_OS_FAMILY_bsd
|
|
|
|
# include "thread_bsd.inline.hpp"
|
|
|
|
#endif
|
2010-11-23 13:22:55 -08:00
|
|
|
#ifndef SERIALGC
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
|
|
|
|
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
|
|
|
|
#include "gc_implementation/g1/g1RemSet.inline.hpp"
|
|
|
|
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
|
|
|
|
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
|
|
|
|
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
|
|
|
|
#include "oops/oop.pcgc.inline.hpp"
|
|
|
|
#endif
|
|
|
|
#ifdef COMPILER1
|
|
|
|
#include "c1/c1_Compiler.hpp"
|
|
|
|
#endif
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2010-03-17 11:01:05 +01:00
|
|
|
#ifdef DTRACE_ENABLED
|
|
|
|
|
2011-10-13 09:35:42 -07:00
|
|
|
#ifndef USDT2
|
|
|
|
|
2010-03-17 11:01:05 +01:00
|
|
|
HS_DTRACE_PROBE_DECL4(hotspot, class__initialization__required,
|
|
|
|
char*, intptr_t, oop, intptr_t);
|
|
|
|
HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__recursive,
|
|
|
|
char*, intptr_t, oop, intptr_t, int);
|
|
|
|
HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__concurrent,
|
|
|
|
char*, intptr_t, oop, intptr_t, int);
|
|
|
|
HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__erroneous,
|
|
|
|
char*, intptr_t, oop, intptr_t, int);
|
|
|
|
HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__super__failed,
|
|
|
|
char*, intptr_t, oop, intptr_t, int);
|
|
|
|
HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__clinit,
|
|
|
|
char*, intptr_t, oop, intptr_t, int);
|
|
|
|
HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__error,
|
|
|
|
char*, intptr_t, oop, intptr_t, int);
|
|
|
|
HS_DTRACE_PROBE_DECL5(hotspot, class__initialization__end,
|
|
|
|
char*, intptr_t, oop, intptr_t, int);
|
|
|
|
|
|
|
|
#define DTRACE_CLASSINIT_PROBE(type, clss, thread_type) \
|
|
|
|
{ \
|
|
|
|
char* data = NULL; \
|
|
|
|
int len = 0; \
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* name = (clss)->name(); \
|
2010-03-17 11:01:05 +01:00
|
|
|
if (name != NULL) { \
|
|
|
|
data = (char*)name->bytes(); \
|
|
|
|
len = name->utf8_length(); \
|
|
|
|
} \
|
|
|
|
HS_DTRACE_PROBE4(hotspot, class__initialization__##type, \
|
|
|
|
data, len, (clss)->class_loader(), thread_type); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) \
|
|
|
|
{ \
|
|
|
|
char* data = NULL; \
|
|
|
|
int len = 0; \
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* name = (clss)->name(); \
|
2010-03-17 11:01:05 +01:00
|
|
|
if (name != NULL) { \
|
|
|
|
data = (char*)name->bytes(); \
|
|
|
|
len = name->utf8_length(); \
|
|
|
|
} \
|
|
|
|
HS_DTRACE_PROBE5(hotspot, class__initialization__##type, \
|
|
|
|
data, len, (clss)->class_loader(), thread_type, wait); \
|
|
|
|
}
|
2011-10-13 09:35:42 -07:00
|
|
|
#else /* USDT2 */
|
|
|
|
|
|
|
|
#define HOTSPOT_CLASS_INITIALIZATION_required HOTSPOT_CLASS_INITIALIZATION_REQUIRED
|
|
|
|
#define HOTSPOT_CLASS_INITIALIZATION_recursive HOTSPOT_CLASS_INITIALIZATION_RECURSIVE
|
|
|
|
#define HOTSPOT_CLASS_INITIALIZATION_concurrent HOTSPOT_CLASS_INITIALIZATION_CONCURRENT
|
|
|
|
#define HOTSPOT_CLASS_INITIALIZATION_erroneous HOTSPOT_CLASS_INITIALIZATION_ERRONEOUS
|
|
|
|
#define HOTSPOT_CLASS_INITIALIZATION_super__failed HOTSPOT_CLASS_INITIALIZATION_SUPER_FAILED
|
|
|
|
#define HOTSPOT_CLASS_INITIALIZATION_clinit HOTSPOT_CLASS_INITIALIZATION_CLINIT
|
|
|
|
#define HOTSPOT_CLASS_INITIALIZATION_error HOTSPOT_CLASS_INITIALIZATION_ERROR
|
|
|
|
#define HOTSPOT_CLASS_INITIALIZATION_end HOTSPOT_CLASS_INITIALIZATION_END
|
|
|
|
#define DTRACE_CLASSINIT_PROBE(type, clss, thread_type) \
|
|
|
|
{ \
|
|
|
|
char* data = NULL; \
|
|
|
|
int len = 0; \
|
|
|
|
Symbol* name = (clss)->name(); \
|
|
|
|
if (name != NULL) { \
|
|
|
|
data = (char*)name->bytes(); \
|
|
|
|
len = name->utf8_length(); \
|
|
|
|
} \
|
|
|
|
HOTSPOT_CLASS_INITIALIZATION_##type( \
|
|
|
|
data, len, (clss)->class_loader(), thread_type); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait) \
|
|
|
|
{ \
|
|
|
|
char* data = NULL; \
|
|
|
|
int len = 0; \
|
|
|
|
Symbol* name = (clss)->name(); \
|
|
|
|
if (name != NULL) { \
|
|
|
|
data = (char*)name->bytes(); \
|
|
|
|
len = name->utf8_length(); \
|
|
|
|
} \
|
|
|
|
HOTSPOT_CLASS_INITIALIZATION_##type( \
|
|
|
|
data, len, (clss)->class_loader(), thread_type, wait); \
|
|
|
|
}
|
|
|
|
#endif /* USDT2 */
|
2010-03-17 11:01:05 +01:00
|
|
|
|
|
|
|
#else // ndef DTRACE_ENABLED
|
|
|
|
|
|
|
|
#define DTRACE_CLASSINIT_PROBE(type, clss, thread_type)
|
|
|
|
#define DTRACE_CLASSINIT_PROBE_WAIT(type, clss, thread_type, wait)
|
|
|
|
|
|
|
|
#endif // ndef DTRACE_ENABLED
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* InstanceKlass::allocate_instance_klass(ClassLoaderData* loader_data,
|
|
|
|
int vtable_len,
|
|
|
|
int itable_len,
|
|
|
|
int static_field_size,
|
|
|
|
int nonstatic_oop_map_size,
|
|
|
|
ReferenceType rt,
|
|
|
|
AccessFlags access_flags,
|
|
|
|
Symbol* name,
|
|
|
|
Klass* super_klass,
|
|
|
|
KlassHandle host_klass,
|
|
|
|
TRAPS) {
|
|
|
|
|
|
|
|
int size = InstanceKlass::size(vtable_len, itable_len, nonstatic_oop_map_size,
|
|
|
|
access_flags.is_interface(),
|
|
|
|
!host_klass.is_null());
|
|
|
|
|
|
|
|
// Allocation
|
|
|
|
InstanceKlass* ik;
|
|
|
|
if (rt == REF_NONE) {
|
|
|
|
if (name == vmSymbols::java_lang_Class()) {
|
2012-09-07 12:04:16 -04:00
|
|
|
ik = new (loader_data, size, THREAD) InstanceMirrorKlass(
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt,
|
|
|
|
access_flags, !host_klass.is_null());
|
|
|
|
} else if (name == vmSymbols::java_lang_ClassLoader() ||
|
|
|
|
(SystemDictionary::ClassLoader_klass_loaded() &&
|
|
|
|
super_klass != NULL &&
|
|
|
|
super_klass->is_subtype_of(SystemDictionary::ClassLoader_klass()))) {
|
2012-09-07 12:04:16 -04:00
|
|
|
ik = new (loader_data, size, THREAD) InstanceClassLoaderKlass(
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt,
|
|
|
|
access_flags, !host_klass.is_null());
|
|
|
|
} else {
|
|
|
|
// normal class
|
|
|
|
ik = new (loader_data, size, THREAD) InstanceKlass(
|
|
|
|
vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt,
|
|
|
|
access_flags, !host_klass.is_null());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// reference klass
|
2012-09-07 12:04:16 -04:00
|
|
|
ik = new (loader_data, size, THREAD) InstanceRefKlass(
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt,
|
|
|
|
access_flags, !host_klass.is_null());
|
|
|
|
}
|
|
|
|
|
|
|
|
return ik;
|
|
|
|
}
|
|
|
|
|
|
|
|
InstanceKlass::InstanceKlass(int vtable_len,
|
|
|
|
int itable_len,
|
|
|
|
int static_field_size,
|
|
|
|
int nonstatic_oop_map_size,
|
|
|
|
ReferenceType rt,
|
|
|
|
AccessFlags access_flags,
|
|
|
|
bool is_anonymous) {
|
|
|
|
No_Safepoint_Verifier no_safepoint; // until k becomes parsable
|
|
|
|
|
|
|
|
int size = InstanceKlass::size(vtable_len, itable_len, nonstatic_oop_map_size,
|
|
|
|
access_flags.is_interface(), is_anonymous);
|
|
|
|
|
|
|
|
// The sizes of these these three variables are used for determining the
|
|
|
|
// size of the instanceKlassOop. It is critical that these are set to the right
|
|
|
|
// sizes before the first GC, i.e., when we allocate the mirror.
|
|
|
|
this->set_vtable_length(vtable_len);
|
|
|
|
this->set_itable_length(itable_len);
|
|
|
|
this->set_static_field_size(static_field_size);
|
|
|
|
this->set_nonstatic_oop_map_size(nonstatic_oop_map_size);
|
|
|
|
this->set_access_flags(access_flags);
|
|
|
|
this->set_is_anonymous(is_anonymous);
|
|
|
|
assert(this->size() == size, "wrong size for object");
|
|
|
|
|
|
|
|
this->set_array_klasses(NULL);
|
|
|
|
this->set_methods(NULL);
|
|
|
|
this->set_method_ordering(NULL);
|
|
|
|
this->set_local_interfaces(NULL);
|
|
|
|
this->set_transitive_interfaces(NULL);
|
|
|
|
this->init_implementor();
|
|
|
|
this->set_fields(NULL, 0);
|
|
|
|
this->set_constants(NULL);
|
|
|
|
this->set_class_loader_data(NULL);
|
|
|
|
this->set_protection_domain(NULL);
|
|
|
|
this->set_signers(NULL);
|
|
|
|
this->set_source_file_name(NULL);
|
|
|
|
this->set_source_debug_extension(NULL, 0);
|
|
|
|
this->set_array_name(NULL);
|
|
|
|
this->set_inner_classes(NULL);
|
|
|
|
this->set_static_oop_field_count(0);
|
|
|
|
this->set_nonstatic_field_size(0);
|
|
|
|
this->set_is_marked_dependent(false);
|
|
|
|
this->set_init_state(InstanceKlass::allocated);
|
|
|
|
this->set_init_thread(NULL);
|
|
|
|
this->set_init_lock(NULL);
|
|
|
|
this->set_reference_type(rt);
|
|
|
|
this->set_oop_map_cache(NULL);
|
|
|
|
this->set_jni_ids(NULL);
|
|
|
|
this->set_osr_nmethods_head(NULL);
|
|
|
|
this->set_breakpoints(NULL);
|
|
|
|
this->init_previous_versions();
|
|
|
|
this->set_generic_signature(NULL);
|
|
|
|
this->release_set_methods_jmethod_ids(NULL);
|
|
|
|
this->release_set_methods_cached_itable_indices(NULL);
|
|
|
|
this->set_annotations(NULL);
|
|
|
|
this->set_jvmti_cached_class_field_map(NULL);
|
|
|
|
this->set_initial_method_idnum(0);
|
|
|
|
|
|
|
|
// initialize the non-header words to zero
|
|
|
|
intptr_t* p = (intptr_t*)this;
|
|
|
|
for (int index = InstanceKlass::header_size(); index < size; index++) {
|
|
|
|
p[index] = NULL_WORD;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set temporary value until parseClassFile updates it with the real instance
|
|
|
|
// size.
|
|
|
|
this->set_layout_helper(Klass::instance_layout_helper(0, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// This function deallocates the metadata and C heap pointers that the
|
|
|
|
// InstanceKlass points to.
|
|
|
|
void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
|
|
|
|
|
|
|
|
// Orphan the mirror first, CMS thinks it's still live.
|
|
|
|
java_lang_Class::set_klass(java_mirror(), NULL);
|
|
|
|
|
|
|
|
// Need to take this class off the class loader data list.
|
|
|
|
loader_data->remove_class(this);
|
|
|
|
|
|
|
|
// The array_klass for this class is created later, after error handling.
|
|
|
|
// For class redefinition, we keep the original class so this scratch class
|
|
|
|
// doesn't have an array class. Either way, assert that there is nothing
|
|
|
|
// to deallocate.
|
|
|
|
assert(array_klasses() == NULL, "array classes shouldn't be created for this class yet");
|
|
|
|
|
|
|
|
// Release C heap allocated data that this might point to, which includes
|
|
|
|
// reference counting symbol names.
|
|
|
|
release_C_heap_structures();
|
|
|
|
|
|
|
|
Array<Method*>* ms = methods();
|
|
|
|
if (ms != Universe::the_empty_method_array()) {
|
|
|
|
for (int i = 0; i <= methods()->length() -1 ; i++) {
|
|
|
|
Method* method = methods()->at(i);
|
|
|
|
// Only want to delete methods that are not executing for RedefineClasses.
|
|
|
|
// The previous version will point to them so they're not totally dangling
|
|
|
|
assert (!method->on_stack(), "shouldn't be called with methods on stack");
|
|
|
|
MetadataFactory::free_metadata(loader_data, method);
|
|
|
|
}
|
|
|
|
MetadataFactory::free_array<Method*>(loader_data, methods());
|
|
|
|
}
|
|
|
|
set_methods(NULL);
|
|
|
|
|
|
|
|
if (method_ordering() != Universe::the_empty_int_array()) {
|
|
|
|
MetadataFactory::free_array<int>(loader_data, method_ordering());
|
|
|
|
}
|
|
|
|
set_method_ordering(NULL);
|
|
|
|
|
|
|
|
// This array is in Klass, but remove it with the InstanceKlass since
|
|
|
|
// this place would be the only caller and it can share memory with transitive
|
|
|
|
// interfaces.
|
|
|
|
if (secondary_supers() != Universe::the_empty_klass_array() &&
|
|
|
|
secondary_supers() != transitive_interfaces()) {
|
|
|
|
MetadataFactory::free_array<Klass*>(loader_data, secondary_supers());
|
|
|
|
}
|
|
|
|
set_secondary_supers(NULL);
|
|
|
|
|
|
|
|
// Only deallocate transitive interfaces if not empty, same as super class
|
|
|
|
// or same as local interfaces. See code in parseClassFile.
|
|
|
|
Array<Klass*>* ti = transitive_interfaces();
|
|
|
|
if (ti != Universe::the_empty_klass_array() && ti != local_interfaces()) {
|
|
|
|
// check that the interfaces don't come from super class
|
|
|
|
Array<Klass*>* sti = (super() == NULL) ? NULL :
|
|
|
|
InstanceKlass::cast(super())->transitive_interfaces();
|
|
|
|
if (ti != sti) {
|
|
|
|
MetadataFactory::free_array<Klass*>(loader_data, ti);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set_transitive_interfaces(NULL);
|
|
|
|
|
|
|
|
// local interfaces can be empty
|
|
|
|
Array<Klass*>* li = local_interfaces();
|
|
|
|
if (li != Universe::the_empty_klass_array()) {
|
|
|
|
MetadataFactory::free_array<Klass*>(loader_data, li);
|
|
|
|
}
|
|
|
|
set_local_interfaces(NULL);
|
|
|
|
|
|
|
|
MetadataFactory::free_array<jushort>(loader_data, fields());
|
|
|
|
set_fields(NULL, 0);
|
|
|
|
|
|
|
|
// If a method from a redefined class is using this constant pool, don't
|
|
|
|
// delete it, yet. The new class's previous version will point to this.
|
|
|
|
assert (!constants()->on_stack(), "shouldn't be called if anything is onstack");
|
|
|
|
MetadataFactory::free_metadata(loader_data, constants());
|
|
|
|
set_constants(NULL);
|
|
|
|
|
|
|
|
if (inner_classes() != Universe::the_empty_short_array()) {
|
|
|
|
MetadataFactory::free_array<jushort>(loader_data, inner_classes());
|
|
|
|
}
|
|
|
|
set_inner_classes(NULL);
|
|
|
|
|
|
|
|
// Null out Java heap objects, although these won't be walked to keep
|
|
|
|
// alive once this InstanceKlass is deallocated.
|
|
|
|
set_protection_domain(NULL);
|
|
|
|
set_signers(NULL);
|
|
|
|
set_init_lock(NULL);
|
|
|
|
set_annotations(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
volatile oop InstanceKlass::init_lock() const {
|
|
|
|
volatile oop lock = _init_lock; // read once
|
|
|
|
assert((oop)lock != NULL || !is_not_initialized(), // initialized or in_error state
|
|
|
|
"only fully initialized state can have a null lock");
|
|
|
|
return lock;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the initialization lock to null so the object can be GC'ed. Any racing
|
|
|
|
// threads to get this lock will see a null lock and will not lock.
|
|
|
|
// That's okay because they all check for initialized state after getting
|
|
|
|
// the lock and return.
|
|
|
|
void InstanceKlass::fence_and_clear_init_lock() {
|
|
|
|
// make sure previous stores are all done, notably the init_state.
|
|
|
|
OrderAccess::storestore();
|
|
|
|
klass_oop_store(&_init_lock, NULL);
|
|
|
|
assert(!is_not_initialized(), "class must be initialized now");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool InstanceKlass::should_be_initialized() const {
|
2007-12-01 00:00:00 +00:00
|
|
|
return !is_initialized();
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
klassVtable* InstanceKlass::vtable() const {
|
|
|
|
return new klassVtable(this, start_of_vtable(), vtable_length() / vtableEntry::size());
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
klassItable* InstanceKlass::itable() const {
|
|
|
|
return new klassItable(instanceKlassHandle(this));
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::eager_initialize(Thread *thread) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (!EagerInitialization) return;
|
|
|
|
|
|
|
|
if (this->is_not_initialized()) {
|
|
|
|
// abort if the the class has a class initializer
|
|
|
|
if (this->class_initializer() != NULL) return;
|
|
|
|
|
|
|
|
// abort if it is java.lang.Object (initialization is handled in genesis)
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* super = this->super();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (super == NULL) return;
|
|
|
|
|
|
|
|
// abort if the super class should be initialized
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (!InstanceKlass::cast(super)->is_initialized()) return;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// call body to expose the this pointer
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
instanceKlassHandle this_oop(thread, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
eager_initialize_impl(this_oop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) {
|
2007-12-01 00:00:00 +00:00
|
|
|
EXCEPTION_MARK;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
volatile oop init_lock = this_oop->init_lock();
|
|
|
|
ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// abort if someone beat us to the initialization
|
|
|
|
if (!this_oop->is_not_initialized()) return; // note: not equivalent to is_initialized()
|
|
|
|
|
2011-12-06 18:28:51 -05:00
|
|
|
ClassState old_state = this_oop->init_state();
|
2007-12-01 00:00:00 +00:00
|
|
|
link_class_impl(this_oop, true, THREAD);
|
|
|
|
if (HAS_PENDING_EXCEPTION) {
|
|
|
|
CLEAR_PENDING_EXCEPTION;
|
|
|
|
// Abort if linking the class throws an exception.
|
|
|
|
|
|
|
|
// Use a test to avoid redundantly resetting the state if there's
|
|
|
|
// no change. Set_init_state() asserts that state changes make
|
|
|
|
// progress, whereas here we might just be spinning in place.
|
|
|
|
if( old_state != this_oop->_init_state )
|
|
|
|
this_oop->set_init_state (old_state);
|
|
|
|
} else {
|
|
|
|
// linking successfull, mark class as initialized
|
|
|
|
this_oop->set_init_state (fully_initialized);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
this_oop->fence_and_clear_init_lock();
|
2007-12-01 00:00:00 +00:00
|
|
|
// trace
|
|
|
|
if (TraceClassInitialization) {
|
|
|
|
ResourceMark rm(THREAD);
|
|
|
|
tty->print_cr("[Initialized %s without side effects]", this_oop->external_name());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// See "The Virtual Machine Specification" section 2.16.5 for a detailed explanation of the class initialization
|
|
|
|
// process. The step comments refers to the procedure described in that section.
|
|
|
|
// Note: implementation moved to static method to expose the this pointer.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::initialize(TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (this->should_be_initialized()) {
|
|
|
|
HandleMark hm(THREAD);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
instanceKlassHandle this_oop(THREAD, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
initialize_impl(this_oop, CHECK);
|
|
|
|
// Note: at this point the class may be initialized
|
|
|
|
// OR it may be in the state of being initialized
|
|
|
|
// in case of recursive initialization!
|
|
|
|
} else {
|
|
|
|
assert(is_initialized(), "sanity check");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::verify_code(
|
2007-12-01 00:00:00 +00:00
|
|
|
instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS) {
|
|
|
|
// 1) Verify the bytecodes
|
|
|
|
Verifier::Mode mode =
|
|
|
|
throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
|
2009-09-04 12:53:02 -04:00
|
|
|
return Verifier::verify(this_oop, mode, this_oop->should_verify_class(), CHECK_false);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Used exclusively by the shared spaces dump mechanism to prevent
|
|
|
|
// classes mapped into the shared regions in new VMs from appearing linked.
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::unlink_class() {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(is_linked(), "must be linked");
|
|
|
|
_init_state = loaded;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::link_class(TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(is_loaded(), "must be loaded");
|
|
|
|
if (!is_linked()) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
HandleMark hm(THREAD);
|
|
|
|
instanceKlassHandle this_oop(THREAD, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
link_class_impl(this_oop, true, CHECK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Called to verify that a class can link during initialization, without
|
|
|
|
// throwing a VerifyError.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::link_class_or_fail(TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(is_loaded(), "must be loaded");
|
|
|
|
if (!is_linked()) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
HandleMark hm(THREAD);
|
|
|
|
instanceKlassHandle this_oop(THREAD, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
link_class_impl(this_oop, false, CHECK_false);
|
|
|
|
}
|
|
|
|
return is_linked();
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::link_class_impl(
|
2007-12-01 00:00:00 +00:00
|
|
|
instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS) {
|
|
|
|
// check for error state
|
|
|
|
if (this_oop->is_in_error_state()) {
|
|
|
|
ResourceMark rm(THREAD);
|
|
|
|
THROW_MSG_(vmSymbols::java_lang_NoClassDefFoundError(),
|
|
|
|
this_oop->external_name(), false);
|
|
|
|
}
|
|
|
|
// return if already verified
|
|
|
|
if (this_oop->is_linked()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Timing
|
|
|
|
// timer handles recursion
|
|
|
|
assert(THREAD->is_Java_thread(), "non-JavaThread in link_class_impl");
|
|
|
|
JavaThread* jt = (JavaThread*)THREAD;
|
|
|
|
|
|
|
|
// link super class before linking this class
|
|
|
|
instanceKlassHandle super(THREAD, this_oop->super());
|
|
|
|
if (super.not_null()) {
|
|
|
|
if (super->is_interface()) { // check if super class is an interface
|
|
|
|
ResourceMark rm(THREAD);
|
|
|
|
Exceptions::fthrow(
|
|
|
|
THREAD_AND_LOCATION,
|
2011-01-27 16:11:27 -08:00
|
|
|
vmSymbols::java_lang_IncompatibleClassChangeError(),
|
2007-12-01 00:00:00 +00:00
|
|
|
"class %s has interface %s as super class",
|
|
|
|
this_oop->external_name(),
|
|
|
|
super->external_name()
|
|
|
|
);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
link_class_impl(super, throw_verifyerror, CHECK_false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// link all interfaces implemented by this class before linking this class
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Array<Klass*>* interfaces = this_oop->local_interfaces();
|
2007-12-01 00:00:00 +00:00
|
|
|
int num_interfaces = interfaces->length();
|
|
|
|
for (int index = 0; index < num_interfaces; index++) {
|
|
|
|
HandleMark hm(THREAD);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
instanceKlassHandle ih(THREAD, interfaces->at(index));
|
2007-12-01 00:00:00 +00:00
|
|
|
link_class_impl(ih, throw_verifyerror, CHECK_false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// in case the class is linked in the process of linking its superclasses
|
|
|
|
if (this_oop->is_linked()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-07-10 11:10:00 -07:00
|
|
|
// trace only the link time for this klass that includes
|
|
|
|
// the verification time
|
|
|
|
PerfClassTraceTime vmtimer(ClassLoader::perf_class_link_time(),
|
|
|
|
ClassLoader::perf_class_link_selftime(),
|
|
|
|
ClassLoader::perf_classes_linked(),
|
|
|
|
jt->get_thread_stat()->perf_recursion_counts_addr(),
|
|
|
|
jt->get_thread_stat()->perf_timers_addr(),
|
|
|
|
PerfClassTraceTime::CLASS_LINK);
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// verification & rewriting
|
|
|
|
{
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
volatile oop init_lock = this_oop->init_lock();
|
|
|
|
ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
|
2007-12-01 00:00:00 +00:00
|
|
|
// rewritten will have been set if loader constraint error found
|
|
|
|
// on an earlier link attempt
|
|
|
|
// don't verify or rewrite if already rewritten
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
if (!this_oop->is_linked()) {
|
|
|
|
if (!this_oop->is_rewritten()) {
|
|
|
|
{
|
|
|
|
// Timer includes any side effects of class verification (resolution,
|
|
|
|
// etc), but not recursive entry into verify_code().
|
2009-07-10 11:10:00 -07:00
|
|
|
PerfClassTraceTime timer(ClassLoader::perf_class_verify_time(),
|
|
|
|
ClassLoader::perf_class_verify_selftime(),
|
|
|
|
ClassLoader::perf_classes_verified(),
|
|
|
|
jt->get_thread_stat()->perf_recursion_counts_addr(),
|
|
|
|
jt->get_thread_stat()->perf_timers_addr(),
|
|
|
|
PerfClassTraceTime::CLASS_VERIFY);
|
2007-12-01 00:00:00 +00:00
|
|
|
bool verify_ok = verify_code(this_oop, throw_verifyerror, THREAD);
|
|
|
|
if (!verify_ok) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Just in case a side-effect of verify linked this class already
|
|
|
|
// (which can sometimes happen since the verifier loads classes
|
|
|
|
// using custom class loaders, which are free to initialize things)
|
|
|
|
if (this_oop->is_linked()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// also sets rewritten
|
|
|
|
this_oop->rewrite_class(CHECK_false);
|
|
|
|
}
|
|
|
|
|
2011-05-21 15:39:54 -07:00
|
|
|
// relocate jsrs and link methods after they are all rewritten
|
|
|
|
this_oop->relocate_and_link_methods(CHECK_false);
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Initialize the vtable and interface table after
|
|
|
|
// methods have been rewritten since rewrite may
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// fabricate new Method*s.
|
2007-12-01 00:00:00 +00:00
|
|
|
// also does loader constraint checking
|
|
|
|
if (!this_oop()->is_shared()) {
|
|
|
|
ResourceMark rm(THREAD);
|
|
|
|
this_oop->vtable()->initialize_vtable(true, CHECK_false);
|
|
|
|
this_oop->itable()->initialize_itable(true, CHECK_false);
|
|
|
|
}
|
|
|
|
#ifdef ASSERT
|
|
|
|
else {
|
|
|
|
ResourceMark rm(THREAD);
|
|
|
|
this_oop->vtable()->verify(tty, true);
|
|
|
|
// In case itable verification is ever added.
|
|
|
|
// this_oop->itable()->verify(tty, true);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
this_oop->set_init_state(linked);
|
|
|
|
if (JvmtiExport::should_post_class_prepare()) {
|
|
|
|
Thread *thread = THREAD;
|
|
|
|
assert(thread->is_Java_thread(), "thread->is_Java_thread()");
|
|
|
|
JvmtiExport::post_class_prepare((JavaThread *) thread, this_oop());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Rewrite the byte codes of all of the methods of a class.
|
|
|
|
// The rewriter must be called exactly once. Rewriting must happen after
|
|
|
|
// verification but before the first method of the class is executed.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::rewrite_class(TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(is_loaded(), "must be loaded");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
instanceKlassHandle this_oop(THREAD, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (this_oop->is_rewritten()) {
|
|
|
|
assert(this_oop()->is_shared(), "rewriting an unshared class?");
|
|
|
|
return;
|
|
|
|
}
|
2011-05-21 15:39:54 -07:00
|
|
|
Rewriter::rewrite(this_oop, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
this_oop->set_rewritten();
|
|
|
|
}
|
|
|
|
|
2011-05-21 15:39:54 -07:00
|
|
|
// Now relocate and link method entry points after class is rewritten.
|
|
|
|
// This is outside is_rewritten flag. In case of an exception, it can be
|
|
|
|
// executed more than once.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::relocate_and_link_methods(TRAPS) {
|
2011-05-21 15:39:54 -07:00
|
|
|
assert(is_loaded(), "must be loaded");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
instanceKlassHandle this_oop(THREAD, this);
|
2011-05-21 15:39:54 -07:00
|
|
|
Rewriter::relocate_and_link(this_oop, CHECK);
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// Make sure klass is linked (verified) before initialization
|
|
|
|
// A class could already be verified, since it has been reflected upon.
|
|
|
|
this_oop->link_class(CHECK);
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
DTRACE_CLASSINIT_PROBE(required, InstanceKlass::cast(this_oop()), -1);
|
2010-03-17 11:01:05 +01:00
|
|
|
|
|
|
|
bool wait = false;
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// refer to the JVM book page 47 for description of steps
|
|
|
|
// Step 1
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
{
|
|
|
|
volatile oop init_lock = this_oop->init_lock();
|
|
|
|
ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
Thread *self = THREAD; // it's passed the current thread
|
|
|
|
|
|
|
|
// Step 2
|
|
|
|
// If we were to use wait() instead of waitInterruptibly() then
|
|
|
|
// we might end up throwing IE from link/symbol resolution sites
|
|
|
|
// that aren't expected to throw. This would wreak havoc. See 6320309.
|
|
|
|
while(this_oop->is_being_initialized() && !this_oop->is_reentrant_initialization(self)) {
|
2010-03-17 11:01:05 +01:00
|
|
|
wait = true;
|
2007-12-01 00:00:00 +00:00
|
|
|
ol.waitUninterruptibly(CHECK);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Step 3
|
2010-03-17 11:01:05 +01:00
|
|
|
if (this_oop->is_being_initialized() && this_oop->is_reentrant_initialization(self)) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
DTRACE_CLASSINIT_PROBE_WAIT(recursive, InstanceKlass::cast(this_oop()), -1,wait);
|
2007-12-01 00:00:00 +00:00
|
|
|
return;
|
2010-03-17 11:01:05 +01:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Step 4
|
2010-03-17 11:01:05 +01:00
|
|
|
if (this_oop->is_initialized()) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
DTRACE_CLASSINIT_PROBE_WAIT(concurrent, InstanceKlass::cast(this_oop()), -1,wait);
|
2007-12-01 00:00:00 +00:00
|
|
|
return;
|
2010-03-17 11:01:05 +01:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Step 5
|
|
|
|
if (this_oop->is_in_error_state()) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
DTRACE_CLASSINIT_PROBE_WAIT(erroneous, InstanceKlass::cast(this_oop()), -1,wait);
|
2007-12-01 00:00:00 +00:00
|
|
|
ResourceMark rm(THREAD);
|
|
|
|
const char* desc = "Could not initialize class ";
|
|
|
|
const char* className = this_oop->external_name();
|
|
|
|
size_t msglen = strlen(desc) + strlen(className) + 1;
|
2010-08-27 15:05:28 -04:00
|
|
|
char* message = NEW_RESOURCE_ARRAY(char, msglen);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (NULL == message) {
|
|
|
|
// Out of memory: can't create detailed error message
|
|
|
|
THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className);
|
|
|
|
} else {
|
|
|
|
jio_snprintf(message, msglen, "%s%s", desc, className);
|
|
|
|
THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Step 6
|
|
|
|
this_oop->set_init_state(being_initialized);
|
|
|
|
this_oop->set_init_thread(self);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Step 7
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* super_klass = this_oop->super();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (super_klass != NULL && !this_oop->is_interface() && Klass::cast(super_klass)->should_be_initialized()) {
|
|
|
|
Klass::cast(super_klass)->initialize(THREAD);
|
|
|
|
|
|
|
|
if (HAS_PENDING_EXCEPTION) {
|
|
|
|
Handle e(THREAD, PENDING_EXCEPTION);
|
|
|
|
CLEAR_PENDING_EXCEPTION;
|
|
|
|
{
|
|
|
|
EXCEPTION_MARK;
|
|
|
|
this_oop->set_initialization_state_and_notify(initialization_error, THREAD); // Locks object, set state, and notify all waiting threads
|
|
|
|
CLEAR_PENDING_EXCEPTION; // ignore any exception thrown, superclass initialization error is thrown below
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
DTRACE_CLASSINIT_PROBE_WAIT(super__failed, InstanceKlass::cast(this_oop()), -1,wait);
|
2007-12-01 00:00:00 +00:00
|
|
|
THROW_OOP(e());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-11 12:25:42 -04:00
|
|
|
if (this_oop->has_default_methods()) {
|
|
|
|
// Step 7.5: initialize any interfaces which have default methods
|
|
|
|
for (int i = 0; i < this_oop->local_interfaces()->length(); ++i) {
|
|
|
|
Klass* iface = this_oop->local_interfaces()->at(i);
|
|
|
|
InstanceKlass* ik = InstanceKlass::cast(iface);
|
|
|
|
if (ik->has_default_methods() && ik->should_be_initialized()) {
|
|
|
|
ik->initialize(THREAD);
|
|
|
|
|
|
|
|
if (HAS_PENDING_EXCEPTION) {
|
|
|
|
Handle e(THREAD, PENDING_EXCEPTION);
|
|
|
|
CLEAR_PENDING_EXCEPTION;
|
|
|
|
{
|
|
|
|
EXCEPTION_MARK;
|
|
|
|
// Locks object, set state, and notify all waiting threads
|
|
|
|
this_oop->set_initialization_state_and_notify(
|
|
|
|
initialization_error, THREAD);
|
|
|
|
|
|
|
|
// ignore any exception thrown, superclass initialization error is
|
|
|
|
// thrown below
|
|
|
|
CLEAR_PENDING_EXCEPTION;
|
|
|
|
}
|
|
|
|
DTRACE_CLASSINIT_PROBE_WAIT(
|
|
|
|
super__failed, InstanceKlass::cast(this_oop()), -1, wait);
|
|
|
|
THROW_OOP(e());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Step 8
|
|
|
|
{
|
|
|
|
assert(THREAD->is_Java_thread(), "non-JavaThread in initialize_impl");
|
|
|
|
JavaThread* jt = (JavaThread*)THREAD;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
DTRACE_CLASSINIT_PROBE_WAIT(clinit, InstanceKlass::cast(this_oop()), -1,wait);
|
2007-12-01 00:00:00 +00:00
|
|
|
// Timer includes any side effects of class initialization (resolution,
|
|
|
|
// etc), but not recursive entry into call_class_initializer().
|
2009-07-10 11:10:00 -07:00
|
|
|
PerfClassTraceTime timer(ClassLoader::perf_class_init_time(),
|
|
|
|
ClassLoader::perf_class_init_selftime(),
|
|
|
|
ClassLoader::perf_classes_inited(),
|
|
|
|
jt->get_thread_stat()->perf_recursion_counts_addr(),
|
|
|
|
jt->get_thread_stat()->perf_timers_addr(),
|
|
|
|
PerfClassTraceTime::CLASS_CLINIT);
|
2007-12-01 00:00:00 +00:00
|
|
|
this_oop->call_class_initializer(THREAD);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Step 9
|
|
|
|
if (!HAS_PENDING_EXCEPTION) {
|
|
|
|
this_oop->set_initialization_state_and_notify(fully_initialized, CHECK);
|
|
|
|
{ ResourceMark rm(THREAD);
|
|
|
|
debug_only(this_oop->vtable()->verify(tty, true);)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// Step 10 and 11
|
|
|
|
Handle e(THREAD, PENDING_EXCEPTION);
|
|
|
|
CLEAR_PENDING_EXCEPTION;
|
|
|
|
{
|
|
|
|
EXCEPTION_MARK;
|
|
|
|
this_oop->set_initialization_state_and_notify(initialization_error, THREAD);
|
|
|
|
CLEAR_PENDING_EXCEPTION; // ignore any exception thrown, class initialization error is thrown below
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
DTRACE_CLASSINIT_PROBE_WAIT(error, InstanceKlass::cast(this_oop()), -1,wait);
|
2010-01-06 14:22:39 -08:00
|
|
|
if (e->is_a(SystemDictionary::Error_klass())) {
|
2007-12-01 00:00:00 +00:00
|
|
|
THROW_OOP(e());
|
|
|
|
} else {
|
|
|
|
JavaCallArguments args(e);
|
2011-01-27 16:11:27 -08:00
|
|
|
THROW_ARG(vmSymbols::java_lang_ExceptionInInitializerError(),
|
|
|
|
vmSymbols::throwable_void_signature(),
|
2007-12-01 00:00:00 +00:00
|
|
|
&args);
|
|
|
|
}
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
DTRACE_CLASSINIT_PROBE_WAIT(end, InstanceKlass::cast(this_oop()), -1,wait);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Note: implementation moved to static method to expose the this pointer.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::set_initialization_state_and_notify(ClassState state, TRAPS) {
|
|
|
|
instanceKlassHandle kh(THREAD, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
set_initialization_state_and_notify_impl(kh, state, CHECK);
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) {
|
|
|
|
volatile oop init_lock = this_oop->init_lock();
|
|
|
|
ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
|
2007-12-01 00:00:00 +00:00
|
|
|
this_oop->set_init_state(state);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
this_oop->fence_and_clear_init_lock();
|
2007-12-01 00:00:00 +00:00
|
|
|
ol.notify_all(CHECK);
|
|
|
|
}
|
|
|
|
|
2012-03-29 22:18:56 -04:00
|
|
|
// The embedded _implementor field can only record one implementor.
|
|
|
|
// When there are more than one implementors, the _implementor field
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// is set to the interface Klass* itself. Following are the possible
|
2012-03-29 22:18:56 -04:00
|
|
|
// values for the _implementor field:
|
|
|
|
// NULL - no implementor
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// implementor Klass* - one implementor
|
2012-03-29 22:18:56 -04:00
|
|
|
// self - more than one implementor
|
|
|
|
//
|
|
|
|
// The _implementor field only exists for interfaces.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::add_implementor(Klass* k) {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(Compile_lock->owned_by_self(), "");
|
2012-03-29 22:18:56 -04:00
|
|
|
assert(is_interface(), "not interface");
|
2007-12-01 00:00:00 +00:00
|
|
|
// Filter out my subinterfaces.
|
|
|
|
// (Note: Interfaces are never on the subklass list.)
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (InstanceKlass::cast(k)->is_interface()) return;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Filter out subclasses whose supers already implement me.
|
|
|
|
// (Note: CHA must walk subclasses of direct implementors
|
|
|
|
// in order to locate indirect implementors.)
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* sk = InstanceKlass::cast(k)->super();
|
|
|
|
if (sk != NULL && InstanceKlass::cast(sk)->implements_interface(this))
|
2007-12-01 00:00:00 +00:00
|
|
|
// We only need to check one immediate superclass, since the
|
|
|
|
// implements_interface query looks at transitive_interfaces.
|
|
|
|
// Any supers of the super have the same (or fewer) transitive_interfaces.
|
|
|
|
return;
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* ik = implementor();
|
2012-03-29 22:18:56 -04:00
|
|
|
if (ik == NULL) {
|
|
|
|
set_implementor(k);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
} else if (ik != this) {
|
2012-03-29 22:18:56 -04:00
|
|
|
// There is already an implementor. Use itself as an indicator of
|
|
|
|
// more than one implementors.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
set_implementor(this);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// The implementor also implements the transitive_interfaces
|
|
|
|
for (int index = 0; index < local_interfaces()->length(); index++) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass::cast(local_interfaces()->at(index))->add_implementor(k);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::init_implementor() {
|
2012-03-29 22:18:56 -04:00
|
|
|
if (is_interface()) {
|
|
|
|
set_implementor(NULL);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::process_interfaces(Thread *thread) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// link this class into the implementors list of every interface it implements
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* this_as_klass_oop = this;
|
2007-12-01 00:00:00 +00:00
|
|
|
for (int i = local_interfaces()->length() - 1; i >= 0; i--) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
assert(local_interfaces()->at(i)->is_klass(), "must be a klass");
|
|
|
|
InstanceKlass* interf = InstanceKlass::cast(local_interfaces()->at(i));
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(interf->is_interface(), "expected interface");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
interf->add_implementor(this_as_klass_oop);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::can_be_primary_super_slow() const {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (is_interface())
|
|
|
|
return false;
|
|
|
|
else
|
|
|
|
return Klass::can_be_primary_super_slow();
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
GrowableArray<Klass*>* InstanceKlass::compute_secondary_supers(int num_extra_slots) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// The secondaries are the implemented interfaces.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass* ik = InstanceKlass::cast(this);
|
|
|
|
Array<Klass*>* interfaces = ik->transitive_interfaces();
|
2007-12-01 00:00:00 +00:00
|
|
|
int num_secondaries = num_extra_slots + interfaces->length();
|
|
|
|
if (num_secondaries == 0) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Must share this for correct bootstrapping!
|
|
|
|
set_secondary_supers(Universe::the_empty_klass_array());
|
|
|
|
return NULL;
|
2007-12-01 00:00:00 +00:00
|
|
|
} else if (num_extra_slots == 0) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// The secondary super list is exactly the same as the transitive interfaces.
|
|
|
|
// Redefine classes has to be careful not to delete this!
|
|
|
|
set_secondary_supers(interfaces);
|
|
|
|
return NULL;
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Copy transitive interfaces to a temporary growable array to be constructed
|
|
|
|
// into the secondary super list with extra slots.
|
|
|
|
GrowableArray<Klass*>* secondaries = new GrowableArray<Klass*>(interfaces->length());
|
2007-12-01 00:00:00 +00:00
|
|
|
for (int i = 0; i < interfaces->length(); i++) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
secondaries->push(interfaces->at(i));
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
return secondaries;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::compute_is_subtype_of(Klass* k) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (Klass::cast(k)->is_interface()) {
|
|
|
|
return implements_interface(k);
|
|
|
|
} else {
|
|
|
|
return Klass::compute_is_subtype_of(k);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::implements_interface(Klass* k) const {
|
|
|
|
if (this == k) return true;
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(Klass::cast(k)->is_interface(), "should be an interface class");
|
|
|
|
for (int i = 0; i < transitive_interfaces()->length(); i++) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (transitive_interfaces()->at(i) == k) {
|
2007-12-01 00:00:00 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
|
|
|
if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
|
2009-06-29 14:42:12 -07:00
|
|
|
report_java_out_of_memory("Requested array size exceeds VM limit");
|
2012-03-14 20:06:48 -07:00
|
|
|
JvmtiExport::post_array_size_exhausted();
|
2007-12-01 00:00:00 +00:00
|
|
|
THROW_OOP_0(Universe::out_of_memory_error_array_size());
|
|
|
|
}
|
|
|
|
int size = objArrayOopDesc::object_size(length);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* ak = array_klass(n, CHECK_NULL);
|
2007-12-01 00:00:00 +00:00
|
|
|
KlassHandle h_ak (THREAD, ak);
|
|
|
|
objArrayOop o =
|
|
|
|
(objArrayOop)CollectedHeap::array_allocate(h_ak, size, length, CHECK_NULL);
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
instanceOop InstanceKlass::register_finalizer(instanceOop i, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (TraceFinalizerRegistration) {
|
|
|
|
tty->print("Registered ");
|
|
|
|
i->print_value_on(tty);
|
|
|
|
tty->print_cr(" (" INTPTR_FORMAT ") as finalizable", (address)i);
|
|
|
|
}
|
|
|
|
instanceHandle h_i(THREAD, i);
|
|
|
|
// Pass the handle as argument, JavaCalls::call expects oop as jobjects
|
|
|
|
JavaValue result(T_VOID);
|
|
|
|
JavaCallArguments args(h_i);
|
|
|
|
methodHandle mh (THREAD, Universe::finalizer_register_method());
|
|
|
|
JavaCalls::call(&result, mh, &args, CHECK_NULL);
|
|
|
|
return h_i();
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
instanceOop InstanceKlass::allocate_instance(TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
bool has_finalizer_flag = has_finalizer(); // Query before possible GC
|
|
|
|
int size = size_helper(); // Query before forming handle.
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
KlassHandle h_k(THREAD, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
instanceOop i;
|
|
|
|
|
|
|
|
i = (instanceOop)CollectedHeap::obj_allocate(h_k, size, CHECK_NULL);
|
|
|
|
if (has_finalizer_flag && !RegisterFinalizersAtInit) {
|
|
|
|
i = register_finalizer(i, CHECK_NULL);
|
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::check_valid_for_instantiation(bool throwError, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (is_interface() || is_abstract()) {
|
|
|
|
ResourceMark rm(THREAD);
|
|
|
|
THROW_MSG(throwError ? vmSymbols::java_lang_InstantiationError()
|
|
|
|
: vmSymbols::java_lang_InstantiationException(), external_name());
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (this == SystemDictionary::Class_klass()) {
|
2007-12-01 00:00:00 +00:00
|
|
|
ResourceMark rm(THREAD);
|
|
|
|
THROW_MSG(throwError ? vmSymbols::java_lang_IllegalAccessError()
|
|
|
|
: vmSymbols::java_lang_IllegalAccessException(), external_name());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* InstanceKlass::array_klass_impl(bool or_null, int n, TRAPS) {
|
|
|
|
instanceKlassHandle this_oop(THREAD, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
return array_klass_impl(this_oop, or_null, n, THREAD);
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* InstanceKlass::array_klass_impl(instanceKlassHandle this_oop, bool or_null, int n, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (this_oop->array_klasses() == NULL) {
|
|
|
|
if (or_null) return NULL;
|
|
|
|
|
|
|
|
ResourceMark rm;
|
|
|
|
JavaThread *jt = (JavaThread *)THREAD;
|
|
|
|
{
|
|
|
|
// Atomic creation of array_klasses
|
|
|
|
MutexLocker mc(Compile_lock, THREAD); // for vtables
|
|
|
|
MutexLocker ma(MultiArray_lock, THREAD);
|
|
|
|
|
|
|
|
// Check if update has already taken place
|
|
|
|
if (this_oop->array_klasses() == NULL) {
|
2012-09-29 06:40:00 -04:00
|
|
|
Klass* k = ObjArrayKlass::allocate_objArray_klass(this_oop->class_loader_data(), 1, this_oop, CHECK_NULL);
|
2007-12-01 00:00:00 +00:00
|
|
|
this_oop->set_array_klasses(k);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// _this will always be set at this point
|
2012-09-29 06:40:00 -04:00
|
|
|
ObjArrayKlass* oak = (ObjArrayKlass*)this_oop->array_klasses();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (or_null) {
|
|
|
|
return oak->array_klass_or_null(n);
|
|
|
|
}
|
|
|
|
return oak->array_klass(n, CHECK_NULL);
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* InstanceKlass::array_klass_impl(bool or_null, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
return array_klass_impl(or_null, 1, THREAD);
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::call_class_initializer(TRAPS) {
|
|
|
|
instanceKlassHandle ik (THREAD, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
call_class_initializer_impl(ik, THREAD);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int call_class_initializer_impl_counter = 0; // for debugging
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* InstanceKlass::class_initializer() {
|
|
|
|
Method* clinit = find_method(
|
2011-03-04 14:40:46 -05:00
|
|
|
vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
|
|
|
|
if (clinit != NULL && clinit->has_valid_initializer_flags()) {
|
|
|
|
return clinit;
|
|
|
|
}
|
|
|
|
return NULL;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::call_class_initializer_impl(instanceKlassHandle this_oop, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
methodHandle h_method(THREAD, this_oop->class_initializer());
|
|
|
|
assert(!this_oop->is_initialized(), "we cannot initialize twice");
|
|
|
|
if (TraceClassInitialization) {
|
|
|
|
tty->print("%d Initializing ", call_class_initializer_impl_counter++);
|
|
|
|
this_oop->name()->print_value();
|
|
|
|
tty->print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", (address)this_oop());
|
|
|
|
}
|
|
|
|
if (h_method() != NULL) {
|
|
|
|
JavaCallArguments args; // No arguments
|
|
|
|
JavaValue result(T_VOID);
|
|
|
|
JavaCalls::call(&result, h_method, &args, CHECK); // Static call (no args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::mask_for(methodHandle method, int bci,
|
2007-12-01 00:00:00 +00:00
|
|
|
InterpreterOopMap* entry_for) {
|
|
|
|
// Dirty read, then double-check under a lock.
|
|
|
|
if (_oop_map_cache == NULL) {
|
|
|
|
// Otherwise, allocate a new one.
|
|
|
|
MutexLocker x(OopMapCacheAlloc_lock);
|
|
|
|
// First time use. Allocate a cache in C heap
|
|
|
|
if (_oop_map_cache == NULL) {
|
|
|
|
_oop_map_cache = new OopMapCache();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// _oop_map_cache is constant after init; lookup below does is own locking.
|
|
|
|
_oop_map_cache->lookup(method, bci, entry_for);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
|
|
|
|
for (JavaFieldStream fs(this); !fs.done(); fs.next()) {
|
2011-09-10 17:29:02 -07:00
|
|
|
Symbol* f_name = fs.name();
|
|
|
|
Symbol* f_sig = fs.signature();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (f_name == name && f_sig == sig) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
fd->initialize(const_cast<InstanceKlass*>(this), fs.index());
|
2007-12-01 00:00:00 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* InstanceKlass::find_interface_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
|
2007-12-01 00:00:00 +00:00
|
|
|
const int n = local_interfaces()->length();
|
|
|
|
for (int i = 0; i < n; i++) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* intf1 = local_interfaces()->at(i);
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(Klass::cast(intf1)->is_interface(), "just checking type");
|
|
|
|
// search for field in current interface
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (InstanceKlass::cast(intf1)->find_local_field(name, sig, fd)) {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(fd->is_static(), "interface field must be static");
|
|
|
|
return intf1;
|
|
|
|
}
|
|
|
|
// search for field in direct superinterfaces
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* intf2 = InstanceKlass::cast(intf1)->find_interface_field(name, sig, fd);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (intf2 != NULL) return intf2;
|
|
|
|
}
|
|
|
|
// otherwise field lookup fails
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* InstanceKlass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
|
2007-12-01 00:00:00 +00:00
|
|
|
// search order according to newest JVM spec (5.4.3.2, p.167).
|
|
|
|
// 1) search for field in current klass
|
|
|
|
if (find_local_field(name, sig, fd)) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
return const_cast<InstanceKlass*>(this);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
// 2) search for field recursively in direct superinterfaces
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
{ Klass* intf = find_interface_field(name, sig, fd);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (intf != NULL) return intf;
|
|
|
|
}
|
|
|
|
// 3) apply field lookup recursively if superclass exists
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
{ Klass* supr = super();
|
|
|
|
if (supr != NULL) return InstanceKlass::cast(supr)->find_field(name, sig, fd);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
// 4) otherwise field lookup fails
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* InstanceKlass::find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const {
|
2007-12-01 00:00:00 +00:00
|
|
|
// search order according to newest JVM spec (5.4.3.2, p.167).
|
|
|
|
// 1) search for field in current klass
|
|
|
|
if (find_local_field(name, sig, fd)) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (fd->is_static() == is_static) return const_cast<InstanceKlass*>(this);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
// 2) search for field recursively in direct superinterfaces
|
|
|
|
if (is_static) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* intf = find_interface_field(name, sig, fd);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (intf != NULL) return intf;
|
|
|
|
}
|
|
|
|
// 3) apply field lookup recursively if superclass exists
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
{ Klass* supr = super();
|
|
|
|
if (supr != NULL) return InstanceKlass::cast(supr)->find_field(name, sig, is_static, fd);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
// 4) otherwise field lookup fails
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const {
|
|
|
|
for (JavaFieldStream fs(this); !fs.done(); fs.next()) {
|
2011-09-10 17:29:02 -07:00
|
|
|
if (fs.offset() == offset) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
fd->initialize(const_cast<InstanceKlass*>(this), fs.index());
|
2007-12-01 00:00:00 +00:00
|
|
|
if (fd->is_static() == is_static) return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const {
|
|
|
|
Klass* klass = const_cast<InstanceKlass*>(this);
|
2007-12-01 00:00:00 +00:00
|
|
|
while (klass != NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (InstanceKlass::cast(klass)->find_local_field_from_offset(offset, is_static, fd)) {
|
2007-12-01 00:00:00 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
klass = Klass::cast(klass)->super();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::methods_do(void f(Method* method)) {
|
2007-12-01 00:00:00 +00:00
|
|
|
int len = methods()->length();
|
|
|
|
for (int index = 0; index < len; index++) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* m = methods()->at(index);
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(m->is_method(), "must be method");
|
|
|
|
f(m);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-18 16:00:34 -07:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::do_local_static_fields(FieldClosure* cl) {
|
2011-09-10 17:29:02 -07:00
|
|
|
for (JavaFieldStream fs(this); !fs.done(); fs.next()) {
|
|
|
|
if (fs.access_flags().is_static()) {
|
|
|
|
fieldDescriptor fd;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
fd.initialize(this, fs.index());
|
2011-09-10 17:29:02 -07:00
|
|
|
cl->do_field(&fd);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::do_local_static_fields(void f(fieldDescriptor*, TRAPS), TRAPS) {
|
|
|
|
instanceKlassHandle h_this(THREAD, this);
|
2007-12-01 00:00:00 +00:00
|
|
|
do_local_static_fields_impl(h_this, f, CHECK);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::do_local_static_fields_impl(instanceKlassHandle this_oop, void f(fieldDescriptor* fd, TRAPS), TRAPS) {
|
2011-09-10 17:29:02 -07:00
|
|
|
for (JavaFieldStream fs(this_oop()); !fs.done(); fs.next()) {
|
|
|
|
if (fs.access_flags().is_static()) {
|
|
|
|
fieldDescriptor fd;
|
|
|
|
fd.initialize(this_oop(), fs.index());
|
|
|
|
f(&fd, CHECK);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-11 11:25:13 -07:00
|
|
|
static int compare_fields_by_offset(int* a, int* b) {
|
|
|
|
return a[0] - b[0];
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::do_nonstatic_fields(FieldClosure* cl) {
|
|
|
|
InstanceKlass* super = superklass();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (super != NULL) {
|
|
|
|
super->do_nonstatic_fields(cl);
|
|
|
|
}
|
2008-03-11 11:25:13 -07:00
|
|
|
fieldDescriptor fd;
|
2011-09-10 17:29:02 -07:00
|
|
|
int length = java_fields_count();
|
2008-03-11 11:25:13 -07:00
|
|
|
// In DebugInfo nonstatic fields are sorted by offset.
|
2012-06-28 17:03:16 -04:00
|
|
|
int* fields_sorted = NEW_C_HEAP_ARRAY(int, 2*(length+1), mtClass);
|
2008-03-11 11:25:13 -07:00
|
|
|
int j = 0;
|
2011-09-10 17:29:02 -07:00
|
|
|
for (int i = 0; i < length; i += 1) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
fd.initialize(this, i);
|
2008-03-11 11:25:13 -07:00
|
|
|
if (!fd.is_static()) {
|
|
|
|
fields_sorted[j + 0] = fd.offset();
|
|
|
|
fields_sorted[j + 1] = i;
|
|
|
|
j += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (j > 0) {
|
|
|
|
length = j;
|
|
|
|
// _sort_Fn is defined in growableArray.hpp.
|
|
|
|
qsort(fields_sorted, length/2, 2*sizeof(int), (_sort_Fn)compare_fields_by_offset);
|
|
|
|
for (int i = 0; i < length; i += 2) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
fd.initialize(this, fields_sorted[i + 1]);
|
2008-03-11 11:25:13 -07:00
|
|
|
assert(!fd.is_static() && fd.offset() == fields_sorted[i], "only nonstatic fields");
|
|
|
|
cl->do_field(&fd);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2012-06-28 17:03:16 -04:00
|
|
|
FREE_C_HEAP_ARRAY(int, fields_sorted, mtClass);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::array_klasses_do(void f(Klass* k, TRAPS), TRAPS) {
|
|
|
|
if (array_klasses() != NULL)
|
2012-09-29 06:40:00 -04:00
|
|
|
ArrayKlass::cast(array_klasses())->array_klasses_do(f, THREAD);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void InstanceKlass::array_klasses_do(void f(Klass* k)) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (array_klasses() != NULL)
|
2012-09-29 06:40:00 -04:00
|
|
|
ArrayKlass::cast(array_klasses())->array_klasses_do(f);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::with_array_klasses_do(void f(Klass* k)) {
|
|
|
|
f(this);
|
2007-12-01 00:00:00 +00:00
|
|
|
array_klasses_do(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef ASSERT
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
static int linear_search(Array<Method*>* methods, Symbol* name, Symbol* signature) {
|
2007-12-01 00:00:00 +00:00
|
|
|
int len = methods->length();
|
|
|
|
for (int index = 0; index < len; index++) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* m = methods->at(index);
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(m->is_method(), "must be method");
|
|
|
|
if (m->signature() == signature && m->name() == name) {
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-10-11 12:25:42 -04:00
|
|
|
static int binary_search(Array<Method*>* methods, Symbol* name) {
|
2007-12-01 00:00:00 +00:00
|
|
|
int len = methods->length();
|
|
|
|
// methods are sorted, so do binary search
|
|
|
|
int l = 0;
|
|
|
|
int h = len - 1;
|
|
|
|
while (l <= h) {
|
|
|
|
int mid = (l + h) >> 1;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* m = methods->at(mid);
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(m->is_method(), "must be method");
|
|
|
|
int res = m->name()->fast_compare(name);
|
|
|
|
if (res == 0) {
|
2012-10-11 12:25:42 -04:00
|
|
|
return mid;
|
|
|
|
} else if (res < 0) {
|
|
|
|
l = mid + 1;
|
|
|
|
} else {
|
|
|
|
h = mid - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
Method* InstanceKlass::find_method(Symbol* name, Symbol* signature) const {
|
|
|
|
return InstanceKlass::find_method(methods(), name, signature);
|
|
|
|
}
|
|
|
|
|
|
|
|
Method* InstanceKlass::find_method(
|
|
|
|
Array<Method*>* methods, Symbol* name, Symbol* signature) {
|
|
|
|
int hit = binary_search(methods, name);
|
|
|
|
if (hit != -1) {
|
|
|
|
Method* m = methods->at(hit);
|
|
|
|
// Do linear search to find matching signature. First, quick check
|
|
|
|
// for common case
|
|
|
|
if (m->signature() == signature) return m;
|
|
|
|
// search downwards through overloaded methods
|
|
|
|
int i;
|
|
|
|
for (i = hit - 1; i >= 0; --i) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* m = methods->at(i);
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(m->is_method(), "must be method");
|
|
|
|
if (m->name() != name) break;
|
|
|
|
if (m->signature() == signature) return m;
|
2012-10-11 12:25:42 -04:00
|
|
|
}
|
|
|
|
// search upwards
|
|
|
|
for (i = hit + 1; i < methods->length(); ++i) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* m = methods->at(i);
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(m->is_method(), "must be method");
|
|
|
|
if (m->name() != name) break;
|
|
|
|
if (m->signature() == signature) return m;
|
|
|
|
}
|
2012-10-11 12:25:42 -04:00
|
|
|
// not found
|
2007-12-01 00:00:00 +00:00
|
|
|
#ifdef ASSERT
|
2012-10-11 12:25:42 -04:00
|
|
|
int index = linear_search(methods, name, signature);
|
|
|
|
assert(index == -1, err_msg("binary search should have found entry %d", index));
|
2007-12-01 00:00:00 +00:00
|
|
|
#endif
|
2012-10-11 12:25:42 -04:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-11 12:25:42 -04:00
|
|
|
int InstanceKlass::find_method_by_name(Symbol* name, int* end) {
|
|
|
|
return find_method_by_name(methods(), name, end);
|
|
|
|
}
|
|
|
|
|
|
|
|
int InstanceKlass::find_method_by_name(
|
|
|
|
Array<Method*>* methods, Symbol* name, int* end_ptr) {
|
|
|
|
assert(end_ptr != NULL, "just checking");
|
|
|
|
int start = binary_search(methods, name);
|
|
|
|
int end = start + 1;
|
|
|
|
if (start != -1) {
|
|
|
|
while (start - 1 >= 0 && (methods->at(start - 1))->name() == name) --start;
|
|
|
|
while (end < methods->length() && (methods->at(end))->name() == name) ++end;
|
|
|
|
*end_ptr = end;
|
|
|
|
return start;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const {
|
|
|
|
Klass* klass = const_cast<InstanceKlass*>(this);
|
2007-12-01 00:00:00 +00:00
|
|
|
while (klass != NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* method = InstanceKlass::cast(klass)->find_method(name, signature);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (method != NULL) return method;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
klass = InstanceKlass::cast(klass)->super();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// lookup a method in all the interfaces that this class implements
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* signature) const {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Array<Klass*>* all_ifs = transitive_interfaces();
|
2007-12-01 00:00:00 +00:00
|
|
|
int num_ifs = all_ifs->length();
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
InstanceKlass *ik = NULL;
|
2007-12-01 00:00:00 +00:00
|
|
|
for (int i = 0; i < num_ifs; i++) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
ik = InstanceKlass::cast(all_ifs->at(i));
|
|
|
|
Method* m = ik->lookup_method(name, signature);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (m != NULL) {
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* jni_id_for_impl for jfieldIds only */
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
JNIid* InstanceKlass::jni_id_for_impl(instanceKlassHandle this_oop, int offset) {
|
2007-12-01 00:00:00 +00:00
|
|
|
MutexLocker ml(JfieldIdCreation_lock);
|
|
|
|
// Retry lookup after we got the lock
|
|
|
|
JNIid* probe = this_oop->jni_ids() == NULL ? NULL : this_oop->jni_ids()->find(offset);
|
|
|
|
if (probe == NULL) {
|
|
|
|
// Slow case, allocate new static field identifier
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
probe = new JNIid(this_oop(), offset, this_oop->jni_ids());
|
2007-12-01 00:00:00 +00:00
|
|
|
this_oop->set_jni_ids(probe);
|
|
|
|
}
|
|
|
|
return probe;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* jni_id_for for jfieldIds only */
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
JNIid* InstanceKlass::jni_id_for(int offset) {
|
2007-12-01 00:00:00 +00:00
|
|
|
JNIid* probe = jni_ids() == NULL ? NULL : jni_ids()->find(offset);
|
|
|
|
if (probe == NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
probe = jni_id_for_impl(this, offset);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
return probe;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
u2 InstanceKlass::enclosing_method_data(int offset) {
|
|
|
|
Array<jushort>* inner_class_list = inner_classes();
|
2012-03-13 13:50:48 -04:00
|
|
|
if (inner_class_list == NULL) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int length = inner_class_list->length();
|
|
|
|
if (length % inner_class_next_offset == 0) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
int index = length - enclosing_method_attribute_size;
|
|
|
|
assert(offset < enclosing_method_attribute_size, "invalid offset");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
return inner_class_list->at(index + offset);
|
2012-03-13 13:50:48 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::set_enclosing_method_indices(u2 class_index,
|
2012-03-13 13:50:48 -04:00
|
|
|
u2 method_index) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Array<jushort>* inner_class_list = inner_classes();
|
2012-03-13 13:50:48 -04:00
|
|
|
assert (inner_class_list != NULL, "_inner_classes list is not set up");
|
|
|
|
int length = inner_class_list->length();
|
|
|
|
if (length % inner_class_next_offset == enclosing_method_attribute_size) {
|
|
|
|
int index = length - enclosing_method_attribute_size;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
inner_class_list->at_put(
|
2012-03-13 13:50:48 -04:00
|
|
|
index + enclosing_method_class_index_offset, class_index);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
inner_class_list->at_put(
|
2012-03-13 13:50:48 -04:00
|
|
|
index + enclosing_method_method_index_offset, method_index);
|
|
|
|
}
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Lookup or create a jmethodID.
|
2009-09-21 09:30:24 -06:00
|
|
|
// This code is called by the VMThread and JavaThreads so the
|
|
|
|
// locking has to be done very carefully to avoid deadlocks
|
|
|
|
// and/or other cache consistency problems.
|
|
|
|
//
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
jmethodID InstanceKlass::get_jmethod_id(instanceKlassHandle ik_h, methodHandle method_h) {
|
2007-12-01 00:00:00 +00:00
|
|
|
size_t idnum = (size_t)method_h->method_idnum();
|
|
|
|
jmethodID* jmeths = ik_h->methods_jmethod_ids_acquire();
|
|
|
|
size_t length = 0;
|
|
|
|
jmethodID id = NULL;
|
|
|
|
|
2009-09-21 09:30:24 -06:00
|
|
|
// We use a double-check locking idiom here because this cache is
|
|
|
|
// performance sensitive. In the normal system, this cache only
|
|
|
|
// transitions from NULL to non-NULL which is safe because we use
|
|
|
|
// release_set_methods_jmethod_ids() to advertise the new cache.
|
|
|
|
// A partially constructed cache should never be seen by a racing
|
|
|
|
// thread. We also use release_store_ptr() to save a new jmethodID
|
|
|
|
// in the cache so a partially constructed jmethodID should never be
|
|
|
|
// seen either. Cache reads of existing jmethodIDs proceed without a
|
|
|
|
// lock, but cache writes of a new jmethodID requires uniqueness and
|
|
|
|
// creation of the cache itself requires no leaks so a lock is
|
|
|
|
// generally acquired in those two cases.
|
|
|
|
//
|
|
|
|
// If the RedefineClasses() API has been used, then this cache can
|
|
|
|
// grow and we'll have transitions from non-NULL to bigger non-NULL.
|
|
|
|
// Cache creation requires no leaks and we require safety between all
|
|
|
|
// cache accesses and freeing of the old cache so a lock is generally
|
|
|
|
// acquired when the RedefineClasses() API has been used.
|
|
|
|
|
|
|
|
if (jmeths != NULL) {
|
|
|
|
// the cache already exists
|
|
|
|
if (!ik_h->idnum_can_increment()) {
|
|
|
|
// the cache can't grow so we can just get the current values
|
|
|
|
get_jmethod_id_length_value(jmeths, idnum, &length, &id);
|
|
|
|
} else {
|
|
|
|
// cache can grow so we have to be more careful
|
|
|
|
if (Threads::number_of_threads() == 0 ||
|
|
|
|
SafepointSynchronize::is_at_safepoint()) {
|
|
|
|
// we're single threaded or at a safepoint - no locking needed
|
|
|
|
get_jmethod_id_length_value(jmeths, idnum, &length, &id);
|
|
|
|
} else {
|
|
|
|
MutexLocker ml(JmethodIdCreation_lock);
|
|
|
|
get_jmethod_id_length_value(jmeths, idnum, &length, &id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// implied else:
|
|
|
|
// we need to allocate a cache so default length and id values are good
|
|
|
|
|
|
|
|
if (jmeths == NULL || // no cache yet
|
|
|
|
length <= idnum || // cache is too short
|
|
|
|
id == NULL) { // cache doesn't contain entry
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2009-09-21 09:30:24 -06:00
|
|
|
// This function can be called by the VMThread so we have to do all
|
|
|
|
// things that might block on a safepoint before grabbing the lock.
|
|
|
|
// Otherwise, we can deadlock with the VMThread or have a cache
|
|
|
|
// consistency issue. These vars keep track of what we might have
|
|
|
|
// to free after the lock is dropped.
|
|
|
|
jmethodID to_dealloc_id = NULL;
|
|
|
|
jmethodID* to_dealloc_jmeths = NULL;
|
|
|
|
|
|
|
|
// may not allocate new_jmeths or use it if we allocate it
|
2007-12-01 00:00:00 +00:00
|
|
|
jmethodID* new_jmeths = NULL;
|
|
|
|
if (length <= idnum) {
|
2009-09-21 09:30:24 -06:00
|
|
|
// allocate a new cache that might be used
|
2007-12-01 00:00:00 +00:00
|
|
|
size_t size = MAX2(idnum+1, (size_t)ik_h->idnum_allocated_count());
|
2012-06-28 17:03:16 -04:00
|
|
|
new_jmeths = NEW_C_HEAP_ARRAY(jmethodID, size+1, mtClass);
|
2007-12-01 00:00:00 +00:00
|
|
|
memset(new_jmeths, 0, (size+1)*sizeof(jmethodID));
|
2009-09-21 09:30:24 -06:00
|
|
|
// cache size is stored in element[0], other elements offset by one
|
|
|
|
new_jmeths[0] = (jmethodID)size;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2009-09-21 09:30:24 -06:00
|
|
|
// allocate a new jmethodID that might be used
|
2007-12-01 00:00:00 +00:00
|
|
|
jmethodID new_id = NULL;
|
|
|
|
if (method_h->is_old() && !method_h->is_obsolete()) {
|
|
|
|
// The method passed in is old (but not obsolete), we need to use the current version
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* current_method = ik_h->method_with_idnum((int)idnum);
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(current_method != NULL, "old and but not obsolete, so should exist");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
new_id = Method::make_jmethod_id(ik_h->class_loader_data(), current_method);
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
// It is the current version of the method or an obsolete method,
|
|
|
|
// use the version passed in
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
new_id = Method::make_jmethod_id(ik_h->class_loader_data(), method_h());
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2009-09-21 09:30:24 -06:00
|
|
|
if (Threads::number_of_threads() == 0 ||
|
|
|
|
SafepointSynchronize::is_at_safepoint()) {
|
|
|
|
// we're single threaded or at a safepoint - no locking needed
|
|
|
|
id = get_jmethod_id_fetch_or_update(ik_h, idnum, new_id, new_jmeths,
|
|
|
|
&to_dealloc_id, &to_dealloc_jmeths);
|
2008-03-12 18:09:34 -07:00
|
|
|
} else {
|
2007-12-01 00:00:00 +00:00
|
|
|
MutexLocker ml(JmethodIdCreation_lock);
|
2009-09-21 09:30:24 -06:00
|
|
|
id = get_jmethod_id_fetch_or_update(ik_h, idnum, new_id, new_jmeths,
|
|
|
|
&to_dealloc_id, &to_dealloc_jmeths);
|
|
|
|
}
|
|
|
|
|
|
|
|
// The lock has been dropped so we can free resources.
|
|
|
|
// Free up either the old cache or the new cache if we allocated one.
|
|
|
|
if (to_dealloc_jmeths != NULL) {
|
|
|
|
FreeHeap(to_dealloc_jmeths);
|
|
|
|
}
|
|
|
|
// free up the new ID since it wasn't needed
|
|
|
|
if (to_dealloc_id != NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method::destroy_jmethod_id(ik_h->class_loader_data(), to_dealloc_id);
|
2008-03-12 18:09:34 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return id;
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
|
2009-09-21 09:30:24 -06:00
|
|
|
// Common code to fetch the jmethodID from the cache or update the
|
|
|
|
// cache with the new jmethodID. This function should never do anything
|
|
|
|
// that causes the caller to go to a safepoint or we can deadlock with
|
|
|
|
// the VMThread or have cache consistency issues.
|
|
|
|
//
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
jmethodID InstanceKlass::get_jmethod_id_fetch_or_update(
|
2009-09-21 09:30:24 -06:00
|
|
|
instanceKlassHandle ik_h, size_t idnum, jmethodID new_id,
|
|
|
|
jmethodID* new_jmeths, jmethodID* to_dealloc_id_p,
|
|
|
|
jmethodID** to_dealloc_jmeths_p) {
|
|
|
|
assert(new_id != NULL, "sanity check");
|
|
|
|
assert(to_dealloc_id_p != NULL, "sanity check");
|
|
|
|
assert(to_dealloc_jmeths_p != NULL, "sanity check");
|
|
|
|
assert(Threads::number_of_threads() == 0 ||
|
|
|
|
SafepointSynchronize::is_at_safepoint() ||
|
|
|
|
JmethodIdCreation_lock->owned_by_self(), "sanity check");
|
|
|
|
|
|
|
|
// reacquire the cache - we are locked, single threaded or at a safepoint
|
2008-03-12 18:09:34 -07:00
|
|
|
jmethodID* jmeths = ik_h->methods_jmethod_ids_acquire();
|
2009-09-21 09:30:24 -06:00
|
|
|
jmethodID id = NULL;
|
|
|
|
size_t length = 0;
|
2008-03-12 18:09:34 -07:00
|
|
|
|
2009-09-21 09:30:24 -06:00
|
|
|
if (jmeths == NULL || // no cache yet
|
|
|
|
(length = (size_t)jmeths[0]) <= idnum) { // cache is too short
|
2008-03-12 18:09:34 -07:00
|
|
|
if (jmeths != NULL) {
|
2009-09-21 09:30:24 -06:00
|
|
|
// copy any existing entries from the old cache
|
2008-03-12 18:09:34 -07:00
|
|
|
for (size_t index = 0; index < length; index++) {
|
|
|
|
new_jmeths[index+1] = jmeths[index+1];
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2009-09-21 09:30:24 -06:00
|
|
|
*to_dealloc_jmeths_p = jmeths; // save old cache for later delete
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2008-03-12 18:09:34 -07:00
|
|
|
ik_h->release_set_methods_jmethod_ids(jmeths = new_jmeths);
|
|
|
|
} else {
|
2009-09-21 09:30:24 -06:00
|
|
|
// fetch jmethodID (if any) from the existing cache
|
2008-03-12 18:09:34 -07:00
|
|
|
id = jmeths[idnum+1];
|
2009-09-21 09:30:24 -06:00
|
|
|
*to_dealloc_jmeths_p = new_jmeths; // save new cache for later delete
|
2008-03-12 18:09:34 -07:00
|
|
|
}
|
|
|
|
if (id == NULL) {
|
2009-09-21 09:30:24 -06:00
|
|
|
// No matching jmethodID in the existing cache or we have a new
|
|
|
|
// cache or we just grew the cache. This cache write is done here
|
|
|
|
// by the first thread to win the foot race because a jmethodID
|
|
|
|
// needs to be unique once it is generally available.
|
2008-03-12 18:09:34 -07:00
|
|
|
id = new_id;
|
2009-09-21 09:30:24 -06:00
|
|
|
|
|
|
|
// The jmethodID cache can be read while unlocked so we have to
|
|
|
|
// make sure the new jmethodID is complete before installing it
|
|
|
|
// in the cache.
|
|
|
|
OrderAccess::release_store_ptr(&jmeths[idnum+1], id);
|
2008-03-12 18:09:34 -07:00
|
|
|
} else {
|
2009-09-21 09:30:24 -06:00
|
|
|
*to_dealloc_id_p = new_id; // save new id for later delete
|
2008-03-12 18:09:34 -07:00
|
|
|
}
|
2009-09-21 09:30:24 -06:00
|
|
|
return id;
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2009-09-21 09:30:24 -06:00
|
|
|
|
|
|
|
// Common code to get the jmethodID cache length and the jmethodID
|
|
|
|
// value at index idnum if there is one.
|
|
|
|
//
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::get_jmethod_id_length_value(jmethodID* cache,
|
2009-09-21 09:30:24 -06:00
|
|
|
size_t idnum, size_t *length_p, jmethodID* id_p) {
|
|
|
|
assert(cache != NULL, "sanity check");
|
|
|
|
assert(length_p != NULL, "sanity check");
|
|
|
|
assert(id_p != NULL, "sanity check");
|
|
|
|
|
|
|
|
// cache size is stored in element[0], other elements offset by one
|
|
|
|
*length_p = (size_t)cache[0];
|
|
|
|
if (*length_p <= idnum) { // cache is too short
|
|
|
|
*id_p = NULL;
|
|
|
|
} else {
|
|
|
|
*id_p = cache[idnum+1]; // fetch jmethodID (if any)
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Lookup a jmethodID, NULL if not found. Do no blocking, no allocations, no handles
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
jmethodID InstanceKlass::jmethod_id_or_null(Method* method) {
|
2007-12-01 00:00:00 +00:00
|
|
|
size_t idnum = (size_t)method->method_idnum();
|
|
|
|
jmethodID* jmeths = methods_jmethod_ids_acquire();
|
|
|
|
size_t length; // length assigned as debugging crumb
|
|
|
|
jmethodID id = NULL;
|
2009-09-21 09:30:24 -06:00
|
|
|
if (jmeths != NULL && // If there is a cache
|
2007-12-01 00:00:00 +00:00
|
|
|
(length = (size_t)jmeths[0]) > idnum) { // and if it is long enough,
|
|
|
|
id = jmeths[idnum+1]; // Look up the id (may be NULL)
|
|
|
|
}
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Cache an itable index
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::set_cached_itable_index(size_t idnum, int index) {
|
2007-12-01 00:00:00 +00:00
|
|
|
int* indices = methods_cached_itable_indices_acquire();
|
2009-09-21 09:30:24 -06:00
|
|
|
int* to_dealloc_indices = NULL;
|
|
|
|
|
|
|
|
// We use a double-check locking idiom here because this cache is
|
|
|
|
// performance sensitive. In the normal system, this cache only
|
|
|
|
// transitions from NULL to non-NULL which is safe because we use
|
|
|
|
// release_set_methods_cached_itable_indices() to advertise the
|
|
|
|
// new cache. A partially constructed cache should never be seen
|
|
|
|
// by a racing thread. Cache reads and writes proceed without a
|
|
|
|
// lock, but creation of the cache itself requires no leaks so a
|
|
|
|
// lock is generally acquired in that case.
|
|
|
|
//
|
|
|
|
// If the RedefineClasses() API has been used, then this cache can
|
|
|
|
// grow and we'll have transitions from non-NULL to bigger non-NULL.
|
|
|
|
// Cache creation requires no leaks and we require safety between all
|
|
|
|
// cache accesses and freeing of the old cache so a lock is generally
|
|
|
|
// acquired when the RedefineClasses() API has been used.
|
|
|
|
|
|
|
|
if (indices == NULL || idnum_can_increment()) {
|
|
|
|
// we need a cache or the cache can grow
|
2007-12-01 00:00:00 +00:00
|
|
|
MutexLocker ml(JNICachedItableIndex_lock);
|
2009-09-21 09:30:24 -06:00
|
|
|
// reacquire the cache to see if another thread already did the work
|
2007-12-01 00:00:00 +00:00
|
|
|
indices = methods_cached_itable_indices_acquire();
|
|
|
|
size_t length = 0;
|
2009-09-21 09:30:24 -06:00
|
|
|
// cache size is stored in element[0], other elements offset by one
|
2007-12-01 00:00:00 +00:00
|
|
|
if (indices == NULL || (length = (size_t)indices[0]) <= idnum) {
|
|
|
|
size_t size = MAX2(idnum+1, (size_t)idnum_allocated_count());
|
2012-06-28 17:03:16 -04:00
|
|
|
int* new_indices = NEW_C_HEAP_ARRAY(int, size+1, mtClass);
|
2009-09-21 09:30:24 -06:00
|
|
|
new_indices[0] = (int)size;
|
|
|
|
// copy any existing entries
|
2007-12-01 00:00:00 +00:00
|
|
|
size_t i;
|
|
|
|
for (i = 0; i < length; i++) {
|
|
|
|
new_indices[i+1] = indices[i+1];
|
|
|
|
}
|
|
|
|
// Set all the rest to -1
|
|
|
|
for (i = length; i < size; i++) {
|
|
|
|
new_indices[i+1] = -1;
|
|
|
|
}
|
|
|
|
if (indices != NULL) {
|
2009-09-21 09:30:24 -06:00
|
|
|
// We have an old cache to delete so save it for after we
|
|
|
|
// drop the lock.
|
|
|
|
to_dealloc_indices = indices;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
release_set_methods_cached_itable_indices(indices = new_indices);
|
|
|
|
}
|
2009-09-21 09:30:24 -06:00
|
|
|
|
|
|
|
if (idnum_can_increment()) {
|
|
|
|
// this cache can grow so we have to write to it safely
|
|
|
|
indices[idnum+1] = index;
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
|
|
|
|
}
|
2009-09-21 09:30:24 -06:00
|
|
|
|
|
|
|
if (!idnum_can_increment()) {
|
|
|
|
// The cache cannot grow and this JNI itable index value does not
|
|
|
|
// have to be unique like a jmethodID. If there is a race to set it,
|
|
|
|
// it doesn't matter.
|
|
|
|
indices[idnum+1] = index;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (to_dealloc_indices != NULL) {
|
|
|
|
// we allocated a new cache so free the old one
|
|
|
|
FreeHeap(to_dealloc_indices);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Retrieve a cached itable index
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
int InstanceKlass::cached_itable_index(size_t idnum) {
|
2007-12-01 00:00:00 +00:00
|
|
|
int* indices = methods_cached_itable_indices_acquire();
|
|
|
|
if (indices != NULL && ((size_t)indices[0]) > idnum) {
|
|
|
|
// indices exist and are long enough, retrieve possible cached
|
|
|
|
return indices[idnum+1];
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Walk the list of dependent nmethods searching for nmethods which
|
2011-08-16 04:14:05 -07:00
|
|
|
// are dependent on the changes that were passed in and mark them for
|
2007-12-01 00:00:00 +00:00
|
|
|
// deoptimization. Returns the number of nmethods found.
|
|
|
|
//
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
int InstanceKlass::mark_dependent_nmethods(DepChange& changes) {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert_locked_or_safepoint(CodeCache_lock);
|
|
|
|
int found = 0;
|
|
|
|
nmethodBucket* b = _dependencies;
|
|
|
|
while (b != NULL) {
|
|
|
|
nmethod* nm = b->get_nmethod();
|
|
|
|
// since dependencies aren't removed until an nmethod becomes a zombie,
|
|
|
|
// the dependency list may contain nmethods which aren't alive.
|
|
|
|
if (nm->is_alive() && !nm->is_marked_for_deoptimization() && nm->check_dependency_on(changes)) {
|
|
|
|
if (TraceDependencies) {
|
|
|
|
ResourceMark rm;
|
|
|
|
tty->print_cr("Marked for deoptimization");
|
|
|
|
tty->print_cr(" context = %s", this->external_name());
|
|
|
|
changes.print();
|
|
|
|
nm->print();
|
|
|
|
nm->print_dependencies();
|
|
|
|
}
|
|
|
|
nm->mark_for_deoptimization();
|
|
|
|
found++;
|
|
|
|
}
|
|
|
|
b = b->next();
|
|
|
|
}
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Add an nmethodBucket to the list of dependencies for this nmethod.
|
|
|
|
// It's possible that an nmethod has multiple dependencies on this klass
|
|
|
|
// so a count is kept for each bucket to guarantee that creation and
|
|
|
|
// deletion of dependencies is consistent.
|
|
|
|
//
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::add_dependent_nmethod(nmethod* nm) {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert_locked_or_safepoint(CodeCache_lock);
|
|
|
|
nmethodBucket* b = _dependencies;
|
|
|
|
nmethodBucket* last = NULL;
|
|
|
|
while (b != NULL) {
|
|
|
|
if (nm == b->get_nmethod()) {
|
|
|
|
b->increment();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
b = b->next();
|
|
|
|
}
|
|
|
|
_dependencies = new nmethodBucket(nm, _dependencies);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Decrement count of the nmethod in the dependency list and remove
|
|
|
|
// the bucket competely when the count goes to 0. This method must
|
|
|
|
// find a corresponding bucket otherwise there's a bug in the
|
|
|
|
// recording of dependecies.
|
|
|
|
//
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::remove_dependent_nmethod(nmethod* nm) {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert_locked_or_safepoint(CodeCache_lock);
|
|
|
|
nmethodBucket* b = _dependencies;
|
|
|
|
nmethodBucket* last = NULL;
|
|
|
|
while (b != NULL) {
|
|
|
|
if (nm == b->get_nmethod()) {
|
|
|
|
if (b->decrement() == 0) {
|
|
|
|
if (last == NULL) {
|
|
|
|
_dependencies = b->next();
|
|
|
|
} else {
|
|
|
|
last->set_next(b->next());
|
|
|
|
}
|
|
|
|
delete b;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
last = b;
|
|
|
|
b = b->next();
|
|
|
|
}
|
|
|
|
#ifdef ASSERT
|
|
|
|
tty->print_cr("### %s can't find dependent nmethod:", this->external_name());
|
|
|
|
nm->print();
|
|
|
|
#endif // ASSERT
|
|
|
|
ShouldNotReachHere();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef PRODUCT
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::print_dependent_nmethods(bool verbose) {
|
2007-12-01 00:00:00 +00:00
|
|
|
nmethodBucket* b = _dependencies;
|
|
|
|
int idx = 0;
|
|
|
|
while (b != NULL) {
|
|
|
|
nmethod* nm = b->get_nmethod();
|
|
|
|
tty->print("[%d] count=%d { ", idx++, b->count());
|
|
|
|
if (!verbose) {
|
|
|
|
nm->print_on(tty, "nmethod");
|
|
|
|
tty->print_cr(" } ");
|
|
|
|
} else {
|
|
|
|
nm->print();
|
|
|
|
nm->print_dependencies();
|
|
|
|
tty->print_cr("--- } ");
|
|
|
|
}
|
|
|
|
b = b->next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::is_dependent_nmethod(nmethod* nm) {
|
2007-12-01 00:00:00 +00:00
|
|
|
nmethodBucket* b = _dependencies;
|
|
|
|
while (b != NULL) {
|
|
|
|
if (nm == b->get_nmethod()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
b = b->next();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif //PRODUCT
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Garbage collection
|
|
|
|
|
|
|
|
void InstanceKlass::oops_do(OopClosure* cl) {
|
|
|
|
Klass::oops_do(cl);
|
|
|
|
|
|
|
|
cl->do_oop(adr_protection_domain());
|
|
|
|
cl->do_oop(adr_signers());
|
|
|
|
cl->do_oop(adr_init_lock());
|
|
|
|
|
|
|
|
// Don't walk the arrays since they are walked from the ClassLoaderData objects.
|
|
|
|
}
|
|
|
|
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
#ifdef ASSERT
|
|
|
|
template <class T> void assert_is_in(T *p) {
|
|
|
|
T heap_oop = oopDesc::load_heap_oop(p);
|
|
|
|
if (!oopDesc::is_null(heap_oop)) {
|
|
|
|
oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
|
|
|
|
assert(Universe::heap()->is_in(o), "should be in heap");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
template <class T> void assert_is_in_closed_subset(T *p) {
|
|
|
|
T heap_oop = oopDesc::load_heap_oop(p);
|
|
|
|
if (!oopDesc::is_null(heap_oop)) {
|
|
|
|
oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
assert(Universe::heap()->is_in_closed_subset(o),
|
|
|
|
err_msg("should be in closed *p " INTPTR_FORMAT " " INTPTR_FORMAT, (address)p, (address)o));
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
template <class T> void assert_is_in_reserved(T *p) {
|
|
|
|
T heap_oop = oopDesc::load_heap_oop(p);
|
|
|
|
if (!oopDesc::is_null(heap_oop)) {
|
|
|
|
oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
|
|
|
|
assert(Universe::heap()->is_in_reserved(o), "should be in reserved");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
template <class T> void assert_nothing(T *p) {}
|
|
|
|
|
|
|
|
#else
|
|
|
|
template <class T> void assert_is_in(T *p) {}
|
|
|
|
template <class T> void assert_is_in_closed_subset(T *p) {}
|
|
|
|
template <class T> void assert_is_in_reserved(T *p) {}
|
|
|
|
template <class T> void assert_nothing(T *p) {}
|
|
|
|
#endif // ASSERT
|
|
|
|
|
|
|
|
//
|
|
|
|
// Macros that iterate over areas of oops which are specialized on type of
|
|
|
|
// oop pointer either narrow or wide, depending on UseCompressedOops
|
|
|
|
//
|
|
|
|
// Parameters are:
|
|
|
|
// T - type of oop to point to (either oop or narrowOop)
|
|
|
|
// start_p - starting pointer for region to iterate over
|
|
|
|
// count - number of oops or narrowOops to iterate over
|
|
|
|
// do_oop - action to perform on each oop (it's arbitrary C code which
|
|
|
|
// makes it more efficient to put in a macro rather than making
|
|
|
|
// it a template function)
|
|
|
|
// assert_fn - assert function which is template function because performance
|
|
|
|
// doesn't matter when enabled.
|
|
|
|
#define InstanceKlass_SPECIALIZED_OOP_ITERATE( \
|
|
|
|
T, start_p, count, do_oop, \
|
|
|
|
assert_fn) \
|
|
|
|
{ \
|
|
|
|
T* p = (T*)(start_p); \
|
|
|
|
T* const end = p + (count); \
|
|
|
|
while (p < end) { \
|
|
|
|
(assert_fn)(p); \
|
|
|
|
do_oop; \
|
|
|
|
++p; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define InstanceKlass_SPECIALIZED_OOP_REVERSE_ITERATE( \
|
|
|
|
T, start_p, count, do_oop, \
|
|
|
|
assert_fn) \
|
|
|
|
{ \
|
|
|
|
T* const start = (T*)(start_p); \
|
|
|
|
T* p = start + (count); \
|
|
|
|
while (start < p) { \
|
|
|
|
--p; \
|
|
|
|
(assert_fn)(p); \
|
|
|
|
do_oop; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define InstanceKlass_SPECIALIZED_BOUNDED_OOP_ITERATE( \
|
|
|
|
T, start_p, count, low, high, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
{ \
|
|
|
|
T* const l = (T*)(low); \
|
|
|
|
T* const h = (T*)(high); \
|
|
|
|
assert(mask_bits((intptr_t)l, sizeof(T)-1) == 0 && \
|
|
|
|
mask_bits((intptr_t)h, sizeof(T)-1) == 0, \
|
|
|
|
"bounded region must be properly aligned"); \
|
|
|
|
T* p = (T*)(start_p); \
|
|
|
|
T* end = p + (count); \
|
|
|
|
if (p < l) p = l; \
|
|
|
|
if (end > h) end = h; \
|
|
|
|
while (p < end) { \
|
|
|
|
(assert_fn)(p); \
|
|
|
|
do_oop; \
|
|
|
|
++p; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// The following macros call specialized macros, passing either oop or
|
|
|
|
// narrowOop as the specialization type. These test the UseCompressedOops
|
|
|
|
// flag.
|
|
|
|
#define InstanceKlass_OOP_MAP_ITERATE(obj, do_oop, assert_fn) \
|
|
|
|
{ \
|
|
|
|
/* Compute oopmap block range. The common case \
|
|
|
|
is nonstatic_oop_map_size == 1. */ \
|
|
|
|
OopMapBlock* map = start_of_nonstatic_oop_maps(); \
|
2009-08-11 15:37:23 -07:00
|
|
|
OopMapBlock* const end_map = map + nonstatic_oop_map_count(); \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
if (UseCompressedOops) { \
|
|
|
|
while (map < end_map) { \
|
|
|
|
InstanceKlass_SPECIALIZED_OOP_ITERATE(narrowOop, \
|
2009-08-11 15:37:23 -07:00
|
|
|
obj->obj_field_addr<narrowOop>(map->offset()), map->count(), \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
do_oop, assert_fn) \
|
|
|
|
++map; \
|
|
|
|
} \
|
|
|
|
} else { \
|
|
|
|
while (map < end_map) { \
|
|
|
|
InstanceKlass_SPECIALIZED_OOP_ITERATE(oop, \
|
2009-08-11 15:37:23 -07:00
|
|
|
obj->obj_field_addr<oop>(map->offset()), map->count(), \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
do_oop, assert_fn) \
|
|
|
|
++map; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define InstanceKlass_OOP_MAP_REVERSE_ITERATE(obj, do_oop, assert_fn) \
|
|
|
|
{ \
|
|
|
|
OopMapBlock* const start_map = start_of_nonstatic_oop_maps(); \
|
2009-08-11 15:37:23 -07:00
|
|
|
OopMapBlock* map = start_map + nonstatic_oop_map_count(); \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
if (UseCompressedOops) { \
|
|
|
|
while (start_map < map) { \
|
|
|
|
--map; \
|
|
|
|
InstanceKlass_SPECIALIZED_OOP_REVERSE_ITERATE(narrowOop, \
|
2009-08-11 15:37:23 -07:00
|
|
|
obj->obj_field_addr<narrowOop>(map->offset()), map->count(), \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
do_oop, assert_fn) \
|
|
|
|
} \
|
|
|
|
} else { \
|
|
|
|
while (start_map < map) { \
|
|
|
|
--map; \
|
|
|
|
InstanceKlass_SPECIALIZED_OOP_REVERSE_ITERATE(oop, \
|
2009-08-11 15:37:23 -07:00
|
|
|
obj->obj_field_addr<oop>(map->offset()), map->count(), \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
do_oop, assert_fn) \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define InstanceKlass_BOUNDED_OOP_MAP_ITERATE(obj, low, high, do_oop, \
|
|
|
|
assert_fn) \
|
|
|
|
{ \
|
|
|
|
/* Compute oopmap block range. The common case is \
|
|
|
|
nonstatic_oop_map_size == 1, so we accept the \
|
|
|
|
usually non-existent extra overhead of examining \
|
|
|
|
all the maps. */ \
|
|
|
|
OopMapBlock* map = start_of_nonstatic_oop_maps(); \
|
2009-08-11 15:37:23 -07:00
|
|
|
OopMapBlock* const end_map = map + nonstatic_oop_map_count(); \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
if (UseCompressedOops) { \
|
|
|
|
while (map < end_map) { \
|
|
|
|
InstanceKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(narrowOop, \
|
2009-08-11 15:37:23 -07:00
|
|
|
obj->obj_field_addr<narrowOop>(map->offset()), map->count(), \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
low, high, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
++map; \
|
|
|
|
} \
|
|
|
|
} else { \
|
|
|
|
while (map < end_map) { \
|
|
|
|
InstanceKlass_SPECIALIZED_BOUNDED_OOP_ITERATE(oop, \
|
2009-08-11 15:37:23 -07:00
|
|
|
obj->obj_field_addr<oop>(map->offset()), map->count(), \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
low, high, \
|
|
|
|
do_oop, assert_fn) \
|
|
|
|
++map; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::oop_follow_contents(oop obj) {
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
assert(obj != NULL, "can't follow the content of NULL object");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
MarkSweep::follow_klass(obj->klass());
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
InstanceKlass_OOP_MAP_ITERATE( \
|
|
|
|
obj, \
|
|
|
|
MarkSweep::mark_and_push(p), \
|
|
|
|
assert_is_in_closed_subset)
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef SERIALGC
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::oop_follow_contents(ParCompactionManager* cm,
|
2007-12-01 00:00:00 +00:00
|
|
|
oop obj) {
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
assert(obj != NULL, "can't follow the content of NULL object");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
PSParallelCompact::follow_klass(cm, obj->klass());
|
|
|
|
// Only mark the header and let the scan of the meta-data mark
|
|
|
|
// everything else.
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
InstanceKlass_OOP_MAP_ITERATE( \
|
|
|
|
obj, \
|
|
|
|
PSParallelCompact::mark_and_push(cm, p), \
|
|
|
|
assert_is_in)
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
#endif // SERIALGC
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// closure's do_metadata() method dictates whether the given closure should be
|
2007-12-01 00:00:00 +00:00
|
|
|
// applied to the klass ptr in the object header.
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#define if_do_metadata_checked(closure, nv_suffix) \
|
|
|
|
/* Make sure the non-virtual and the virtual versions match. */ \
|
|
|
|
assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
|
|
|
|
"Inconsistency in do_metadata"); \
|
|
|
|
if (closure->do_metadata##nv_suffix())
|
|
|
|
|
2008-06-05 15:57:56 -07:00
|
|
|
#define InstanceKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
|
|
|
|
\
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
int InstanceKlass::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik);\
|
|
|
|
/* header */ \
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if_do_metadata_checked(closure, nv_suffix) { \
|
|
|
|
closure->do_klass##nv_suffix(obj->klass()); \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
} \
|
|
|
|
InstanceKlass_OOP_MAP_ITERATE( \
|
|
|
|
obj, \
|
|
|
|
SpecializationStats:: \
|
|
|
|
record_do_oop_call##nv_suffix(SpecializationStats::ik); \
|
|
|
|
(closure)->do_oop##nv_suffix(p), \
|
|
|
|
assert_is_in_closed_subset) \
|
|
|
|
return size_helper(); \
|
|
|
|
}
|
|
|
|
|
2008-06-05 15:57:56 -07:00
|
|
|
#ifndef SERIALGC
|
|
|
|
#define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
|
|
|
|
\
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj, \
|
2008-06-05 15:57:56 -07:00
|
|
|
OopClosureType* closure) { \
|
|
|
|
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik); \
|
|
|
|
/* header */ \
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if_do_metadata_checked(closure, nv_suffix) { \
|
|
|
|
closure->do_klass##nv_suffix(obj->klass()); \
|
2008-06-05 15:57:56 -07:00
|
|
|
} \
|
|
|
|
/* instance variables */ \
|
|
|
|
InstanceKlass_OOP_MAP_REVERSE_ITERATE( \
|
|
|
|
obj, \
|
|
|
|
SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::ik);\
|
|
|
|
(closure)->do_oop##nv_suffix(p), \
|
|
|
|
assert_is_in_closed_subset) \
|
|
|
|
return size_helper(); \
|
|
|
|
}
|
|
|
|
#endif // !SERIALGC
|
|
|
|
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
#define InstanceKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \
|
|
|
|
\
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
int InstanceKlass::oop_oop_iterate##nv_suffix##_m(oop obj, \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
OopClosureType* closure, \
|
|
|
|
MemRegion mr) { \
|
|
|
|
SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik);\
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if_do_metadata_checked(closure, nv_suffix) { \
|
|
|
|
if (mr.contains(obj)) { \
|
|
|
|
closure->do_klass##nv_suffix(obj->klass()); \
|
|
|
|
} \
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
} \
|
|
|
|
InstanceKlass_BOUNDED_OOP_MAP_ITERATE( \
|
|
|
|
obj, mr.start(), mr.end(), \
|
|
|
|
(closure)->do_oop##nv_suffix(p), \
|
|
|
|
assert_is_in_closed_subset) \
|
|
|
|
return size_helper(); \
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN)
|
2008-06-05 15:57:56 -07:00
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN)
|
2007-12-01 00:00:00 +00:00
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN_m)
|
2008-06-05 15:57:56 -07:00
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN_m)
|
|
|
|
#ifndef SERIALGC
|
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
|
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN)
|
|
|
|
#endif // !SERIALGC
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
int InstanceKlass::oop_adjust_pointers(oop obj) {
|
2007-12-01 00:00:00 +00:00
|
|
|
int size = size_helper();
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
InstanceKlass_OOP_MAP_ITERATE( \
|
|
|
|
obj, \
|
|
|
|
MarkSweep::adjust_pointer(p), \
|
|
|
|
assert_is_in)
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
MarkSweep::adjust_klass(obj->klass());
|
2007-12-01 00:00:00 +00:00
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef SERIALGC
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
InstanceKlass_OOP_MAP_REVERSE_ITERATE( \
|
|
|
|
obj, \
|
|
|
|
if (PSScavenge::should_scavenge(p)) { \
|
|
|
|
pm->claim_or_forward_depth(p); \
|
|
|
|
}, \
|
|
|
|
assert_nothing )
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
int InstanceKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
|
|
|
|
int size = size_helper();
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
InstanceKlass_OOP_MAP_ITERATE( \
|
|
|
|
obj, \
|
|
|
|
PSParallelCompact::adjust_pointer(p), \
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
assert_is_in)
|
|
|
|
obj->update_header(cm);
|
|
|
|
return size;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SERIALGC
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) {
|
|
|
|
assert(is_loader_alive(is_alive), "this klass should be live");
|
2012-03-29 22:18:56 -04:00
|
|
|
if (is_interface()) {
|
|
|
|
if (ClassUnloading) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* impl = implementor();
|
2012-03-29 22:18:56 -04:00
|
|
|
if (impl != NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (!impl->is_loader_alive(is_alive)) {
|
2012-03-29 22:18:56 -04:00
|
|
|
// remove this guy
|
2012-05-02 13:21:36 -04:00
|
|
|
*adr_implementor() = NULL;
|
2012-03-29 22:18:56 -04:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
}
|
2012-03-29 22:18:56 -04:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::clean_method_data(BoolObjectClosure* is_alive) {
|
|
|
|
#ifdef COMPILER2
|
|
|
|
// Currently only used by C2.
|
|
|
|
for (int m = 0; m < methods()->length(); m++) {
|
|
|
|
MethodData* mdo = methods()->at(m)->method_data();
|
|
|
|
if (mdo != NULL) {
|
|
|
|
for (ProfileData* data = mdo->first_data();
|
|
|
|
mdo->is_valid(data);
|
|
|
|
data = mdo->next_data(data)) {
|
|
|
|
data->clean_weak_klass_links(is_alive);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#ifdef ASSERT
|
|
|
|
// Verify that we haven't started to use MDOs for C1.
|
|
|
|
for (int m = 0; m < methods()->length(); m++) {
|
|
|
|
MethodData* mdo = methods()->at(m)->method_data();
|
|
|
|
assert(mdo == NULL, "Didn't expect C1 to use MDOs");
|
|
|
|
}
|
|
|
|
#endif // ASSERT
|
|
|
|
#endif // !COMPILER2
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
|
|
|
|
static void remove_unshareable_in_class(Klass* k) {
|
|
|
|
// remove klass's unshareable info
|
|
|
|
k->remove_unshareable_info();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InstanceKlass::remove_unshareable_info() {
|
2007-12-01 00:00:00 +00:00
|
|
|
Klass::remove_unshareable_info();
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Unlink the class
|
|
|
|
if (is_linked()) {
|
|
|
|
unlink_class();
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
init_implementor();
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
|
|
|
|
constants()->remove_unshareable_info();
|
|
|
|
|
|
|
|
for (int i = 0; i < methods()->length(); i++) {
|
|
|
|
Method* m = methods()->at(i);
|
|
|
|
m->remove_unshareable_info();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Need to reinstate when reading back the class.
|
|
|
|
set_init_lock(NULL);
|
|
|
|
|
|
|
|
// do array classes also.
|
|
|
|
array_klasses_do(remove_unshareable_in_class);
|
|
|
|
}
|
|
|
|
|
|
|
|
void restore_unshareable_in_class(Klass* k, TRAPS) {
|
|
|
|
k->restore_unshareable_info(CHECK);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InstanceKlass::restore_unshareable_info(TRAPS) {
|
|
|
|
Klass::restore_unshareable_info(CHECK);
|
|
|
|
instanceKlassHandle ik(THREAD, this);
|
|
|
|
|
|
|
|
Array<Method*>* methods = ik->methods();
|
|
|
|
int num_methods = methods->length();
|
|
|
|
for (int index2 = 0; index2 < num_methods; ++index2) {
|
|
|
|
methodHandle m(THREAD, methods->at(index2));
|
|
|
|
m()->link_method(m, CHECK);
|
2012-09-05 20:08:08 -04:00
|
|
|
// restore method's vtable by calling a virtual function
|
|
|
|
m->restore_vtable();
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
}
|
|
|
|
if (JvmtiExport::has_redefined_a_class()) {
|
|
|
|
// Reinitialize vtable because RedefineClasses may have changed some
|
|
|
|
// entries in this vtable for super classes so the CDS vtable might
|
|
|
|
// point to old or obsolete entries. RedefineClasses doesn't fix up
|
|
|
|
// vtables in the shared system dictionary, only the main one.
|
|
|
|
// It also redefines the itable too so fix that too.
|
|
|
|
ResourceMark rm(THREAD);
|
|
|
|
ik->vtable()->initialize_vtable(false, CHECK);
|
|
|
|
ik->itable()->initialize_itable(false, CHECK);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Allocate a simple java object for a lock.
|
|
|
|
// This needs to be a java object because during class initialization
|
|
|
|
// it can be held across a java call.
|
|
|
|
typeArrayOop r = oopFactory::new_typeArray(T_INT, 0, CHECK);
|
|
|
|
Handle h(THREAD, (oop)r);
|
|
|
|
ik->set_init_lock(h());
|
|
|
|
|
|
|
|
// restore constant pool resolved references
|
|
|
|
ik->constants()->restore_unshareable_info(CHECK);
|
|
|
|
|
|
|
|
ik->array_klasses_do(restore_unshareable_in_class, CHECK);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
static void clear_all_breakpoints(Method* m) {
|
2007-12-01 00:00:00 +00:00
|
|
|
m->clear_all_breakpoints();
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::release_C_heap_structures() {
|
2007-12-01 00:00:00 +00:00
|
|
|
// Deallocate oop map cache
|
|
|
|
if (_oop_map_cache != NULL) {
|
|
|
|
delete _oop_map_cache;
|
|
|
|
_oop_map_cache = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Deallocate JNI identifiers for jfieldIDs
|
|
|
|
JNIid::deallocate(jni_ids());
|
|
|
|
set_jni_ids(NULL);
|
|
|
|
|
|
|
|
jmethodID* jmeths = methods_jmethod_ids_acquire();
|
|
|
|
if (jmeths != (jmethodID*)NULL) {
|
|
|
|
release_set_methods_jmethod_ids(NULL);
|
|
|
|
FreeHeap(jmeths);
|
|
|
|
}
|
|
|
|
|
|
|
|
int* indices = methods_cached_itable_indices_acquire();
|
|
|
|
if (indices != (int*)NULL) {
|
|
|
|
release_set_methods_cached_itable_indices(NULL);
|
|
|
|
FreeHeap(indices);
|
|
|
|
}
|
|
|
|
|
|
|
|
// release dependencies
|
|
|
|
nmethodBucket* b = _dependencies;
|
|
|
|
_dependencies = NULL;
|
|
|
|
while (b != NULL) {
|
|
|
|
nmethodBucket* next = b->next();
|
|
|
|
delete b;
|
|
|
|
b = next;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Deallocate breakpoint records
|
|
|
|
if (breakpoints() != 0x0) {
|
|
|
|
methods_do(clear_all_breakpoints);
|
|
|
|
assert(breakpoints() == 0x0, "should have cleared breakpoints");
|
|
|
|
}
|
|
|
|
|
|
|
|
// deallocate information about previous versions
|
|
|
|
if (_previous_versions != NULL) {
|
|
|
|
for (int i = _previous_versions->length() - 1; i >= 0; i--) {
|
|
|
|
PreviousVersionNode * pv_node = _previous_versions->at(i);
|
|
|
|
delete pv_node;
|
|
|
|
}
|
|
|
|
delete _previous_versions;
|
|
|
|
_previous_versions = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// deallocate the cached class file
|
|
|
|
if (_cached_class_file_bytes != NULL) {
|
2012-06-28 17:03:16 -04:00
|
|
|
os::free(_cached_class_file_bytes, mtClass);
|
2007-12-01 00:00:00 +00:00
|
|
|
_cached_class_file_bytes = NULL;
|
|
|
|
_cached_class_file_len = 0;
|
|
|
|
}
|
2011-01-27 16:11:27 -08:00
|
|
|
|
|
|
|
// Decrement symbol reference counts associated with the unloaded class.
|
|
|
|
if (_name != NULL) _name->decrement_refcount();
|
|
|
|
// unreference array name derived from this class name (arrays of an unloaded
|
|
|
|
// class can't be referenced anymore).
|
|
|
|
if (_array_name != NULL) _array_name->decrement_refcount();
|
|
|
|
if (_source_file_name != NULL) _source_file_name->decrement_refcount();
|
2012-07-09 01:28:37 -07:00
|
|
|
if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass);
|
2011-01-27 16:11:27 -08:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::set_source_file_name(Symbol* n) {
|
2011-01-27 16:11:27 -08:00
|
|
|
_source_file_name = n;
|
|
|
|
if (_source_file_name != NULL) _source_file_name->increment_refcount();
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::set_source_debug_extension(char* array, int length) {
|
2012-07-09 01:28:37 -07:00
|
|
|
if (array == NULL) {
|
|
|
|
_source_debug_extension = NULL;
|
|
|
|
} else {
|
|
|
|
// Adding one to the attribute length in order to store a null terminator
|
|
|
|
// character could cause an overflow because the attribute length is
|
|
|
|
// already coded with an u4 in the classfile, but in practice, it's
|
|
|
|
// unlikely to happen.
|
|
|
|
assert((length+1) > length, "Overflow checking");
|
|
|
|
char* sde = NEW_C_HEAP_ARRAY(char, (length + 1), mtClass);
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
sde[i] = array[i];
|
|
|
|
}
|
|
|
|
sde[length] = '\0';
|
|
|
|
_source_debug_extension = sde;
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
address InstanceKlass::static_field_addr(int offset) {
|
2012-09-07 12:04:16 -04:00
|
|
|
return (address)(offset + InstanceMirrorKlass::offset_of_static_fields() + (intptr_t)java_mirror());
|
2011-03-18 16:00:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
const char* InstanceKlass::signature_name() const {
|
2007-12-01 00:00:00 +00:00
|
|
|
const char* src = (const char*) (name()->as_C_string());
|
|
|
|
const int src_length = (int)strlen(src);
|
|
|
|
char* dest = NEW_RESOURCE_ARRAY(char, src_length + 3);
|
|
|
|
int src_index = 0;
|
|
|
|
int dest_index = 0;
|
|
|
|
dest[dest_index++] = 'L';
|
|
|
|
while (src_index < src_length) {
|
|
|
|
dest[dest_index++] = src[src_index++];
|
|
|
|
}
|
|
|
|
dest[dest_index++] = ';';
|
|
|
|
dest[dest_index] = '\0';
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
// different verisons of is_same_class_package
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::is_same_class_package(Klass* class2) {
|
|
|
|
Klass* class1 = this;
|
|
|
|
oop classloader1 = InstanceKlass::cast(class1)->class_loader();
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* classname1 = Klass::cast(class1)->name();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
if (Klass::cast(class2)->oop_is_objArray()) {
|
2012-09-29 06:40:00 -04:00
|
|
|
class2 = ObjArrayKlass::cast(class2)->bottom_klass();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
oop classloader2;
|
|
|
|
if (Klass::cast(class2)->oop_is_instance()) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
classloader2 = InstanceKlass::cast(class2)->class_loader();
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
assert(Klass::cast(class2)->oop_is_typeArray(), "should be type array");
|
|
|
|
classloader2 = NULL;
|
|
|
|
}
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* classname2 = Klass::cast(class2)->name();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
return InstanceKlass::is_same_class_package(classloader1, classname1,
|
2007-12-01 00:00:00 +00:00
|
|
|
classloader2, classname2);
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::is_same_class_package(oop classloader2, Symbol* classname2) {
|
|
|
|
Klass* class1 = this;
|
|
|
|
oop classloader1 = InstanceKlass::cast(class1)->class_loader();
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* classname1 = Klass::cast(class1)->name();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
return InstanceKlass::is_same_class_package(classloader1, classname1,
|
2007-12-01 00:00:00 +00:00
|
|
|
classloader2, classname2);
|
|
|
|
}
|
|
|
|
|
|
|
|
// return true if two classes are in the same package, classloader
|
|
|
|
// and classname information is enough to determine a class's package
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::is_same_class_package(oop class_loader1, Symbol* class_name1,
|
2011-01-27 16:11:27 -08:00
|
|
|
oop class_loader2, Symbol* class_name2) {
|
2007-12-01 00:00:00 +00:00
|
|
|
if (class_loader1 != class_loader2) {
|
|
|
|
return false;
|
2009-03-20 23:19:36 -07:00
|
|
|
} else if (class_name1 == class_name2) {
|
|
|
|
return true; // skip painful bytewise comparison
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
ResourceMark rm;
|
|
|
|
|
2011-01-27 16:11:27 -08:00
|
|
|
// The Symbol*'s are in UTF8 encoding. Since we only need to check explicitly
|
2007-12-01 00:00:00 +00:00
|
|
|
// for ASCII characters ('/', 'L', '['), we can keep them in UTF8 encoding.
|
|
|
|
// Otherwise, we just compare jbyte values between the strings.
|
2011-01-27 16:11:27 -08:00
|
|
|
const jbyte *name1 = class_name1->base();
|
|
|
|
const jbyte *name2 = class_name2->base();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2011-01-27 16:11:27 -08:00
|
|
|
const jbyte *last_slash1 = UTF8::strrchr(name1, class_name1->utf8_length(), '/');
|
|
|
|
const jbyte *last_slash2 = UTF8::strrchr(name2, class_name2->utf8_length(), '/');
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
if ((last_slash1 == NULL) || (last_slash2 == NULL)) {
|
|
|
|
// One of the two doesn't have a package. Only return true
|
|
|
|
// if the other one also doesn't have a package.
|
|
|
|
return last_slash1 == last_slash2;
|
|
|
|
} else {
|
|
|
|
// Skip over '['s
|
|
|
|
if (*name1 == '[') {
|
|
|
|
do {
|
|
|
|
name1++;
|
|
|
|
} while (*name1 == '[');
|
|
|
|
if (*name1 != 'L') {
|
|
|
|
// Something is terribly wrong. Shouldn't be here.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (*name2 == '[') {
|
|
|
|
do {
|
|
|
|
name2++;
|
|
|
|
} while (*name2 == '[');
|
|
|
|
if (*name2 != 'L') {
|
|
|
|
// Something is terribly wrong. Shouldn't be here.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that package part is identical
|
|
|
|
int length1 = last_slash1 - name1;
|
|
|
|
int length2 = last_slash2 - name2;
|
|
|
|
|
|
|
|
return UTF8::equal(name1, length1, name2, length2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-18 17:20:57 -04:00
|
|
|
// Returns true iff super_method can be overridden by a method in targetclassname
|
|
|
|
// See JSL 3rd edition 8.4.6.1
|
|
|
|
// Assumes name-signature match
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// "this" is InstanceKlass of super_method which must exist
|
|
|
|
// note that the InstanceKlass of the method in the targetclassname has not always been created yet
|
|
|
|
bool InstanceKlass::is_override(methodHandle super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS) {
|
2009-03-18 17:20:57 -04:00
|
|
|
// Private methods can not be overridden
|
|
|
|
if (super_method->is_private()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// If super method is accessible, then override
|
|
|
|
if ((super_method->is_protected()) ||
|
|
|
|
(super_method->is_public())) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// Package-private methods are not inherited outside of package
|
|
|
|
assert(super_method->is_package_private(), "must be package private");
|
2011-01-27 16:11:27 -08:00
|
|
|
return(is_same_class_package(targetclassloader(), targetclassname));
|
2009-03-18 17:20:57 -04:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2009-03-20 23:19:36 -07:00
|
|
|
/* defined for now in jvm.cpp, for historical reasons *--
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* InstanceKlass::compute_enclosing_class_impl(instanceKlassHandle self,
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol*& simple_name_result, TRAPS) {
|
2009-03-20 23:19:36 -07:00
|
|
|
...
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
// tell if two classes have the same enclosing class (at package level)
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
bool InstanceKlass::is_same_package_member_impl(instanceKlassHandle class1,
|
|
|
|
Klass* class2_oop, TRAPS) {
|
|
|
|
if (class2_oop == class1()) return true;
|
2009-03-20 23:19:36 -07:00
|
|
|
if (!Klass::cast(class2_oop)->oop_is_instance()) return false;
|
|
|
|
instanceKlassHandle class2(THREAD, class2_oop);
|
|
|
|
|
|
|
|
// must be in same package before we try anything else
|
|
|
|
if (!class1->is_same_class_package(class2->class_loader(), class2->name()))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// As long as there is an outer1.getEnclosingClass,
|
|
|
|
// shift the search outward.
|
|
|
|
instanceKlassHandle outer1 = class1;
|
|
|
|
for (;;) {
|
|
|
|
// As we walk along, look for equalities between outer1 and class2.
|
|
|
|
// Eventually, the walks will terminate as outer1 stops
|
|
|
|
// at the top-level class around the original class.
|
2009-12-16 14:27:50 -08:00
|
|
|
bool ignore_inner_is_member;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* next = outer1->compute_enclosing_class(&ignore_inner_is_member,
|
2009-12-16 14:27:50 -08:00
|
|
|
CHECK_false);
|
2009-03-20 23:19:36 -07:00
|
|
|
if (next == NULL) break;
|
|
|
|
if (next == class2()) return true;
|
|
|
|
outer1 = instanceKlassHandle(THREAD, next);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Now do the same for class2.
|
|
|
|
instanceKlassHandle outer2 = class2;
|
|
|
|
for (;;) {
|
2009-12-16 14:27:50 -08:00
|
|
|
bool ignore_inner_is_member;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* next = outer2->compute_enclosing_class(&ignore_inner_is_member,
|
2009-12-16 14:27:50 -08:00
|
|
|
CHECK_false);
|
2009-03-20 23:19:36 -07:00
|
|
|
if (next == NULL) break;
|
|
|
|
// Might as well check the new outer against all available values.
|
|
|
|
if (next == class1()) return true;
|
|
|
|
if (next == outer1()) return true;
|
|
|
|
outer2 = instanceKlassHandle(THREAD, next);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If by this point we have not found an equality between the
|
|
|
|
// two classes, we know they are in separate package members.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
jint InstanceKlass::compute_modifier_flags(TRAPS) const {
|
2007-12-01 00:00:00 +00:00
|
|
|
jint access = access_flags().as_int();
|
|
|
|
|
|
|
|
// But check if it happens to be member class.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
instanceKlassHandle ik(THREAD, this);
|
2012-03-13 13:50:48 -04:00
|
|
|
InnerClassesIterator iter(ik);
|
|
|
|
for (; !iter.done(); iter.next()) {
|
|
|
|
int ioff = iter.inner_class_info_index();
|
|
|
|
// Inner class attribute can be zero, skip it.
|
|
|
|
// Strange but true: JVM spec. allows null inner class refs.
|
|
|
|
if (ioff == 0) continue;
|
|
|
|
|
|
|
|
// only look at classes that are already loaded
|
|
|
|
// since we are looking for the flags for our self.
|
|
|
|
Symbol* inner_name = ik->constants()->klass_name_at(ioff);
|
|
|
|
if ((ik->name() == inner_name)) {
|
|
|
|
// This is really a member class.
|
|
|
|
access = iter.inner_access_flags();
|
|
|
|
break;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Remember to strip ACC_SUPER bit
|
|
|
|
return (access & (~JVM_ACC_SUPER)) & JVM_ACC_WRITTEN_FLAGS;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
jint InstanceKlass::jvmti_class_status() const {
|
2007-12-01 00:00:00 +00:00
|
|
|
jint result = 0;
|
|
|
|
|
|
|
|
if (is_linked()) {
|
|
|
|
result |= JVMTI_CLASS_STATUS_VERIFIED | JVMTI_CLASS_STATUS_PREPARED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_initialized()) {
|
|
|
|
assert(is_linked(), "Class status is not consistent");
|
|
|
|
result |= JVMTI_CLASS_STATUS_INITIALIZED;
|
|
|
|
}
|
|
|
|
if (is_in_error_state()) {
|
|
|
|
result |= JVMTI_CLASS_STATUS_ERROR;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* InstanceKlass::method_at_itable(Klass* holder, int index, TRAPS) {
|
2007-12-01 00:00:00 +00:00
|
|
|
itableOffsetEntry* ioe = (itableOffsetEntry*)start_of_itable();
|
|
|
|
int method_table_offset_in_words = ioe->offset()/wordSize;
|
|
|
|
int nof_interfaces = (method_table_offset_in_words - itable_offset_in_words())
|
|
|
|
/ itableOffsetEntry::size();
|
|
|
|
|
|
|
|
for (int cnt = 0 ; ; cnt ++, ioe ++) {
|
2009-02-27 13:27:09 -08:00
|
|
|
// If the interface isn't implemented by the receiver class,
|
2007-12-01 00:00:00 +00:00
|
|
|
// the VM should throw IncompatibleClassChangeError.
|
|
|
|
if (cnt >= nof_interfaces) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
THROW_NULL(vmSymbols::java_lang_IncompatibleClassChangeError());
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* ik = ioe->interface_klass();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (ik == holder) break;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
itableMethodEntry* ime = ioe->first_method_entry(this);
|
|
|
|
Method* m = ime[index].method();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (m == NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
THROW_NULL(vmSymbols::java_lang_AbstractMethodError());
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
|
|
|
// On-stack replacement stuff
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::add_osr_nmethod(nmethod* n) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// only one compilation can be active
|
|
|
|
NEEDS_CLEANUP
|
|
|
|
// This is a short non-blocking critical region, so the no safepoint check is ok.
|
|
|
|
OsrList_lock->lock_without_safepoint_check();
|
|
|
|
assert(n->is_osr_method(), "wrong kind of nmethod");
|
2009-09-15 21:53:47 -07:00
|
|
|
n->set_osr_link(osr_nmethods_head());
|
2007-12-01 00:00:00 +00:00
|
|
|
set_osr_nmethods_head(n);
|
2010-09-03 17:51:07 -07:00
|
|
|
// Raise the highest osr level if necessary
|
|
|
|
if (TieredCompilation) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* m = n->method();
|
2010-09-03 17:51:07 -07:00
|
|
|
m->set_highest_osr_comp_level(MAX2(m->highest_osr_comp_level(), n->comp_level()));
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
// Remember to unlock again
|
|
|
|
OsrList_lock->unlock();
|
2010-09-03 17:51:07 -07:00
|
|
|
|
|
|
|
// Get rid of the osr methods for the same bci that have lower levels.
|
|
|
|
if (TieredCompilation) {
|
|
|
|
for (int l = CompLevel_limited_profile; l < n->comp_level(); l++) {
|
|
|
|
nmethod *inv = lookup_osr_nmethod(n->method(), n->osr_entry_bci(), l, true);
|
|
|
|
if (inv != NULL && inv->is_in_use()) {
|
|
|
|
inv->make_not_entrant();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::remove_osr_nmethod(nmethod* n) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// This is a short non-blocking critical region, so the no safepoint check is ok.
|
|
|
|
OsrList_lock->lock_without_safepoint_check();
|
|
|
|
assert(n->is_osr_method(), "wrong kind of nmethod");
|
|
|
|
nmethod* last = NULL;
|
|
|
|
nmethod* cur = osr_nmethods_head();
|
2010-09-03 17:51:07 -07:00
|
|
|
int max_level = CompLevel_none; // Find the max comp level excluding n
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* m = n->method();
|
2007-12-01 00:00:00 +00:00
|
|
|
// Search for match
|
|
|
|
while(cur != NULL && cur != n) {
|
2010-09-03 17:51:07 -07:00
|
|
|
if (TieredCompilation) {
|
|
|
|
// Find max level before n
|
|
|
|
max_level = MAX2(max_level, cur->comp_level());
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
last = cur;
|
2009-09-15 21:53:47 -07:00
|
|
|
cur = cur->osr_link();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2010-09-03 17:51:07 -07:00
|
|
|
nmethod* next = NULL;
|
2007-12-01 00:00:00 +00:00
|
|
|
if (cur == n) {
|
2010-09-03 17:51:07 -07:00
|
|
|
next = cur->osr_link();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (last == NULL) {
|
|
|
|
// Remove first element
|
2010-09-03 17:51:07 -07:00
|
|
|
set_osr_nmethods_head(next);
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
2010-09-03 17:51:07 -07:00
|
|
|
last->set_osr_link(next);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-15 21:53:47 -07:00
|
|
|
n->set_osr_link(NULL);
|
2010-09-03 17:51:07 -07:00
|
|
|
if (TieredCompilation) {
|
|
|
|
cur = next;
|
|
|
|
while (cur != NULL) {
|
|
|
|
// Find max level after n
|
|
|
|
max_level = MAX2(max_level, cur->comp_level());
|
|
|
|
cur = cur->osr_link();
|
|
|
|
}
|
|
|
|
m->set_highest_osr_comp_level(max_level);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
// Remember to unlock again
|
|
|
|
OsrList_lock->unlock();
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
nmethod* InstanceKlass::lookup_osr_nmethod(Method* const m, int bci, int comp_level, bool match_level) const {
|
2007-12-01 00:00:00 +00:00
|
|
|
// This is a short non-blocking critical region, so the no safepoint check is ok.
|
|
|
|
OsrList_lock->lock_without_safepoint_check();
|
|
|
|
nmethod* osr = osr_nmethods_head();
|
2010-09-03 17:51:07 -07:00
|
|
|
nmethod* best = NULL;
|
2007-12-01 00:00:00 +00:00
|
|
|
while (osr != NULL) {
|
|
|
|
assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
|
2010-09-03 17:51:07 -07:00
|
|
|
// There can be a time when a c1 osr method exists but we are waiting
|
|
|
|
// for a c2 version. When c2 completes its osr nmethod we will trash
|
|
|
|
// the c1 version and only be able to find the c2 version. However
|
|
|
|
// while we overflow in the c1 code at back branches we don't want to
|
|
|
|
// try and switch to the same code as we are already running
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
if (osr->method() == m &&
|
|
|
|
(bci == InvocationEntryBci || osr->osr_entry_bci() == bci)) {
|
2010-09-03 17:51:07 -07:00
|
|
|
if (match_level) {
|
|
|
|
if (osr->comp_level() == comp_level) {
|
|
|
|
// Found a match - return it.
|
|
|
|
OsrList_lock->unlock();
|
|
|
|
return osr;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (best == NULL || (osr->comp_level() > best->comp_level())) {
|
|
|
|
if (osr->comp_level() == CompLevel_highest_tier) {
|
|
|
|
// Found the best possible - return it.
|
|
|
|
OsrList_lock->unlock();
|
|
|
|
return osr;
|
|
|
|
}
|
|
|
|
best = osr;
|
|
|
|
}
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2009-09-15 21:53:47 -07:00
|
|
|
osr = osr->osr_link();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
OsrList_lock->unlock();
|
2010-09-03 17:51:07 -07:00
|
|
|
if (best != NULL && best->comp_level() >= comp_level && match_level == false) {
|
|
|
|
return best;
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------------------------------
|
|
|
|
// Printing
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#ifndef PRODUCT
|
|
|
|
|
2009-03-20 23:19:36 -07:00
|
|
|
#define BULLET " - "
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
static const char* state_names[] = {
|
|
|
|
"allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error"
|
|
|
|
};
|
|
|
|
|
|
|
|
void InstanceKlass::print_on(outputStream* st) const {
|
|
|
|
assert(is_klass(), "must be klass");
|
|
|
|
Klass::print_on(st);
|
|
|
|
|
|
|
|
st->print(BULLET"instance size: %d", size_helper()); st->cr();
|
|
|
|
st->print(BULLET"klass size: %d", size()); st->cr();
|
|
|
|
st->print(BULLET"access: "); access_flags().print_on(st); st->cr();
|
|
|
|
st->print(BULLET"state: "); st->print_cr(state_names[_init_state]);
|
|
|
|
st->print(BULLET"name: "); name()->print_value_on(st); st->cr();
|
|
|
|
st->print(BULLET"super: "); super()->print_value_on_maybe_null(st); st->cr();
|
|
|
|
st->print(BULLET"sub: ");
|
|
|
|
Klass* sub = subklass();
|
|
|
|
int n;
|
|
|
|
for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) {
|
|
|
|
if (n < MaxSubklassPrintSize) {
|
|
|
|
sub->print_value_on(st);
|
|
|
|
st->print(" ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (n >= MaxSubklassPrintSize) st->print("(%d more klasses...)", n - MaxSubklassPrintSize);
|
|
|
|
st->cr();
|
|
|
|
|
|
|
|
if (is_interface()) {
|
|
|
|
st->print_cr(BULLET"nof implementors: %d", nof_implementors());
|
|
|
|
if (nof_implementors() == 1) {
|
|
|
|
st->print_cr(BULLET"implementor: ");
|
|
|
|
st->print(" ");
|
|
|
|
implementor()->print_value_on(st);
|
|
|
|
st->cr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
st->print(BULLET"arrays: "); array_klasses()->print_value_on_maybe_null(st); st->cr();
|
|
|
|
st->print(BULLET"methods: "); methods()->print_value_on(st); st->cr();
|
|
|
|
if (Verbose) {
|
|
|
|
Array<Method*>* method_array = methods();
|
|
|
|
for(int i = 0; i < method_array->length(); i++) {
|
|
|
|
st->print("%d : ", i); method_array->at(i)->print_value(); st->cr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
st->print(BULLET"method ordering: "); method_ordering()->print_value_on(st); st->cr();
|
|
|
|
st->print(BULLET"local interfaces: "); local_interfaces()->print_value_on(st); st->cr();
|
|
|
|
st->print(BULLET"trans. interfaces: "); transitive_interfaces()->print_value_on(st); st->cr();
|
|
|
|
st->print(BULLET"constants: "); constants()->print_value_on(st); st->cr();
|
|
|
|
if (class_loader_data() != NULL) {
|
|
|
|
st->print(BULLET"class loader data: ");
|
|
|
|
class_loader_data()->print_value_on(st);
|
|
|
|
st->cr();
|
|
|
|
}
|
|
|
|
st->print(BULLET"protection domain: "); ((InstanceKlass*)this)->protection_domain()->print_value_on(st); st->cr();
|
|
|
|
st->print(BULLET"host class: "); host_klass()->print_value_on_maybe_null(st); st->cr();
|
|
|
|
st->print(BULLET"signers: "); signers()->print_value_on(st); st->cr();
|
|
|
|
st->print(BULLET"init_lock: "); ((oop)init_lock())->print_value_on(st); st->cr();
|
|
|
|
if (source_file_name() != NULL) {
|
|
|
|
st->print(BULLET"source file: ");
|
|
|
|
source_file_name()->print_value_on(st);
|
|
|
|
st->cr();
|
|
|
|
}
|
|
|
|
if (source_debug_extension() != NULL) {
|
|
|
|
st->print(BULLET"source debug extension: ");
|
|
|
|
st->print("%s", source_debug_extension());
|
|
|
|
st->cr();
|
|
|
|
}
|
|
|
|
st->print(BULLET"annotations: "); annotations()->print_value_on(st); st->cr();
|
|
|
|
{
|
|
|
|
ResourceMark rm;
|
|
|
|
// PreviousVersionInfo objects returned via PreviousVersionWalker
|
|
|
|
// contain a GrowableArray of handles. We have to clean up the
|
|
|
|
// GrowableArray _after_ the PreviousVersionWalker destructor
|
|
|
|
// has destroyed the handles.
|
|
|
|
{
|
|
|
|
bool have_pv = false;
|
|
|
|
PreviousVersionWalker pvw((InstanceKlass*)this);
|
|
|
|
for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
|
|
|
|
pv_info != NULL; pv_info = pvw.next_previous_version()) {
|
|
|
|
if (!have_pv)
|
|
|
|
st->print(BULLET"previous version: ");
|
|
|
|
have_pv = true;
|
|
|
|
pv_info->prev_constant_pool_handle()()->print_value_on(st);
|
|
|
|
}
|
|
|
|
if (have_pv) st->cr();
|
|
|
|
} // pvw is cleaned up
|
|
|
|
} // rm is cleaned up
|
|
|
|
|
|
|
|
if (generic_signature() != NULL) {
|
|
|
|
st->print(BULLET"generic signature: ");
|
|
|
|
generic_signature()->print_value_on(st);
|
|
|
|
st->cr();
|
|
|
|
}
|
|
|
|
st->print(BULLET"inner classes: "); inner_classes()->print_value_on(st); st->cr();
|
|
|
|
st->print(BULLET"java mirror: "); java_mirror()->print_value_on(st); st->cr();
|
|
|
|
st->print(BULLET"vtable length %d (start addr: " INTPTR_FORMAT ")", vtable_length(), start_of_vtable()); st->cr();
|
|
|
|
st->print(BULLET"itable length %d (start addr: " INTPTR_FORMAT ")", itable_length(), start_of_itable()); st->cr();
|
|
|
|
st->print_cr(BULLET"---- static fields (%d words):", static_field_size());
|
|
|
|
FieldPrinter print_static_field(st);
|
|
|
|
((InstanceKlass*)this)->do_local_static_fields(&print_static_field);
|
|
|
|
st->print_cr(BULLET"---- non-static fields (%d words):", nonstatic_field_size());
|
|
|
|
FieldPrinter print_nonstatic_field(st);
|
|
|
|
((InstanceKlass*)this)->do_nonstatic_fields(&print_nonstatic_field);
|
|
|
|
|
|
|
|
st->print(BULLET"non-static oop maps: ");
|
|
|
|
OopMapBlock* map = start_of_nonstatic_oop_maps();
|
|
|
|
OopMapBlock* end_map = map + nonstatic_oop_map_count();
|
|
|
|
while (map < end_map) {
|
|
|
|
st->print("%d-%d ", map->offset(), map->offset() + heapOopSize*(map->count() - 1));
|
|
|
|
map++;
|
|
|
|
}
|
|
|
|
st->cr();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //PRODUCT
|
|
|
|
|
|
|
|
void InstanceKlass::print_value_on(outputStream* st) const {
|
|
|
|
assert(is_klass(), "must be klass");
|
|
|
|
name()->print_value_on(st);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
void FieldPrinter::do_field(fieldDescriptor* fd) {
|
2009-03-20 23:19:36 -07:00
|
|
|
_st->print(BULLET);
|
2011-03-18 16:00:34 -07:00
|
|
|
if (_obj == NULL) {
|
2007-12-01 00:00:00 +00:00
|
|
|
fd->print_on(_st);
|
|
|
|
_st->cr();
|
|
|
|
} else {
|
|
|
|
fd->print_on_for(_st, _obj);
|
|
|
|
_st->cr();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::oop_print_on(oop obj, outputStream* st) {
|
2007-12-01 00:00:00 +00:00
|
|
|
Klass::oop_print_on(obj, st);
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (this == SystemDictionary::String_klass()) {
|
2007-12-01 00:00:00 +00:00
|
|
|
typeArrayOop value = java_lang_String::value(obj);
|
|
|
|
juint offset = java_lang_String::offset(obj);
|
|
|
|
juint length = java_lang_String::length(obj);
|
|
|
|
if (value != NULL &&
|
|
|
|
value->is_typeArray() &&
|
|
|
|
offset <= (juint) value->length() &&
|
|
|
|
offset + length <= (juint) value->length()) {
|
2009-03-20 23:19:36 -07:00
|
|
|
st->print(BULLET"string: ");
|
2007-12-01 00:00:00 +00:00
|
|
|
Handle h_obj(obj);
|
|
|
|
java_lang_String::print(h_obj, st);
|
|
|
|
st->cr();
|
|
|
|
if (!WizardMode) return; // that is enough
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-20 23:19:36 -07:00
|
|
|
st->print_cr(BULLET"---- fields (total size %d words):", oop_size(obj));
|
2011-03-18 16:00:34 -07:00
|
|
|
FieldPrinter print_field(st, obj);
|
|
|
|
do_nonstatic_fields(&print_field);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (this == SystemDictionary::Class_klass()) {
|
2009-03-20 23:19:36 -07:00
|
|
|
st->print(BULLET"signature: ");
|
|
|
|
java_lang_Class::print_signature(obj, st);
|
|
|
|
st->cr();
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* mirrored_klass = java_lang_Class::as_Klass(obj);
|
2009-03-20 23:19:36 -07:00
|
|
|
st->print(BULLET"fake entry for mirror: ");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
mirrored_klass->print_value_on_maybe_null(st);
|
2007-12-01 00:00:00 +00:00
|
|
|
st->cr();
|
2009-03-20 23:19:36 -07:00
|
|
|
st->print(BULLET"fake entry resolved_constructor: ");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* ctor = java_lang_Class::resolved_constructor(obj);
|
|
|
|
ctor->print_value_on_maybe_null(st);
|
|
|
|
Klass* array_klass = java_lang_Class::array_klass(obj);
|
2007-12-01 00:00:00 +00:00
|
|
|
st->cr();
|
2009-03-20 23:19:36 -07:00
|
|
|
st->print(BULLET"fake entry for array: ");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
array_klass->print_value_on_maybe_null(st);
|
2007-12-01 00:00:00 +00:00
|
|
|
st->cr();
|
2011-03-18 16:00:34 -07:00
|
|
|
st->print_cr(BULLET"fake entry for oop_size: %d", java_lang_Class::oop_size(obj));
|
|
|
|
st->print_cr(BULLET"fake entry for static_oop_field_count: %d", java_lang_Class::static_oop_field_count(obj));
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Klass* real_klass = java_lang_Class::as_Klass(obj);
|
|
|
|
if (real_klass != NULL && real_klass->oop_is_instance()) {
|
|
|
|
InstanceKlass::cast(real_klass)->do_local_static_fields(&print_field);
|
2011-03-18 16:00:34 -07:00
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
} else if (this == SystemDictionary::MethodType_klass()) {
|
2009-10-17 19:51:05 -07:00
|
|
|
st->print(BULLET"signature: ");
|
2011-03-11 22:34:57 -08:00
|
|
|
java_lang_invoke_MethodType::print_signature(obj, st);
|
2009-10-17 19:51:05 -07:00
|
|
|
st->cr();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-08 13:47:01 -08:00
|
|
|
#endif //PRODUCT
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::oop_print_value_on(oop obj, outputStream* st) {
|
2007-12-01 00:00:00 +00:00
|
|
|
st->print("a ");
|
|
|
|
name()->print_value_on(st);
|
|
|
|
obj->print_address_on(st);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (this == SystemDictionary::String_klass()
|
2009-03-20 23:19:36 -07:00
|
|
|
&& java_lang_String::value(obj) != NULL) {
|
|
|
|
ResourceMark rm;
|
|
|
|
int len = java_lang_String::length(obj);
|
|
|
|
int plen = (len < 24 ? len : 12);
|
|
|
|
char* str = java_lang_String::as_utf8_string(obj, 0, plen);
|
|
|
|
st->print(" = \"%s\"", str);
|
|
|
|
if (len > plen)
|
|
|
|
st->print("...[%d]", len);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
} else if (this == SystemDictionary::Class_klass()) {
|
|
|
|
Klass* k = java_lang_Class::as_Klass(obj);
|
2009-03-20 23:19:36 -07:00
|
|
|
st->print(" = ");
|
|
|
|
if (k != NULL) {
|
|
|
|
k->print_value_on(st);
|
|
|
|
} else {
|
|
|
|
const char* tname = type2name(java_lang_Class::primitive_type(obj));
|
|
|
|
st->print("%s", tname ? tname : "type?");
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
} else if (this == SystemDictionary::MethodType_klass()) {
|
2009-10-17 19:51:05 -07:00
|
|
|
st->print(" = ");
|
2011-03-11 22:34:57 -08:00
|
|
|
java_lang_invoke_MethodType::print_signature(obj, st);
|
2009-03-20 23:19:36 -07:00
|
|
|
} else if (java_lang_boxing_object::is_instance(obj)) {
|
|
|
|
st->print(" = ");
|
|
|
|
java_lang_boxing_object::print(obj, st);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
} else if (this == SystemDictionary::LambdaForm_klass()) {
|
2012-07-24 10:51:00 -07:00
|
|
|
oop vmentry = java_lang_invoke_LambdaForm::vmentry(obj);
|
|
|
|
if (vmentry != NULL) {
|
|
|
|
st->print(" => ");
|
|
|
|
vmentry->print_value_on(st);
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
} else if (this == SystemDictionary::MemberName_klass()) {
|
|
|
|
Metadata* vmtarget = java_lang_invoke_MemberName::vmtarget(obj);
|
2012-07-24 10:51:00 -07:00
|
|
|
if (vmtarget != NULL) {
|
|
|
|
st->print(" = ");
|
|
|
|
vmtarget->print_value_on(st);
|
|
|
|
} else {
|
|
|
|
java_lang_invoke_MemberName::clazz(obj)->print_value_on(st);
|
|
|
|
st->print(".");
|
|
|
|
java_lang_invoke_MemberName::name(obj)->print_value_on(st);
|
|
|
|
}
|
2009-03-20 23:19:36 -07:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
const char* InstanceKlass::internal_name() const {
|
2007-12-01 00:00:00 +00:00
|
|
|
return external_name();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verification
|
|
|
|
|
|
|
|
class VerifyFieldClosure: public OopClosure {
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
protected:
|
|
|
|
template <class T> void do_oop_work(T* p) {
|
|
|
|
oop obj = oopDesc::load_decode_heap_oop(p);
|
|
|
|
if (!obj->is_oop_or_null()) {
|
|
|
|
tty->print_cr("Failed: " PTR_FORMAT " -> " PTR_FORMAT, p, (address)obj);
|
2007-12-01 00:00:00 +00:00
|
|
|
Universe::print();
|
|
|
|
guarantee(false, "boom");
|
|
|
|
}
|
|
|
|
}
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
public:
|
|
|
|
virtual void do_oop(oop* p) { VerifyFieldClosure::do_oop_work(p); }
|
|
|
|
virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); }
|
2007-12-01 00:00:00 +00:00
|
|
|
};
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::verify_on(outputStream* st) {
|
|
|
|
Klass::verify_on(st);
|
|
|
|
Thread *thread = Thread::current();
|
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
// Avoid redundant verifies
|
|
|
|
if (_verify_count == Universe::verify_count()) return;
|
|
|
|
_verify_count = Universe::verify_count();
|
|
|
|
#endif
|
|
|
|
// Verify that klass is present in SystemDictionary
|
|
|
|
if (is_loaded() && !is_anonymous()) {
|
|
|
|
Symbol* h_name = name();
|
|
|
|
SystemDictionary::verify_obj_klass_present(h_name, class_loader_data());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify static fields
|
|
|
|
VerifyFieldClosure blk;
|
|
|
|
|
|
|
|
// Verify vtables
|
|
|
|
if (is_linked()) {
|
|
|
|
ResourceMark rm(thread);
|
|
|
|
// $$$ This used to be done only for m/s collections. Doing it
|
|
|
|
// always seemed a valid generalization. (DLD -- 6/00)
|
|
|
|
vtable()->verify(st);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify first subklass
|
|
|
|
if (subklass_oop() != NULL) {
|
|
|
|
guarantee(subklass_oop()->is_metadata(), "should be in metaspace");
|
|
|
|
guarantee(subklass_oop()->is_klass(), "should be klass");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify siblings
|
|
|
|
Klass* super = this->super();
|
|
|
|
Klass* sib = next_sibling();
|
|
|
|
if (sib != NULL) {
|
|
|
|
if (sib == this) {
|
|
|
|
fatal(err_msg("subclass points to itself " PTR_FORMAT, sib));
|
|
|
|
}
|
|
|
|
|
|
|
|
guarantee(sib->is_metadata(), "should be in metaspace");
|
|
|
|
guarantee(sib->is_klass(), "should be klass");
|
|
|
|
guarantee(sib->super() == super, "siblings should have same superklass");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify implementor fields
|
|
|
|
Klass* im = implementor();
|
|
|
|
if (im != NULL) {
|
|
|
|
guarantee(is_interface(), "only interfaces should have implementor set");
|
|
|
|
guarantee(im->is_klass(), "should be klass");
|
|
|
|
guarantee(!Klass::cast(im)->is_interface() || im == this,
|
|
|
|
"implementors cannot be interfaces");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify local interfaces
|
|
|
|
if (local_interfaces()) {
|
|
|
|
Array<Klass*>* local_interfaces = this->local_interfaces();
|
|
|
|
for (int j = 0; j < local_interfaces->length(); j++) {
|
|
|
|
Klass* e = local_interfaces->at(j);
|
|
|
|
guarantee(e->is_klass() && Klass::cast(e)->is_interface(), "invalid local interface");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify transitive interfaces
|
|
|
|
if (transitive_interfaces() != NULL) {
|
|
|
|
Array<Klass*>* transitive_interfaces = this->transitive_interfaces();
|
|
|
|
for (int j = 0; j < transitive_interfaces->length(); j++) {
|
|
|
|
Klass* e = transitive_interfaces->at(j);
|
|
|
|
guarantee(e->is_klass() && Klass::cast(e)->is_interface(), "invalid transitive interface");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify methods
|
|
|
|
if (methods() != NULL) {
|
|
|
|
Array<Method*>* methods = this->methods();
|
|
|
|
for (int j = 0; j < methods->length(); j++) {
|
|
|
|
guarantee(methods->at(j)->is_metadata(), "should be in metaspace");
|
|
|
|
guarantee(methods->at(j)->is_method(), "non-method in methods array");
|
|
|
|
}
|
|
|
|
for (int j = 0; j < methods->length() - 1; j++) {
|
|
|
|
Method* m1 = methods->at(j);
|
|
|
|
Method* m2 = methods->at(j + 1);
|
|
|
|
guarantee(m1->name()->fast_compare(m2->name()) <= 0, "methods not sorted correctly");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify method ordering
|
|
|
|
if (method_ordering() != NULL) {
|
|
|
|
Array<int>* method_ordering = this->method_ordering();
|
|
|
|
int length = method_ordering->length();
|
|
|
|
if (JvmtiExport::can_maintain_original_method_order() ||
|
|
|
|
(UseSharedSpaces && length != 0)) {
|
|
|
|
guarantee(length == methods()->length(), "invalid method ordering length");
|
|
|
|
jlong sum = 0;
|
|
|
|
for (int j = 0; j < length; j++) {
|
|
|
|
int original_index = method_ordering->at(j);
|
|
|
|
guarantee(original_index >= 0, "invalid method ordering index");
|
|
|
|
guarantee(original_index < length, "invalid method ordering index");
|
|
|
|
sum += original_index;
|
|
|
|
}
|
|
|
|
// Verify sum of indices 0,1,...,length-1
|
|
|
|
guarantee(sum == ((jlong)length*(length-1))/2, "invalid method ordering sum");
|
|
|
|
} else {
|
|
|
|
guarantee(length == 0, "invalid method ordering length");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify JNI static field identifiers
|
|
|
|
if (jni_ids() != NULL) {
|
|
|
|
jni_ids()->verify(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify other fields
|
|
|
|
if (array_klasses() != NULL) {
|
|
|
|
guarantee(array_klasses()->is_metadata(), "should be in metaspace");
|
|
|
|
guarantee(array_klasses()->is_klass(), "should be klass");
|
|
|
|
}
|
|
|
|
if (constants() != NULL) {
|
|
|
|
guarantee(constants()->is_metadata(), "should be in metaspace");
|
|
|
|
guarantee(constants()->is_constantPool(), "should be constant pool");
|
|
|
|
}
|
|
|
|
if (protection_domain() != NULL) {
|
|
|
|
guarantee(protection_domain()->is_oop(), "should be oop");
|
|
|
|
}
|
|
|
|
if (host_klass() != NULL) {
|
|
|
|
guarantee(host_klass()->is_metadata(), "should be in metaspace");
|
|
|
|
guarantee(host_klass()->is_klass(), "should be klass");
|
|
|
|
}
|
|
|
|
if (signers() != NULL) {
|
|
|
|
guarantee(signers()->is_objArray(), "should be obj array");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void InstanceKlass::oop_verify_on(oop obj, outputStream* st) {
|
2007-12-01 00:00:00 +00:00
|
|
|
Klass::oop_verify_on(obj, st);
|
|
|
|
VerifyFieldClosure blk;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
obj->oop_iterate_no_header(&blk);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
// JNIid class for jfieldIDs only
|
|
|
|
// Note to reviewers:
|
|
|
|
// These JNI functions are just moved over to column 1 and not changed
|
|
|
|
// in the compressed oops workspace.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
JNIid::JNIid(Klass* holder, int offset, JNIid* next) {
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
_holder = holder;
|
|
|
|
_offset = offset;
|
|
|
|
_next = next;
|
|
|
|
debug_only(_is_static_field_id = false;)
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
JNIid* JNIid::find(int offset) {
|
|
|
|
JNIid* current = this;
|
|
|
|
while (current != NULL) {
|
|
|
|
if (current->offset() == offset) return current;
|
|
|
|
current = current->next();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
void JNIid::deallocate(JNIid* current) {
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
while (current != NULL) {
|
|
|
|
JNIid* next = current->next();
|
|
|
|
delete current;
|
|
|
|
current = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void JNIid::verify(Klass* holder) {
|
2012-09-07 12:04:16 -04:00
|
|
|
int first_field_offset = InstanceMirrorKlass::offset_of_static_fields();
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
int end_field_offset;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
end_field_offset = first_field_offset + (InstanceKlass::cast(holder)->static_field_size() * wordSize);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
JNIid* current = this;
|
|
|
|
while (current != NULL) {
|
|
|
|
guarantee(current->holder() == holder, "Invalid klass in JNIid");
|
2007-12-01 00:00:00 +00:00
|
|
|
#ifdef ASSERT
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
int o = current->offset();
|
|
|
|
if (current->is_static_field_id()) {
|
|
|
|
guarantee(o >= first_field_offset && o < end_field_offset, "Invalid static field offset in JNIid");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
current = current->next();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ASSERT
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::set_init_state(ClassState state) {
|
|
|
|
bool good_state = is_shared() ? (_init_state <= state)
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
: (_init_state < state);
|
|
|
|
assert(good_state || state == allocated, "illegal state transition");
|
2011-12-06 18:28:51 -05:00
|
|
|
_init_state = (u1)state;
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// RedefineClasses() support for previous versions:
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Purge previous versions
|
|
|
|
static void purge_previous_versions_internal(InstanceKlass* ik, int emcp_method_count) {
|
|
|
|
if (ik->previous_versions() != NULL) {
|
|
|
|
// This klass has previous versions so see what we can cleanup
|
|
|
|
// while it is safe to do so.
|
|
|
|
|
|
|
|
int deleted_count = 0; // leave debugging breadcrumbs
|
|
|
|
int live_count = 0;
|
|
|
|
ClassLoaderData* loader_data = ik->class_loader_data() == NULL ?
|
|
|
|
ClassLoaderData::the_null_class_loader_data() :
|
|
|
|
ik->class_loader_data();
|
|
|
|
|
|
|
|
// RC_TRACE macro has an embedded ResourceMark
|
|
|
|
RC_TRACE(0x00000200, ("purge: %s: previous version length=%d",
|
|
|
|
ik->external_name(), ik->previous_versions()->length()));
|
|
|
|
|
|
|
|
for (int i = ik->previous_versions()->length() - 1; i >= 0; i--) {
|
|
|
|
// check the previous versions array
|
|
|
|
PreviousVersionNode * pv_node = ik->previous_versions()->at(i);
|
|
|
|
ConstantPool* cp_ref = pv_node->prev_constant_pool();
|
|
|
|
assert(cp_ref != NULL, "cp ref was unexpectedly cleared");
|
|
|
|
|
|
|
|
ConstantPool* pvcp = cp_ref;
|
|
|
|
if (!pvcp->on_stack()) {
|
|
|
|
// If the constant pool isn't on stack, none of the methods
|
|
|
|
// are executing. Delete all the methods, the constant pool and
|
|
|
|
// and this previous version node.
|
|
|
|
GrowableArray<Method*>* method_refs = pv_node->prev_EMCP_methods();
|
|
|
|
if (method_refs != NULL) {
|
|
|
|
for (int j = method_refs->length() - 1; j >= 0; j--) {
|
|
|
|
Method* method = method_refs->at(j);
|
|
|
|
assert(method != NULL, "method ref was unexpectedly cleared");
|
|
|
|
method_refs->remove_at(j);
|
|
|
|
// method will be freed with associated class.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Remove the constant pool
|
|
|
|
delete pv_node;
|
|
|
|
// Since we are traversing the array backwards, we don't have to
|
|
|
|
// do anything special with the index.
|
|
|
|
ik->previous_versions()->remove_at(i);
|
|
|
|
deleted_count++;
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
RC_TRACE(0x00000200, ("purge: previous version @%d is alive", i));
|
|
|
|
assert(pvcp->pool_holder() != NULL, "Constant pool with no holder");
|
|
|
|
guarantee (!loader_data->is_unloading(), "unloaded classes can't be on the stack");
|
|
|
|
live_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// At least one method is live in this previous version, clean out
|
|
|
|
// the others or mark them as obsolete.
|
|
|
|
GrowableArray<Method*>* method_refs = pv_node->prev_EMCP_methods();
|
|
|
|
if (method_refs != NULL) {
|
|
|
|
RC_TRACE(0x00000200, ("purge: previous methods length=%d",
|
|
|
|
method_refs->length()));
|
|
|
|
for (int j = method_refs->length() - 1; j >= 0; j--) {
|
|
|
|
Method* method = method_refs->at(j);
|
|
|
|
assert(method != NULL, "method ref was unexpectedly cleared");
|
|
|
|
|
|
|
|
// Remove the emcp method if it's not executing
|
|
|
|
// If it's been made obsolete by a redefinition of a non-emcp
|
|
|
|
// method, mark it as obsolete but leave it to clean up later.
|
|
|
|
if (!method->on_stack()) {
|
|
|
|
method_refs->remove_at(j);
|
|
|
|
} else if (emcp_method_count == 0) {
|
|
|
|
method->set_is_obsolete();
|
|
|
|
} else {
|
|
|
|
// RC_TRACE macro has an embedded ResourceMark
|
|
|
|
RC_TRACE(0x00000200,
|
|
|
|
("purge: %s(%s): prev method @%d in version @%d is alive",
|
|
|
|
method->name()->as_C_string(),
|
|
|
|
method->signature()->as_C_string(), j, i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assert(ik->previous_versions()->length() == live_count, "sanity check");
|
|
|
|
RC_TRACE(0x00000200,
|
|
|
|
("purge: previous version stats: live=%d, deleted=%d", live_count,
|
|
|
|
deleted_count));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// External interface for use during class unloading.
|
|
|
|
void InstanceKlass::purge_previous_versions(InstanceKlass* ik) {
|
|
|
|
// Call with >0 emcp methods since they are not currently being redefined.
|
|
|
|
purge_previous_versions_internal(ik, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Potentially add an information node that contains pointers to the
|
2007-12-01 00:00:00 +00:00
|
|
|
// interesting parts of the previous version of the_class.
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// This is also where we clean out any unused references.
|
2009-09-21 09:30:24 -06:00
|
|
|
// Note that while we delete nodes from the _previous_versions
|
|
|
|
// array, we never delete the array itself until the klass is
|
|
|
|
// unloaded. The has_been_redefined() query depends on that fact.
|
|
|
|
//
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
void InstanceKlass::add_previous_version(instanceKlassHandle ikh,
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
BitMap* emcp_methods, int emcp_method_count) {
|
2007-12-01 00:00:00 +00:00
|
|
|
assert(Thread::current()->is_VM_thread(),
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
"only VMThread can add previous versions");
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
if (_previous_versions == NULL) {
|
|
|
|
// This is the first previous version so make some space.
|
|
|
|
// Start with 2 elements under the assumption that the class
|
|
|
|
// won't be redefined much.
|
2012-06-28 17:03:16 -04:00
|
|
|
_previous_versions = new (ResourceObj::C_HEAP, mtClass)
|
2007-12-01 00:00:00 +00:00
|
|
|
GrowableArray<PreviousVersionNode *>(2, true);
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
ConstantPool* cp_ref = ikh->constants();
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// RC_TRACE macro has an embedded ResourceMark
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
RC_TRACE(0x00000400, ("adding previous version ref for %s @%d, EMCP_cnt=%d "
|
|
|
|
"on_stack=%d",
|
|
|
|
ikh->external_name(), _previous_versions->length(), emcp_method_count,
|
|
|
|
cp_ref->on_stack()));
|
|
|
|
|
|
|
|
// If the constant pool for this previous version of the class
|
|
|
|
// is not marked as being on the stack, then none of the methods
|
|
|
|
// in this previous version of the class are on the stack so
|
|
|
|
// we don't need to create a new PreviousVersionNode. However,
|
|
|
|
// we still need to examine older previous versions below.
|
|
|
|
Array<Method*>* old_methods = ikh->methods();
|
|
|
|
|
|
|
|
if (cp_ref->on_stack()) {
|
2007-12-01 00:00:00 +00:00
|
|
|
PreviousVersionNode * pv_node = NULL;
|
|
|
|
if (emcp_method_count == 0) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// non-shared ConstantPool gets a reference
|
|
|
|
pv_node = new PreviousVersionNode(cp_ref, !cp_ref->is_shared(), NULL);
|
2007-12-01 00:00:00 +00:00
|
|
|
RC_TRACE(0x00000400,
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
("add: all methods are obsolete; flushing any EMCP refs"));
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
int local_count = 0;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
GrowableArray<Method*>* method_refs = new (ResourceObj::C_HEAP, mtClass)
|
|
|
|
GrowableArray<Method*>(emcp_method_count, true);
|
2007-12-01 00:00:00 +00:00
|
|
|
for (int i = 0; i < old_methods->length(); i++) {
|
|
|
|
if (emcp_methods->at(i)) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// this old method is EMCP. Save it only if it's on the stack
|
|
|
|
Method* old_method = old_methods->at(i);
|
|
|
|
if (old_method->on_stack()) {
|
|
|
|
method_refs->append(old_method);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
if (++local_count >= emcp_method_count) {
|
|
|
|
// no more EMCP methods so bail out now
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// non-shared ConstantPool gets a reference
|
|
|
|
pv_node = new PreviousVersionNode(cp_ref, !cp_ref->is_shared(), method_refs);
|
|
|
|
}
|
|
|
|
// append new previous version.
|
2007-12-01 00:00:00 +00:00
|
|
|
_previous_versions->append(pv_node);
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Since the caller is the VMThread and we are at a safepoint, this
|
|
|
|
// is a good time to clear out unused references.
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
RC_TRACE(0x00000400, ("add: previous version length=%d",
|
|
|
|
_previous_versions->length()));
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Purge previous versions not executing on the stack
|
|
|
|
purge_previous_versions_internal(this, emcp_method_count);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
int obsolete_method_count = old_methods->length() - emcp_method_count;
|
|
|
|
|
|
|
|
if (emcp_method_count != 0 && obsolete_method_count != 0 &&
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
_previous_versions->length() > 0) {
|
|
|
|
// We have a mix of obsolete and EMCP methods so we have to
|
2007-12-01 00:00:00 +00:00
|
|
|
// clear out any matching EMCP method entries the hard way.
|
|
|
|
int local_count = 0;
|
|
|
|
for (int i = 0; i < old_methods->length(); i++) {
|
|
|
|
if (!emcp_methods->at(i)) {
|
|
|
|
// only obsolete methods are interesting
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* old_method = old_methods->at(i);
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* m_name = old_method->name();
|
|
|
|
Symbol* m_signature = old_method->signature();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// we might not have added the last entry
|
|
|
|
for (int j = _previous_versions->length() - 1; j >= 0; j--) {
|
|
|
|
// check the previous versions array for non executing obsolete methods
|
|
|
|
PreviousVersionNode * pv_node = _previous_versions->at(j);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
GrowableArray<Method*>* method_refs = pv_node->prev_EMCP_methods();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (method_refs == NULL) {
|
|
|
|
// We have run into a PreviousVersion generation where
|
|
|
|
// all methods were made obsolete during that generation's
|
|
|
|
// RedefineClasses() operation. At the time of that
|
|
|
|
// operation, all EMCP methods were flushed so we don't
|
|
|
|
// have to go back any further.
|
|
|
|
//
|
|
|
|
// A NULL method_refs is different than an empty method_refs.
|
|
|
|
// We cannot infer any optimizations about older generations
|
|
|
|
// from an empty method_refs for the current generation.
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int k = method_refs->length() - 1; k >= 0; k--) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* method = method_refs->at(k);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
if (!method->is_obsolete() &&
|
|
|
|
method->name() == m_name &&
|
2007-12-01 00:00:00 +00:00
|
|
|
method->signature() == m_signature) {
|
|
|
|
// The current RedefineClasses() call has made all EMCP
|
|
|
|
// versions of this method obsolete so mark it as obsolete
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// and remove the reference.
|
2007-12-01 00:00:00 +00:00
|
|
|
RC_TRACE(0x00000400,
|
|
|
|
("add: %s(%s): flush obsolete method @%d in version @%d",
|
|
|
|
m_name->as_C_string(), m_signature->as_C_string(), k, j));
|
|
|
|
|
|
|
|
method->set_is_obsolete();
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Leave obsolete methods on the previous version list to
|
|
|
|
// clean up later.
|
2007-12-01 00:00:00 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The previous loop may not find a matching EMCP method, but
|
|
|
|
// that doesn't mean that we can optimize and not go any
|
|
|
|
// further back in the PreviousVersion generations. The EMCP
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// method for this generation could have already been deleted,
|
2007-12-01 00:00:00 +00:00
|
|
|
// but there still may be an older EMCP method that has not
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// been deleted.
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (++local_count >= obsolete_method_count) {
|
|
|
|
// no more obsolete methods so bail out now
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // end add_previous_version()
|
|
|
|
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Determine if InstanceKlass has a previous version.
|
|
|
|
bool InstanceKlass::has_previous_version() const {
|
|
|
|
return (_previous_versions != NULL && _previous_versions->length() > 0);
|
2007-12-01 00:00:00 +00:00
|
|
|
} // end has_previous_version()
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
|
|
|
|
Method* InstanceKlass::method_with_idnum(int idnum) {
|
|
|
|
Method* m = NULL;
|
2007-12-01 00:00:00 +00:00
|
|
|
if (idnum < methods()->length()) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
m = methods()->at(idnum);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
if (m == NULL || m->method_idnum() != idnum) {
|
|
|
|
for (int index = 0; index < methods()->length(); ++index) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
m = methods()->at(index);
|
2007-12-01 00:00:00 +00:00
|
|
|
if (m->method_idnum() == idnum) {
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Construct a PreviousVersionNode entry for the array hung off
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// the InstanceKlass.
|
|
|
|
PreviousVersionNode::PreviousVersionNode(ConstantPool* prev_constant_pool,
|
|
|
|
bool prev_cp_is_weak, GrowableArray<Method*>* prev_EMCP_methods) {
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
_prev_constant_pool = prev_constant_pool;
|
2008-03-12 18:06:50 -07:00
|
|
|
_prev_cp_is_weak = prev_cp_is_weak;
|
2007-12-01 00:00:00 +00:00
|
|
|
_prev_EMCP_methods = prev_EMCP_methods;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Destroy a PreviousVersionNode
|
|
|
|
PreviousVersionNode::~PreviousVersionNode() {
|
|
|
|
if (_prev_constant_pool != NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
_prev_constant_pool = NULL;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_prev_EMCP_methods != NULL) {
|
|
|
|
delete _prev_EMCP_methods;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Construct a PreviousVersionInfo entry
|
|
|
|
PreviousVersionInfo::PreviousVersionInfo(PreviousVersionNode *pv_node) {
|
|
|
|
_prev_constant_pool_handle = constantPoolHandle(); // NULL handle
|
|
|
|
_prev_EMCP_method_handles = NULL;
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
ConstantPool* cp = pv_node->prev_constant_pool();
|
|
|
|
assert(cp != NULL, "constant pool ref was unexpectedly cleared");
|
2007-12-01 00:00:00 +00:00
|
|
|
if (cp == NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
return; // robustness
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// make the ConstantPool* safe to return
|
2007-12-01 00:00:00 +00:00
|
|
|
_prev_constant_pool_handle = constantPoolHandle(cp);
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
GrowableArray<Method*>* method_refs = pv_node->prev_EMCP_methods();
|
2007-12-01 00:00:00 +00:00
|
|
|
if (method_refs == NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// the InstanceKlass did not have any EMCP methods
|
2007-12-01 00:00:00 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_prev_EMCP_method_handles = new GrowableArray<methodHandle>(10);
|
|
|
|
|
|
|
|
int n_methods = method_refs->length();
|
|
|
|
for (int i = 0; i < n_methods; i++) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* method = method_refs->at(i);
|
|
|
|
assert (method != NULL, "method has been cleared");
|
2007-12-01 00:00:00 +00:00
|
|
|
if (method == NULL) {
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
continue; // robustness
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// make the Method* safe to return
|
2007-12-01 00:00:00 +00:00
|
|
|
_prev_EMCP_method_handles->append(methodHandle(method));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Destroy a PreviousVersionInfo
|
|
|
|
PreviousVersionInfo::~PreviousVersionInfo() {
|
|
|
|
// Since _prev_EMCP_method_handles is not C-heap allocated, we
|
|
|
|
// don't have to delete it.
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Construct a helper for walking the previous versions array
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
PreviousVersionWalker::PreviousVersionWalker(InstanceKlass *ik) {
|
2007-12-01 00:00:00 +00:00
|
|
|
_previous_versions = ik->previous_versions();
|
|
|
|
_current_index = 0;
|
|
|
|
// _hm needs no initialization
|
|
|
|
_current_p = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Destroy a PreviousVersionWalker
|
|
|
|
PreviousVersionWalker::~PreviousVersionWalker() {
|
|
|
|
// Delete the current info just in case the caller didn't walk to
|
|
|
|
// the end of the previous versions list. No harm if _current_p is
|
|
|
|
// already NULL.
|
|
|
|
delete _current_p;
|
|
|
|
|
|
|
|
// When _hm is destroyed, all the Handles returned in
|
|
|
|
// PreviousVersionInfo objects will be destroyed.
|
|
|
|
// Also, after this destructor is finished it will be
|
|
|
|
// safe to delete the GrowableArray allocated in the
|
|
|
|
// PreviousVersionInfo objects.
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Return the interesting information for the next previous version
|
|
|
|
// of the klass. Returns NULL if there are no more previous versions.
|
|
|
|
PreviousVersionInfo* PreviousVersionWalker::next_previous_version() {
|
|
|
|
if (_previous_versions == NULL) {
|
|
|
|
// no previous versions so nothing to return
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete _current_p; // cleanup the previous info for the caller
|
|
|
|
_current_p = NULL; // reset to NULL so we don't delete same object twice
|
|
|
|
|
|
|
|
int length = _previous_versions->length();
|
|
|
|
|
|
|
|
while (_current_index < length) {
|
|
|
|
PreviousVersionNode * pv_node = _previous_versions->at(_current_index++);
|
2012-06-28 17:03:16 -04:00
|
|
|
PreviousVersionInfo * pv_info = new (ResourceObj::C_HEAP, mtClass)
|
2007-12-01 00:00:00 +00:00
|
|
|
PreviousVersionInfo(pv_node);
|
|
|
|
|
|
|
|
constantPoolHandle cp_h = pv_info->prev_constant_pool_handle();
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
assert (!cp_h.is_null(), "null cp found in previous version");
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// The caller will need to delete pv_info when they are done with it.
|
2007-12-01 00:00:00 +00:00
|
|
|
_current_p = pv_info;
|
|
|
|
return pv_info;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// all of the underlying nodes' info has been deleted
|
2007-12-01 00:00:00 +00:00
|
|
|
return NULL;
|
|
|
|
} // end next_previous_version()
|