--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Thu Jan 27 13:42:28 2011 -0800
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Thu Jan 27 16:11:27 2011 -0800
@@ -93,8 +93,8 @@
JavaValue result(T_OBJECT);
JavaCalls::call_static(&result,
KlassHandle(THREAD, WK_KLASS(ClassLoader_klass)),
- vmSymbolHandles::getSystemClassLoader_name(),
- vmSymbolHandles::void_classloader_signature(),
+ vmSymbols::getSystemClassLoader_name(),
+ vmSymbols::void_classloader_signature(),
CHECK);
_java_system_loader = (oop)result.get_jobject();
@@ -107,8 +107,8 @@
#ifdef ASSERT
// return true if class_name contains no '.' (internal format is '/')
-bool SystemDictionary::is_internal_format(symbolHandle class_name) {
- if (class_name.not_null()) {
+bool SystemDictionary::is_internal_format(Symbol* class_name) {
+ if (class_name != NULL) {
ResourceMark rm;
char* name = class_name->as_C_string();
return strchr(name, '.') == NULL;
@@ -141,7 +141,7 @@
// Forwards to resolve_or_null
-klassOop SystemDictionary::resolve_or_fail(symbolHandle class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS) {
+klassOop SystemDictionary::resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS) {
klassOop klass = resolve_or_null(class_name, class_loader, protection_domain, THREAD);
if (HAS_PENDING_EXCEPTION || klass == NULL) {
KlassHandle k_h(THREAD, klass);
@@ -151,7 +151,7 @@
return klass;
}
-klassOop SystemDictionary::handle_resolution_exception(symbolHandle class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS) {
+klassOop SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS) {
if (HAS_PENDING_EXCEPTION) {
// If we have a pending exception we forward it to the caller, unless throw_error is true,
// in which case we have to check whether the pending exception is a ClassNotFoundException,
@@ -180,7 +180,7 @@
}
-klassOop SystemDictionary::resolve_or_fail(symbolHandle class_name,
+klassOop SystemDictionary::resolve_or_fail(Symbol* class_name,
bool throw_error, TRAPS)
{
return resolve_or_fail(class_name, Handle(), Handle(), throw_error, THREAD);
@@ -189,48 +189,49 @@
// Forwards to resolve_instance_class_or_null
-klassOop SystemDictionary::resolve_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS) {
+klassOop SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS) {
assert(!THREAD->is_Compiler_thread(), "Can not load classes with the Compiler thread");
- if (FieldType::is_array(class_name())) {
+ if (FieldType::is_array(class_name)) {
return resolve_array_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
+ } else if (FieldType::is_obj(class_name)) {
+ ResourceMark rm(THREAD);
+ // Ignore wrapping L and ;.
+ TempNewSymbol name = SymbolTable::new_symbol(class_name->as_C_string() + 1,
+ class_name->utf8_length() - 2, CHECK_NULL);
+ return resolve_instance_class_or_null(name, class_loader, protection_domain, CHECK_NULL);
} else {
return resolve_instance_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
}
}
-klassOop SystemDictionary::resolve_or_null(symbolHandle class_name, TRAPS) {
+klassOop SystemDictionary::resolve_or_null(Symbol* class_name, TRAPS) {
return resolve_or_null(class_name, Handle(), Handle(), THREAD);
}
// Forwards to resolve_instance_class_or_null
-klassOop SystemDictionary::resolve_array_class_or_null(symbolHandle class_name,
+klassOop SystemDictionary::resolve_array_class_or_null(Symbol* class_name,
Handle class_loader,
Handle protection_domain,
TRAPS) {
- assert(FieldType::is_array(class_name()), "must be array");
- jint dimension;
- symbolOop object_key;
+ assert(FieldType::is_array(class_name), "must be array");
klassOop k = NULL;
- // dimension and object_key are assigned as a side-effect of this call
- BasicType t = FieldType::get_array_info(class_name(),
- &dimension,
- &object_key,
- CHECK_NULL);
-
+ FieldArrayInfo fd;
+ // dimension and object_key in FieldArrayInfo are assigned as a side-effect
+ // of this call
+ BasicType t = FieldType::get_array_info(class_name, fd, CHECK_NULL);
if (t == T_OBJECT) {
- symbolHandle h_key(THREAD, object_key);
// naked oop "k" is OK here -- we assign back into it
- k = SystemDictionary::resolve_instance_class_or_null(h_key,
+ k = SystemDictionary::resolve_instance_class_or_null(fd.object_key(),
class_loader,
protection_domain,
CHECK_NULL);
if (k != NULL) {
- k = Klass::cast(k)->array_klass(dimension, CHECK_NULL);
+ k = Klass::cast(k)->array_klass(fd.dimension(), CHECK_NULL);
}
} else {
k = Universe::typeArrayKlassObj(t);
- k = typeArrayKlass::cast(k)->array_klass(dimension, CHECK_NULL);
+ k = typeArrayKlass::cast(k)->array_klass(fd.dimension(), CHECK_NULL);
}
return k;
}
@@ -271,8 +272,8 @@
// Must be called, even if superclass is null, since this is
// where the placeholder entry is created which claims this
// thread is loading this class/classloader.
-klassOop SystemDictionary::resolve_super_or_fail(symbolHandle child_name,
- symbolHandle class_name,
+klassOop SystemDictionary::resolve_super_or_fail(Symbol* child_name,
+ Symbol* class_name,
Handle class_loader,
Handle protection_domain,
bool is_superclass,
@@ -281,7 +282,7 @@
// Try to get one of the well-known klasses.
// They are trusted, and do not participate in circularities.
if (LinkWellKnownClasses) {
- klassOop k = find_well_known_klass(class_name());
+ klassOop k = find_well_known_klass(class_name);
if (k != NULL) {
return k;
}
@@ -323,7 +324,7 @@
if ((childk != NULL ) && (is_superclass) &&
((quicksuperk = instanceKlass::cast(childk)->super()) != NULL) &&
- ((Klass::cast(quicksuperk)->name() == class_name()) &&
+ ((Klass::cast(quicksuperk)->name() == class_name) &&
(Klass::cast(quicksuperk)->class_loader() == class_loader()))) {
return quicksuperk;
} else {
@@ -342,7 +343,7 @@
}
// java.lang.Object should have been found above
- assert(class_name() != NULL, "null super class for resolving");
+ assert(class_name != NULL, "null super class for resolving");
// Resolve the super class or interface, check results on return
klassOop superk = NULL;
superk = SystemDictionary::resolve_or_null(class_name,
@@ -392,8 +393,8 @@
JavaCalls::call_special(&result,
class_loader,
system_loader,
- vmSymbolHandles::checkPackageAccess_name(),
- vmSymbolHandles::class_protectiondomain_signature(),
+ vmSymbols::checkPackageAccess_name(),
+ vmSymbols::class_protectiondomain_signature(),
Handle(THREAD, klass->java_mirror()),
protection_domain,
THREAD);
@@ -414,7 +415,7 @@
{
// We recalculate the entry here -- we've called out to java since
// the last time it was calculated.
- symbolHandle kn(THREAD, klass->name());
+ Symbol* kn = klass->name();
unsigned int d_hash = dictionary()->compute_hash(kn, class_loader);
int d_index = dictionary()->hash_to_index(d_hash);
@@ -489,7 +490,7 @@
// and we are done,
// If return null klassOop and no pending exception, the caller must load the class
instanceKlassHandle SystemDictionary::handle_parallel_super_load(
- symbolHandle name, symbolHandle superclassname, Handle class_loader,
+ Symbol* name, Symbol* superclassname, Handle class_loader,
Handle protection_domain, Handle lockObject, TRAPS) {
instanceKlassHandle nh = instanceKlassHandle(); // null Handle
@@ -578,17 +579,9 @@
}
-klassOop SystemDictionary::resolve_instance_class_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS) {
- assert(class_name.not_null() && !FieldType::is_array(class_name()), "invalid class name");
- // First check to see if we should remove wrapping L and ;
- symbolHandle name;
- if (FieldType::is_obj(class_name())) {
- ResourceMark rm(THREAD);
- // Ignore wrapping L and ;.
- name = oopFactory::new_symbol_handle(class_name()->as_C_string() + 1, class_name()->utf8_length() - 2, CHECK_NULL);
- } else {
- name = class_name;
- }
+klassOop SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle class_loader, Handle protection_domain, TRAPS) {
+ assert(name != NULL && !FieldType::is_array(name) &&
+ !FieldType::is_obj(name), "invalid class name");
// UseNewReflection
// Fix for 4474172; see evaluation for more details
@@ -632,7 +625,7 @@
bool havesupername = false;
instanceKlassHandle k;
PlaceholderEntry* placeholder;
- symbolHandle superclassname;
+ Symbol* superclassname = NULL;
{
MutexLocker mu(SystemDictionary_lock, THREAD);
@@ -646,7 +639,7 @@
if (placeholder && placeholder->super_load_in_progress()) {
super_load_in_progress = true;
if (placeholder->havesupername() == true) {
- superclassname = symbolHandle(THREAD, placeholder->supername());
+ superclassname = placeholder->supername();
havesupername = true;
}
}
@@ -691,7 +684,6 @@
// No performance benefit and no deadlock issues.
// case 5. parallelCapable user level classloaders - without objectLocker
// Allow parallel classloading of a class/classloader pair
- symbolHandle nullsymbolHandle;
bool throw_circularity_error = false;
{
MutexLocker mu(SystemDictionary_lock, THREAD);
@@ -733,7 +725,7 @@
// LOAD_INSTANCE in parallel
// add placeholder entry even if error - callers will remove on error
if (!throw_circularity_error && !class_has_been_loaded) {
- PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, name, class_loader, PlaceholderTable::LOAD_INSTANCE, nullsymbolHandle, THREAD);
+ PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, name, class_loader, PlaceholderTable::LOAD_INSTANCE, NULL, THREAD);
// For class loaders that do not acquire the classloader object lock,
// if they did not catch another thread holding LOAD_INSTANCE,
// need a check analogous to the acquire ObjectLocker/find_class
@@ -837,7 +829,7 @@
{
Handle loader (THREAD, k->class_loader());
MutexLocker mu(SystemDictionary_lock, THREAD);
- oop kk = find_class_or_placeholder(name, loader);
+ oop kk = find_class(name, loader);
assert(kk == k(), "should be present in dictionary");
}
#endif
@@ -880,7 +872,7 @@
// _dictionary->bucket(index) is read here, so the caller will not see
// the new entry.
-klassOop SystemDictionary::find(symbolHandle class_name,
+klassOop SystemDictionary::find(Symbol* class_name,
Handle class_loader,
Handle protection_domain,
TRAPS) {
@@ -910,37 +902,34 @@
// Look for a loaded instance or array klass by name. Do not do any loading.
// return NULL in case of error.
-klassOop SystemDictionary::find_instance_or_array_klass(symbolHandle class_name,
+klassOop SystemDictionary::find_instance_or_array_klass(Symbol* class_name,
Handle class_loader,
Handle protection_domain,
TRAPS) {
klassOop k = NULL;
- assert(class_name() != NULL, "class name must be non NULL");
+ assert(class_name != NULL, "class name must be non NULL");
// Try to get one of the well-known klasses.
if (LinkWellKnownClasses) {
- k = find_well_known_klass(class_name());
+ k = find_well_known_klass(class_name);
if (k != NULL) {
return k;
}
}
- if (FieldType::is_array(class_name())) {
+ if (FieldType::is_array(class_name)) {
// The name refers to an array. Parse the name.
- jint dimension;
- symbolOop object_key;
-
- // dimension and object_key are assigned as a side-effect of this call
- BasicType t = FieldType::get_array_info(class_name(), &dimension,
- &object_key, CHECK_(NULL));
+ // dimension and object_key in FieldArrayInfo are assigned as a
+ // side-effect of this call
+ FieldArrayInfo fd;
+ BasicType t = FieldType::get_array_info(class_name, fd, CHECK_(NULL));
if (t != T_OBJECT) {
k = Universe::typeArrayKlassObj(t);
} else {
- symbolHandle h_key(THREAD, object_key);
- k = SystemDictionary::find(h_key, class_loader, protection_domain, THREAD);
+ k = SystemDictionary::find(fd.object_key(), class_loader, protection_domain, THREAD);
}
if (k != NULL) {
- k = Klass::cast(k)->array_klass_or_null(dimension);
+ k = Klass::cast(k)->array_klass_or_null(fd.dimension());
}
} else {
k = find(class_name, class_loader, protection_domain, THREAD);
@@ -949,7 +938,7 @@
}
// Quick range check for names of well-known classes:
-static symbolOop wk_klass_name_limits[2] = {NULL, NULL};
+static Symbol* wk_klass_name_limits[2] = {NULL, NULL};
#ifndef PRODUCT
static int find_wkk_calls, find_wkk_probes, find_wkk_wins;
@@ -957,7 +946,7 @@
// => 60% hit after limit guard, 25% total win rate
#endif
-klassOop SystemDictionary::find_well_known_klass(symbolOop class_name) {
+klassOop SystemDictionary::find_well_known_klass(Symbol* class_name) {
// A bounds-check on class_name will quickly get a negative result.
NOT_PRODUCT(find_wkk_calls++);
if (class_name >= wk_klass_name_limits[0] &&
@@ -983,14 +972,14 @@
// Note: this method is much like resolve_from_stream, but
// updates no supplemental data structures.
// TODO consolidate the two methods with a helper routine?
-klassOop SystemDictionary::parse_stream(symbolHandle class_name,
+klassOop SystemDictionary::parse_stream(Symbol* class_name,
Handle class_loader,
Handle protection_domain,
ClassFileStream* st,
KlassHandle host_klass,
GrowableArray<Handle>* cp_patches,
TRAPS) {
- symbolHandle parsed_name;
+ TempNewSymbol parsed_name = NULL;
// Parse the stream. Note that we do this even though this klass might
// already be present in the SystemDictionary, otherwise we would not
@@ -1011,13 +1000,12 @@
true,
THREAD);
-
// We don't redefine the class, so we just need to clean up whether there
// was an error or not (don't want to modify any system dictionary
// data structures).
// Parsed name could be null if we threw an error before we got far
// enough along to parse it -- in that case, there is nothing to clean up.
- if (!parsed_name.is_null()) {
+ if (parsed_name != NULL) {
unsigned int p_hash = placeholders()->compute_hash(parsed_name,
class_loader);
int p_index = placeholders()->hash_to_index(p_hash);
@@ -1060,7 +1048,7 @@
// Note: class_name can be NULL. In that case we do not know the name of
// the class until we have parsed the stream.
-klassOop SystemDictionary::resolve_from_stream(symbolHandle class_name,
+klassOop SystemDictionary::resolve_from_stream(Symbol* class_name,
Handle class_loader,
Handle protection_domain,
ClassFileStream* st,
@@ -1079,7 +1067,7 @@
check_loader_lock_contention(lockObject, THREAD);
ObjectLocker ol(lockObject, THREAD, DoObjectLock);
- symbolHandle parsed_name;
+ TempNewSymbol parsed_name = NULL;
// Parse the stream. Note that we do this even though this klass might
// already be present in the SystemDictionary, otherwise we would not
@@ -1101,7 +1089,7 @@
const char* pkg = "java/";
if (!HAS_PENDING_EXCEPTION &&
!class_loader.is_null() &&
- !parsed_name.is_null() &&
+ parsed_name != NULL &&
!strncmp((const char*)parsed_name->bytes(), pkg, strlen(pkg))) {
// It is illegal to define classes in the "java." package from
// JVM_DefineClass or jni_DefineClass unless you're the bootclassloader
@@ -1121,9 +1109,8 @@
}
if (!HAS_PENDING_EXCEPTION) {
- assert(!parsed_name.is_null(), "Sanity");
- assert(class_name.is_null() || class_name() == parsed_name(),
- "name mismatch");
+ assert(parsed_name != NULL, "Sanity");
+ assert(class_name == NULL || class_name == parsed_name, "name mismatch");
// Verification prevents us from creating names with dots in them, this
// asserts that that's the case.
assert(is_internal_format(parsed_name),
@@ -1144,7 +1131,7 @@
// must make sure parsed_name is valid first (it won't be if we had
// a format error before the class was parsed far enough to
// find the name).
- if (HAS_PENDING_EXCEPTION && !parsed_name.is_null()) {
+ if (HAS_PENDING_EXCEPTION && parsed_name != NULL) {
unsigned int p_hash = placeholders()->compute_hash(parsed_name,
class_loader);
int p_index = placeholders()->hash_to_index(p_hash);
@@ -1160,16 +1147,16 @@
// SystemDictionary; this is only done on success
debug_only( {
if (!HAS_PENDING_EXCEPTION) {
- assert(!parsed_name.is_null(), "parsed_name is still null?");
- symbolHandle h_name (THREAD, k->name());
+ assert(parsed_name != NULL, "parsed_name is still null?");
+ Symbol* h_name = k->name();
Handle h_loader (THREAD, k->class_loader());
MutexLocker mu(SystemDictionary_lock, THREAD);
- oop check = find_class_or_placeholder(parsed_name, class_loader);
+ klassOop check = find_class(parsed_name, class_loader);
assert(check == k(), "should be present in the dictionary");
- oop check2 = find_class_or_placeholder(h_name, h_loader);
+ klassOop check2 = find_class(h_name, h_loader);
assert(check == check2, "name inconsistancy in SystemDictionary");
}
} );
@@ -1189,7 +1176,7 @@
// If there is a shared dictionary, then find the entry for the
// given shared system class, if any.
-klassOop SystemDictionary::find_shared_class(symbolHandle class_name) {
+klassOop SystemDictionary::find_shared_class(Symbol* class_name) {
if (shared_dictionary() != NULL) {
unsigned int d_hash = dictionary()->compute_hash(class_name, Handle());
int d_index = dictionary()->hash_to_index(d_hash);
@@ -1207,7 +1194,7 @@
// object hierarchy until loaded.]
instanceKlassHandle SystemDictionary::load_shared_class(
- symbolHandle class_name, Handle class_loader, TRAPS) {
+ Symbol* class_name, Handle class_loader, TRAPS) {
instanceKlassHandle ik (THREAD, find_shared_class(class_name));
return load_shared_class(ik, class_loader, THREAD);
}
@@ -1222,14 +1209,14 @@
assert(class_loader.is_null(), "non-null classloader for shared class?");
if (ik.not_null()) {
instanceKlassHandle nh = instanceKlassHandle(); // null Handle
- symbolHandle class_name(THREAD, ik->name());
+ Symbol* class_name = ik->name();
// Found the class, now load the superclass and interfaces. If they
// are shared, add them to the main system dictionary and reset
// their hierarchy references (supers, subs, and interfaces).
if (ik->super() != NULL) {
- symbolHandle cn(THREAD, ik->super()->klass_part()->name());
+ Symbol* cn = ik->super()->klass_part()->name();
resolve_super_or_fail(class_name, cn,
class_loader, Handle(), true, CHECK_(nh));
}
@@ -1243,7 +1230,7 @@
// interfaces' instanceKlass's C++ vtbls haven't been
// reinitialized yet (they will be once the interface classes
// are loaded)
- symbolHandle name (THREAD, k->klass_part()->name());
+ Symbol* name = k->klass_part()->name();
resolve_super_or_fail(class_name, name, class_loader, Handle(), false, CHECK_(nh));
}
@@ -1290,7 +1277,7 @@
// Note that with delegation class loaders all classes in another loader will
// first try to call this so it'd better be fast!!
static instanceKlassHandle download_and_retry_class_load(
- symbolHandle class_name,
+ Symbol* class_name,
TRAPS) {
klassOop dlm = SystemDictionary::sun_jkernel_DownloadManager_klass();
@@ -1313,8 +1300,8 @@
// public static String getBootClassPathEntryForClass(String className);
JavaCalls::call_static(&result,
KlassHandle(THREAD, dlm),
- vmSymbolHandles::getBootClassPathEntryForClass_name(),
- vmSymbolHandles::string_string_signature(),
+ vmSymbols::getBootClassPathEntryForClass_name(),
+ vmSymbols::string_string_signature(),
class_string,
CHECK_(nk));
@@ -1344,7 +1331,7 @@
#endif // KERNEL
-instanceKlassHandle SystemDictionary::load_instance_class(symbolHandle class_name, Handle class_loader, TRAPS) {
+instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
instanceKlassHandle nh = instanceKlassHandle(); // null Handle
if (class_loader.is_null()) {
@@ -1419,16 +1406,16 @@
JavaCalls::call_special(&result,
class_loader,
spec_klass,
- vmSymbolHandles::loadClassInternal_name(),
- vmSymbolHandles::string_class_signature(),
+ vmSymbols::loadClassInternal_name(),
+ vmSymbols::string_class_signature(),
string,
CHECK_(nh));
} else {
JavaCalls::call_virtual(&result,
class_loader,
spec_klass,
- vmSymbolHandles::loadClass_name(),
- vmSymbolHandles::string_class_signature(),
+ vmSymbols::loadClass_name(),
+ vmSymbols::string_class_signature(),
string,
CHECK_(nh));
}
@@ -1444,7 +1431,7 @@
// For user defined Java class loaders, check that the name returned is
// the same as that requested. This check is done for the bootstrap
// loader when parsing the class file.
- if (class_name() == k->name()) {
+ if (class_name == k->name()) {
return k;
}
}
@@ -1477,7 +1464,7 @@
// classloader lock held
// Parallel classloaders will call find_or_define_instance_class
// which will require a token to perform the define class
- symbolHandle name_h(THREAD, k->name());
+ Symbol* name_h = k->name();
unsigned int d_hash = dictionary()->compute_hash(name_h, class_loader_h);
int d_index = dictionary()->hash_to_index(d_hash);
check_constraints(d_index, d_hash, k, class_loader_h, true, CHECK);
@@ -1536,10 +1523,10 @@
// findClass(), i.e. FindLoadedClass/DefineClassIfAbsent or they
// potentially waste time reading and parsing the bytestream.
// Note: VM callers should ensure consistency of k/class_name,class_loader
-instanceKlassHandle SystemDictionary::find_or_define_instance_class(symbolHandle class_name, Handle class_loader, instanceKlassHandle k, TRAPS) {
+instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* class_name, Handle class_loader, instanceKlassHandle k, TRAPS) {
instanceKlassHandle nh = instanceKlassHandle(); // null Handle
- symbolHandle name_h(THREAD, k->name()); // passed in class_name may be null
+ Symbol* name_h = k->name(); // passed in class_name may be null
unsigned int d_hash = dictionary()->compute_hash(name_h, class_loader);
int d_index = dictionary()->hash_to_index(d_hash);
@@ -1560,8 +1547,7 @@
}
// Acquire define token for this class/classloader
- symbolHandle nullsymbolHandle;
- probe = placeholders()->find_and_add(p_index, p_hash, name_h, class_loader, PlaceholderTable::DEFINE_CLASS, nullsymbolHandle, THREAD);
+ probe = placeholders()->find_and_add(p_index, p_hash, name_h, class_loader, PlaceholderTable::DEFINE_CLASS, NULL, THREAD);
// Wait if another thread defining in parallel
// All threads wait - even those that will throw duplicate class: otherwise
// caller is surprised by LinkageError: duplicate, but findLoadedClass fails
@@ -1653,7 +1639,7 @@
// Lookup
klassOop SystemDictionary::find_class(int index, unsigned int hash,
- symbolHandle class_name,
+ Symbol* class_name,
Handle class_loader) {
assert_locked_or_safepoint(SystemDictionary_lock);
assert (index == dictionary()->index_for(class_name, class_loader),
@@ -1665,18 +1651,17 @@
// Basic find on classes in the midst of being loaded
-symbolOop SystemDictionary::find_placeholder(int index, unsigned int hash,
- symbolHandle class_name,
- Handle class_loader) {
+Symbol* SystemDictionary::find_placeholder(Symbol* class_name,
+ Handle class_loader) {
assert_locked_or_safepoint(SystemDictionary_lock);
-
- return placeholders()->find_entry(index, hash, class_name, class_loader);
+ unsigned int p_hash = placeholders()->compute_hash(class_name, class_loader);
+ int p_index = placeholders()->hash_to_index(p_hash);
+ return placeholders()->find_entry(p_index, p_hash, class_name, class_loader);
}
// Used for assertions and verification only
-oop SystemDictionary::find_class_or_placeholder(symbolHandle class_name,
- Handle class_loader) {
+klassOop SystemDictionary::find_class(Symbol* class_name, Handle class_loader) {
#ifndef ASSERT
guarantee(VerifyBeforeGC ||
VerifyDuringGC ||
@@ -1684,22 +1669,11 @@
VerifyAfterGC, "too expensive");
#endif
assert_locked_or_safepoint(SystemDictionary_lock);
- symbolOop class_name_ = class_name();
- oop class_loader_ = class_loader();
// First look in the loaded class array
unsigned int d_hash = dictionary()->compute_hash(class_name, class_loader);
int d_index = dictionary()->hash_to_index(d_hash);
- oop lookup = find_class(d_index, d_hash, class_name, class_loader);
-
- if (lookup == NULL) {
- // Next try the placeholders
- unsigned int p_hash = placeholders()->compute_hash(class_name,class_loader);
- int p_index = placeholders()->hash_to_index(p_hash);
- lookup = find_placeholder(p_index, p_hash, class_name, class_loader);
- }
-
- return lookup;
+ return find_class(d_index, d_hash, class_name, class_loader);
}
@@ -1757,12 +1731,6 @@
// Visit extra methods
invoke_method_table()->oops_do(blk);
-
- // Loader constraints. We must keep the symbolOop used in the name alive.
- constraints()->always_strong_classes_do(blk);
-
- // Resolution errors keep the symbolOop for the error alive
- resolution_errors()->always_strong_classes_do(blk);
}
@@ -1808,9 +1776,6 @@
void SystemDictionary::preloaded_oops_do(OopClosure* f) {
- f->do_oop((oop*) &wk_klass_name_limits[0]);
- f->do_oop((oop*) &wk_klass_name_limits[1]);
-
for (int k = (int)FIRST_WKID; k < (int)WKID_LIMIT; k++) {
f->do_oop((oop*) &_well_known_klasses[k]);
}
@@ -1862,7 +1827,7 @@
dictionary()->classes_do(f, CHECK);
}
-void SystemDictionary::placeholders_do(void f(symbolOop, oop)) {
+void SystemDictionary::placeholders_do(void f(Symbol*, oop)) {
placeholders()->entries_do(f);
}
@@ -1882,7 +1847,7 @@
// class is loaded.
klassOop aos = _abstract_ownable_synchronizer_klass;
if (aos == NULL) {
- klassOop k = resolve_or_fail(vmSymbolHandles::java_util_concurrent_locks_AbstractOwnableSynchronizer(), true, CHECK);
+ klassOop k = resolve_or_fail(vmSymbols::java_util_concurrent_locks_AbstractOwnableSynchronizer(), true, CHECK);
// Force a fence to prevent any read before the write completes
OrderAccess::fence();
_abstract_ownable_synchronizer_klass = k;
@@ -1924,7 +1889,7 @@
assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
int info = wk_init_info[id - FIRST_WKID];
int sid = (info >> CEIL_LG_OPTION_LIMIT);
- symbolHandle symbol = vmSymbolHandles::symbol_handle_at((vmSymbols::SID)sid);
+ Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
klassOop* klassp = &_well_known_klasses[id];
bool must_load = (init_opt < SystemDictionary::Opt);
bool try_load = true;
@@ -1954,7 +1919,7 @@
initialize_wk_klass((WKID)id, opt, CHECK);
// Update limits, so find_well_known_klass can be very fast:
- symbolOop s = vmSymbols::symbol_at((vmSymbols::SID)sid);
+ Symbol* s = vmSymbols::symbol_at((vmSymbols::SID)sid);
if (wk_klass_name_limits[1] == NULL) {
wk_klass_name_limits[0] = wk_klass_name_limits[1] = s;
} else if (wk_klass_name_limits[1] < s) {
@@ -2081,7 +2046,7 @@
TRAPS) {
const char *linkage_error = NULL;
{
- symbolHandle name (THREAD, k->name());
+ Symbol* name = k->name();
MutexLocker mu(SystemDictionary_lock, THREAD);
klassOop check = find_class(d_index, d_hash, name, class_loader);
@@ -2102,10 +2067,8 @@
}
#ifdef ASSERT
- unsigned int p_hash = placeholders()->compute_hash(name, class_loader);
- int p_index = placeholders()->hash_to_index(p_hash);
- symbolOop ph_check = find_placeholder(p_index, p_hash, name, class_loader);
- assert(ph_check == NULL || ph_check == name(), "invalid symbol");
+ Symbol* ph_check = find_placeholder(name, class_loader);
+ assert(ph_check == NULL || ph_check == name, "invalid symbol");
#endif
if (linkage_error == NULL) {
@@ -2141,7 +2104,7 @@
TRAPS) {
// Compile_lock prevents systemDictionary updates during compilations
assert_locked_or_safepoint(Compile_lock);
- symbolHandle name (THREAD, k->name());
+ Symbol* name = k->name();
{
MutexLocker mu1(SystemDictionary_lock, THREAD);
@@ -2181,7 +2144,7 @@
// while only one thread can define a class at one time, multiple
// classes can resolve the superclass for a class at one time,
// and the placeholder is used to track that
-// symbolOop ph_check = find_placeholder(p_index, p_hash, name, class_loader);
+// Symbol* ph_check = find_placeholder(name, class_loader);
// assert (ph_check == NULL, "should not have a placeholder entry");
#endif
SystemDictionary_lock->notify_all();
@@ -2190,7 +2153,7 @@
klassOop SystemDictionary::find_constrained_instance_or_array_klass(
- symbolHandle class_name, Handle class_loader, TRAPS) {
+ Symbol* class_name, Handle class_loader, TRAPS) {
// First see if it has been loaded directly.
// Force the protection domain to be null. (This removes protection checks.)
@@ -2203,23 +2166,20 @@
// Now look to see if it has been loaded elsewhere, and is subject to
// a loader constraint that would require this loader to return the
// klass that is already loaded.
- if (FieldType::is_array(class_name())) {
+ if (FieldType::is_array(class_name)) {
// For array classes, their klassOops are not kept in the
// constraint table. The element klassOops are.
- jint dimension;
- symbolOop object_key;
- BasicType t = FieldType::get_array_info(class_name(), &dimension,
- &object_key, CHECK_(NULL));
+ FieldArrayInfo fd;
+ BasicType t = FieldType::get_array_info(class_name, fd, CHECK_(NULL));
if (t != T_OBJECT) {
klass = Universe::typeArrayKlassObj(t);
} else {
- symbolHandle elem_name(THREAD, object_key);
MutexLocker mu(SystemDictionary_lock, THREAD);
- klass = constraints()->find_constrained_klass(elem_name, class_loader);
+ klass = constraints()->find_constrained_klass(fd.object_key(), class_loader);
}
// If element class already loaded, allocate array klass
if (klass != NULL) {
- klass = Klass::cast(klass)->array_klass_or_null(dimension);
+ klass = Klass::cast(klass)->array_klass_or_null(fd.dimension());
}
} else {
MutexLocker mu(SystemDictionary_lock, THREAD);
@@ -2231,25 +2191,23 @@
}
-bool SystemDictionary::add_loader_constraint(symbolHandle class_name,
+bool SystemDictionary::add_loader_constraint(Symbol* class_name,
Handle class_loader1,
Handle class_loader2,
Thread* THREAD) {
- symbolHandle constraint_name;
- if (!FieldType::is_array(class_name())) {
+ Symbol* constraint_name = NULL;
+ if (!FieldType::is_array(class_name)) {
constraint_name = class_name;
} else {
// For array classes, their klassOops are not kept in the
// constraint table. The element classes are.
- jint dimension;
- symbolOop object_key;
- BasicType t = FieldType::get_array_info(class_name(), &dimension,
- &object_key, CHECK_(false));
+ FieldArrayInfo fd;
+ BasicType t = FieldType::get_array_info(class_name, fd, CHECK_(false));
// primitive types always pass
if (t != T_OBJECT) {
return true;
} else {
- constraint_name = symbolHandle(THREAD, object_key);
+ constraint_name = fd.object_key();
}
}
unsigned int d_hash1 = dictionary()->compute_hash(constraint_name, class_loader1);
@@ -2272,7 +2230,7 @@
// Add entry to resolution error table to record the error when the first
// attempt to resolve a reference to a class has failed.
-void SystemDictionary::add_resolution_error(constantPoolHandle pool, int which, symbolHandle error) {
+void SystemDictionary::add_resolution_error(constantPoolHandle pool, int which, Symbol* error) {
unsigned int hash = resolution_errors()->compute_hash(pool, which);
int index = resolution_errors()->hash_to_index(hash);
{
@@ -2282,13 +2240,13 @@
}
// Lookup resolution error table. Returns error if found, otherwise NULL.
-symbolOop SystemDictionary::find_resolution_error(constantPoolHandle pool, int which) {
+Symbol* SystemDictionary::find_resolution_error(constantPoolHandle pool, int which) {
unsigned int hash = resolution_errors()->compute_hash(pool, which);
int index = resolution_errors()->hash_to_index(hash);
{
MutexLocker ml(SystemDictionary_lock, Thread::current());
ResolutionErrorEntry* entry = resolution_errors()->find_entry(index, hash, pool, which);
- return (entry != NULL) ? entry->error() : (symbolOop)NULL;
+ return (entry != NULL) ? entry->error() : (Symbol*)NULL;
}
}
@@ -2344,7 +2302,7 @@
// NULL if no constraint failed. The returned C string needs cleaning up
// with a ResourceMark in the caller. No exception except OOME is thrown.
// Arrays are not added to the loader constraint table, their elements are.
-char* SystemDictionary::check_signature_loaders(symbolHandle signature,
+char* SystemDictionary::check_signature_loaders(Symbol* signature,
Handle loader1, Handle loader2,
bool is_method, TRAPS) {
// Nothing to do if loaders are the same.
@@ -2352,13 +2310,14 @@
return NULL;
}
+ ResourceMark rm(THREAD);
SignatureStream sig_strm(signature, is_method);
while (!sig_strm.is_done()) {
if (sig_strm.is_object()) {
- symbolOop s = sig_strm.as_symbol(CHECK_NULL);
- symbolHandle sig (THREAD, s);
+ Symbol* s = sig_strm.as_symbol(CHECK_NULL);
+ Symbol* sig = s;
if (!add_loader_constraint(sig, loader1, loader2, THREAD)) {
- return sig()->as_C_string();
+ return sig->as_C_string();
}
}
sig_strm.next();
@@ -2367,12 +2326,12 @@
}
-methodOop SystemDictionary::find_method_handle_invoke(symbolHandle name,
- symbolHandle signature,
+methodOop SystemDictionary::find_method_handle_invoke(Symbol* name,
+ Symbol* signature,
KlassHandle accessing_klass,
TRAPS) {
if (!EnableMethodHandles) return NULL;
- vmSymbols::SID name_id = vmSymbols::find_sid(name());
+ vmSymbols::SID name_id = vmSymbols::find_sid(name);
assert(name_id != vmSymbols::NO_SID, "must be a known name");
unsigned int hash = invoke_method_table()->compute_hash(signature, name_id);
int index = invoke_method_table()->hash_to_index(hash);
@@ -2385,7 +2344,7 @@
return NULL; // do not attempt from within compiler
bool for_invokeGeneric = (name_id == vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name));
bool found_on_bcp = false;
- Handle mt = find_method_handle_type(signature(), accessing_klass,
+ Handle mt = find_method_handle_type(signature, accessing_klass,
for_invokeGeneric,
found_on_bcp, CHECK_NULL);
KlassHandle mh_klass = SystemDictionaryHandles::MethodHandle_klass();
@@ -2416,7 +2375,7 @@
// signature, as interpreted relative to the given class loader.
// Because of class loader constraints, all method handle usage must be
// consistent with this loader.
-Handle SystemDictionary::find_method_handle_type(symbolHandle signature,
+Handle SystemDictionary::find_method_handle_type(Symbol* signature,
KlassHandle accessing_klass,
bool for_invokeGeneric,
bool& return_bcp_flag,
@@ -2424,11 +2383,12 @@
Handle class_loader, protection_domain;
bool is_on_bcp = true; // keep this true as long as we can materialize from the boot classloader
Handle empty;
- int npts = ArgumentCount(signature()).size();
+ int npts = ArgumentCount(signature).size();
objArrayHandle pts = oopFactory::new_objArray(SystemDictionary::Class_klass(), npts, CHECK_(empty));
int arg = 0;
Handle rt; // the return type from the signature
- for (SignatureStream ss(signature()); !ss.is_done(); ss.next()) {
+ ResourceMark rm(THREAD);
+ for (SignatureStream ss(signature); !ss.is_done(); ss.next()) {
oop mirror = NULL;
if (is_on_bcp) {
mirror = ss.as_java_mirror(class_loader, protection_domain,
@@ -2500,17 +2460,18 @@
Handle SystemDictionary::link_method_handle_constant(KlassHandle caller,
int ref_kind, //e.g., JVM_REF_invokeVirtual
KlassHandle callee,
- symbolHandle name_sym,
- symbolHandle signature,
+ Symbol* name_sym,
+ Symbol* signature,
TRAPS) {
Handle empty;
- Handle name = java_lang_String::create_from_symbol(name_sym(), CHECK_(empty));
+ Handle name = java_lang_String::create_from_symbol(name_sym, CHECK_(empty));
Handle type;
if (signature->utf8_length() > 0 && signature->byte_at(0) == '(') {
bool ignore_is_on_bcp = false;
type = find_method_handle_type(signature, caller, false, ignore_is_on_bcp, CHECK_(empty));
} else {
- SignatureStream ss(signature(), false);
+ ResourceMark rm(THREAD);
+ SignatureStream ss(signature, false);
if (!ss.is_done()) {
oop mirror = ss.as_java_mirror(caller->class_loader(), caller->protection_domain(),
SignatureStream::NCDFError, CHECK_(empty));
@@ -2542,7 +2503,7 @@
// Ask Java code to find or construct a java.dyn.CallSite for the given
// name and signature, as interpreted relative to the given class loader.
Handle SystemDictionary::make_dynamic_call_site(Handle bootstrap_method,
- symbolHandle name,
+ Symbol* name,
methodHandle signature_invoker,
Handle info,
methodHandle caller_method,
@@ -2557,7 +2518,7 @@
MethodHandles::init_MemberName(caller_mname(), caller_method());
// call sun.dyn.MethodHandleNatives::makeDynamicCallSite(bootm, name, mtype, info, caller_mname, caller_pos)
- oop name_str_oop = StringTable::intern(name(), CHECK_(empty)); // not a handle!
+ oop name_str_oop = StringTable::intern(name, CHECK_(empty)); // not a handle!
JavaCallArguments args(Handle(THREAD, bootstrap_method()));
args.push_oop(name_str_oop);
args.push_oop(signature_invoker->method_handle_type());
@@ -2740,16 +2701,20 @@
void SystemDictionary::verify_obj_klass_present(Handle obj,
- symbolHandle class_name,
+ Symbol* class_name,
Handle class_loader) {
GCMutexLocker mu(SystemDictionary_lock);
- oop probe = find_class_or_placeholder(class_name, class_loader);
+ Symbol* name;
+
+ klassOop probe = find_class(class_name, class_loader);
if (probe == NULL) {
probe = SystemDictionary::find_shared_class(class_name);
+ if (probe == NULL) {
+ name = find_placeholder(class_name, class_loader);
+ }
}
- guarantee(probe != NULL &&
- (!probe->is_klass() || probe == obj()),
- "Loaded klasses should be in SystemDictionary");
+ guarantee(probe != NULL || name != NULL,
+ "Loaded klasses should be in SystemDictionary");
}
#ifndef PRODUCT