8262227: Change SystemDictionary::find() to return an InstanceKlass*.
Reviewed-by: iklam, dholmes, coleenp
This commit is contained in:
parent
35c0a6956c
commit
29c603f9dc
@ -112,8 +112,7 @@ Klass* AOTCodeHeap::lookup_klass(const char* name, int len, const Method* method
|
|||||||
log_debug(aot, class, resolve)("Probe failed for AOT class %s", name);
|
log_debug(aot, class, resolve)("Probe failed for AOT class %s", name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Klass* k = SystemDictionary::find_instance_or_array_klass(sym, loader, protection_domain, thread);
|
Klass* k = SystemDictionary::find_instance_or_array_klass(sym, loader, protection_domain);
|
||||||
assert(!thread->has_pending_exception(), "should not throw");
|
|
||||||
|
|
||||||
if (k != NULL) {
|
if (k != NULL) {
|
||||||
log_info(aot, class, resolve)("%s %s (lookup)", caller->method_holder()->external_name(), k->external_name());
|
log_info(aot, class, resolve)("%s %s (lookup)", caller->method_holder()->external_name(), k->external_name());
|
||||||
|
@ -304,10 +304,10 @@ ciInstance* ciEnv::get_or_create_exception(jobject& handle, Symbol* name) {
|
|||||||
VM_ENTRY_MARK;
|
VM_ENTRY_MARK;
|
||||||
if (handle == NULL) {
|
if (handle == NULL) {
|
||||||
// Cf. universe.cpp, creation of Universe::_null_ptr_exception_instance.
|
// Cf. universe.cpp, creation of Universe::_null_ptr_exception_instance.
|
||||||
Klass* k = SystemDictionary::find(name, Handle(), Handle(), THREAD);
|
InstanceKlass* ik = SystemDictionary::find_instance_klass(name, Handle(), Handle());
|
||||||
jobject objh = NULL;
|
jobject objh = NULL;
|
||||||
if (!HAS_PENDING_EXCEPTION && k != NULL) {
|
if (ik != NULL) {
|
||||||
oop obj = InstanceKlass::cast(k)->allocate_instance(THREAD);
|
oop obj = ik->allocate_instance(THREAD);
|
||||||
if (!HAS_PENDING_EXCEPTION)
|
if (!HAS_PENDING_EXCEPTION)
|
||||||
objh = JNIHandles::make_global(Handle(THREAD, obj));
|
objh = JNIHandles::make_global(Handle(THREAD, obj));
|
||||||
}
|
}
|
||||||
@ -448,8 +448,7 @@ ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
|
|||||||
kls = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader,
|
kls = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader,
|
||||||
CHECK_AND_CLEAR_(fail_type));
|
CHECK_AND_CLEAR_(fail_type));
|
||||||
} else {
|
} else {
|
||||||
kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain,
|
kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain);
|
||||||
CHECK_AND_CLEAR_(fail_type));
|
|
||||||
}
|
}
|
||||||
found_klass = kls;
|
found_klass = kls;
|
||||||
}
|
}
|
||||||
|
@ -899,16 +899,15 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
|
|||||||
// _dictionary->bucket(index) is read here, so the caller will not see
|
// _dictionary->bucket(index) is read here, so the caller will not see
|
||||||
// the new entry.
|
// the new entry.
|
||||||
|
|
||||||
Klass* SystemDictionary::find(Symbol* class_name,
|
InstanceKlass* SystemDictionary::find_instance_klass(Symbol* class_name,
|
||||||
Handle class_loader,
|
Handle class_loader,
|
||||||
Handle protection_domain,
|
Handle protection_domain) {
|
||||||
TRAPS) {
|
|
||||||
|
|
||||||
// The result of this call should be consistent with the result
|
// The result of this call should be consistent with the result
|
||||||
// of the call to resolve_instance_class_or_null().
|
// of the call to resolve_instance_class_or_null().
|
||||||
// See evaluation 6790209 and 4474172 for more details.
|
// See evaluation 6790209 and 4474172 for more details.
|
||||||
class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader()));
|
oop class_loader_oop = java_lang_ClassLoader::non_reflection_class_loader(class_loader());
|
||||||
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data_or_null(class_loader());
|
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data_or_null(class_loader_oop);
|
||||||
|
|
||||||
if (loader_data == NULL) {
|
if (loader_data == NULL) {
|
||||||
// If the ClassLoaderData has not been setup,
|
// If the ClassLoaderData has not been setup,
|
||||||
@ -918,16 +917,14 @@ Klass* SystemDictionary::find(Symbol* class_name,
|
|||||||
|
|
||||||
Dictionary* dictionary = loader_data->dictionary();
|
Dictionary* dictionary = loader_data->dictionary();
|
||||||
unsigned int name_hash = dictionary->compute_hash(class_name);
|
unsigned int name_hash = dictionary->compute_hash(class_name);
|
||||||
return dictionary->find(name_hash, class_name,
|
return dictionary->find(name_hash, class_name, protection_domain);
|
||||||
protection_domain);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for a loaded instance or array klass by name. Do not do any loading.
|
// Look for a loaded instance or array klass by name. Do not do any loading.
|
||||||
// return NULL in case of error.
|
// return NULL in case of error.
|
||||||
Klass* SystemDictionary::find_instance_or_array_klass(Symbol* class_name,
|
Klass* SystemDictionary::find_instance_or_array_klass(Symbol* class_name,
|
||||||
Handle class_loader,
|
Handle class_loader,
|
||||||
Handle protection_domain,
|
Handle protection_domain) {
|
||||||
TRAPS) {
|
|
||||||
Klass* k = NULL;
|
Klass* k = NULL;
|
||||||
assert(class_name != NULL, "class name must be non NULL");
|
assert(class_name != NULL, "class name must be non NULL");
|
||||||
|
|
||||||
@ -941,13 +938,13 @@ Klass* SystemDictionary::find_instance_or_array_klass(Symbol* class_name,
|
|||||||
if (t != T_OBJECT) {
|
if (t != T_OBJECT) {
|
||||||
k = Universe::typeArrayKlassObj(t);
|
k = Universe::typeArrayKlassObj(t);
|
||||||
} else {
|
} else {
|
||||||
k = SystemDictionary::find(ss.as_symbol(), class_loader, protection_domain, THREAD);
|
k = SystemDictionary::find_instance_klass(ss.as_symbol(), class_loader, protection_domain);
|
||||||
}
|
}
|
||||||
if (k != NULL) {
|
if (k != NULL) {
|
||||||
k = k->array_klass_or_null(ndims);
|
k = k->array_klass_or_null(ndims);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
k = find(class_name, class_loader, protection_domain, THREAD);
|
k = find_instance_klass(class_name, class_loader, protection_domain);
|
||||||
}
|
}
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
@ -1219,7 +1216,7 @@ bool SystemDictionary::check_shared_class_super_type(InstanceKlass* klass, Insta
|
|||||||
if (!super_type->is_shared_unregistered_class() && super_type->class_loader_data() != NULL) {
|
if (!super_type->is_shared_unregistered_class() && super_type->class_loader_data() != NULL) {
|
||||||
// Check if the super class is loaded by the current class_loader
|
// Check if the super class is loaded by the current class_loader
|
||||||
Symbol* name = super_type->name();
|
Symbol* name = super_type->name();
|
||||||
Klass* check = find(name, class_loader, protection_domain, CHECK_0);
|
InstanceKlass* check = find_instance_klass(name, class_loader, protection_domain);
|
||||||
if (check == super_type) {
|
if (check == super_type) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1897,7 +1894,7 @@ Klass* SystemDictionary::find_constrained_instance_or_array_klass(
|
|||||||
// Force the protection domain to be null. (This removes protection checks.)
|
// Force the protection domain to be null. (This removes protection checks.)
|
||||||
Handle no_protection_domain;
|
Handle no_protection_domain;
|
||||||
Klass* klass = find_instance_or_array_klass(class_name, class_loader,
|
Klass* klass = find_instance_or_array_klass(class_name, class_loader,
|
||||||
no_protection_domain, CHECK_NULL);
|
no_protection_domain);
|
||||||
if (klass != NULL)
|
if (klass != NULL)
|
||||||
return klass;
|
return klass;
|
||||||
|
|
||||||
|
@ -139,15 +139,14 @@ class SystemDictionary : AllStatic {
|
|||||||
TRAPS);
|
TRAPS);
|
||||||
|
|
||||||
// Lookup an already loaded class. If not found NULL is returned.
|
// Lookup an already loaded class. If not found NULL is returned.
|
||||||
static Klass* find(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS);
|
static InstanceKlass* find_instance_klass(Symbol* class_name, Handle class_loader, Handle protection_domain);
|
||||||
|
|
||||||
// Lookup an already loaded instance or array class.
|
// Lookup an already loaded instance or array class.
|
||||||
// Do not make any queries to class loaders; consult only the cache.
|
// Do not make any queries to class loaders; consult only the cache.
|
||||||
// If not found NULL is returned.
|
// If not found NULL is returned.
|
||||||
static Klass* find_instance_or_array_klass(Symbol* class_name,
|
static Klass* find_instance_or_array_klass(Symbol* class_name,
|
||||||
Handle class_loader,
|
Handle class_loader,
|
||||||
Handle protection_domain,
|
Handle protection_domain);
|
||||||
TRAPS);
|
|
||||||
|
|
||||||
// Lookup an instance or array class that has already been loaded
|
// Lookup an instance or array class that has already been loaded
|
||||||
// either into the given class loader, or else into another class
|
// either into the given class loader, or else into another class
|
||||||
|
@ -1513,7 +1513,7 @@ static bool is_retransforming(const InstanceKlass* ik, TRAPS) {
|
|||||||
assert(name != NULL, "invariant");
|
assert(name != NULL, "invariant");
|
||||||
Handle class_loader(THREAD, ik->class_loader());
|
Handle class_loader(THREAD, ik->class_loader());
|
||||||
Handle protection_domain(THREAD, ik->protection_domain());
|
Handle protection_domain(THREAD, ik->protection_domain());
|
||||||
return SystemDictionary::find(name, class_loader, protection_domain, THREAD) != NULL;
|
return SystemDictionary::find_instance_klass(name, class_loader, protection_domain) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// target for JFR_ON_KLASS_CREATION hook
|
// target for JFR_ON_KLASS_CREATION hook
|
||||||
|
@ -547,16 +547,17 @@ C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, jcla
|
|||||||
// This is a name from a signature. Strip off the trimmings.
|
// This is a name from a signature. Strip off the trimmings.
|
||||||
// Call recursive to keep scope of strippedsym.
|
// Call recursive to keep scope of strippedsym.
|
||||||
TempNewSymbol strippedsym = Signature::strip_envelope(class_name);
|
TempNewSymbol strippedsym = Signature::strip_envelope(class_name);
|
||||||
resolved_klass = SystemDictionary::find(strippedsym, class_loader, protection_domain, CHECK_NULL);
|
resolved_klass = SystemDictionary::find_instance_klass(strippedsym,
|
||||||
|
class_loader,
|
||||||
|
protection_domain);
|
||||||
} else if (Signature::is_array(class_name)) {
|
} else if (Signature::is_array(class_name)) {
|
||||||
SignatureStream ss(class_name, false);
|
SignatureStream ss(class_name, false);
|
||||||
int ndim = ss.skip_array_prefix();
|
int ndim = ss.skip_array_prefix();
|
||||||
if (ss.type() == T_OBJECT) {
|
if (ss.type() == T_OBJECT) {
|
||||||
Symbol* strippedsym = ss.as_symbol();
|
Symbol* strippedsym = ss.as_symbol();
|
||||||
resolved_klass = SystemDictionary::find(strippedsym,
|
resolved_klass = SystemDictionary::find_instance_klass(strippedsym,
|
||||||
class_loader,
|
class_loader,
|
||||||
protection_domain,
|
protection_domain);
|
||||||
CHECK_NULL);
|
|
||||||
if (!resolved_klass.is_null()) {
|
if (!resolved_klass.is_null()) {
|
||||||
resolved_klass = resolved_klass->array_klass(ndim, CHECK_NULL);
|
resolved_klass = resolved_klass->array_klass(ndim, CHECK_NULL);
|
||||||
}
|
}
|
||||||
@ -564,7 +565,9 @@ C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, jcla
|
|||||||
resolved_klass = TypeArrayKlass::cast(Universe::typeArrayKlassObj(ss.type()))->array_klass(ndim, CHECK_NULL);
|
resolved_klass = TypeArrayKlass::cast(Universe::typeArrayKlassObj(ss.type()))->array_klass(ndim, CHECK_NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resolved_klass = SystemDictionary::find(class_name, class_loader, protection_domain, CHECK_NULL);
|
resolved_klass = SystemDictionary::find_instance_klass(class_name,
|
||||||
|
class_loader,
|
||||||
|
protection_domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JVMCIObject result = JVMCIENV->get_jvmci_type(resolved_klass, JVMCI_CHECK_NULL);
|
JVMCIObject result = JVMCIENV->get_jvmci_type(resolved_klass, JVMCI_CHECK_NULL);
|
||||||
|
@ -1162,7 +1162,7 @@ Klass* JVMCIRuntime::get_klass_by_name_impl(Klass*& accessing_klass,
|
|||||||
if (!require_local) {
|
if (!require_local) {
|
||||||
found_klass = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader, CHECK_NULL);
|
found_klass = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader, CHECK_NULL);
|
||||||
} else {
|
} else {
|
||||||
found_klass = SystemDictionary::find_instance_or_array_klass(sym, loader, domain, CHECK_NULL);
|
found_klass = SystemDictionary::find_instance_or_array_klass(sym, loader, domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ Klass* ConstantPool::klass_at_if_loaded(const constantPoolHandle& this_cp, int w
|
|||||||
oop protection_domain = this_cp->pool_holder()->protection_domain();
|
oop protection_domain = this_cp->pool_holder()->protection_domain();
|
||||||
Handle h_prot (thread, protection_domain);
|
Handle h_prot (thread, protection_domain);
|
||||||
Handle h_loader (thread, loader);
|
Handle h_loader (thread, loader);
|
||||||
Klass* k = SystemDictionary::find(name, h_loader, h_prot, thread);
|
Klass* k = SystemDictionary::find_instance_klass(name, h_loader, h_prot);
|
||||||
|
|
||||||
// Avoid constant pool verification at a safepoint, which takes the Module_lock.
|
// Avoid constant pool verification at a safepoint, which takes the Module_lock.
|
||||||
if (k != NULL && !SafepointSynchronize::is_at_safepoint()) {
|
if (k != NULL && !SafepointSynchronize::is_at_safepoint()) {
|
||||||
|
@ -891,7 +891,7 @@ bool Method::is_klass_loaded_by_klass_index(int klass_index) const {
|
|||||||
Symbol* klass_name = constants()->klass_name_at(klass_index);
|
Symbol* klass_name = constants()->klass_name_at(klass_index);
|
||||||
Handle loader(thread, method_holder()->class_loader());
|
Handle loader(thread, method_holder()->class_loader());
|
||||||
Handle prot (thread, method_holder()->protection_domain());
|
Handle prot (thread, method_holder()->protection_domain());
|
||||||
return SystemDictionary::find(klass_name, loader, prot, thread) != NULL;
|
return SystemDictionary::find_instance_klass(klass_name, loader, prot) != NULL;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1070,8 +1070,7 @@ JVM_ENTRY(jclass, JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name)
|
|||||||
Handle h_loader(THREAD, JNIHandles::resolve(loader));
|
Handle h_loader(THREAD, JNIHandles::resolve(loader));
|
||||||
Klass* k = SystemDictionary::find_instance_or_array_klass(klass_name,
|
Klass* k = SystemDictionary::find_instance_or_array_klass(klass_name,
|
||||||
h_loader,
|
h_loader,
|
||||||
Handle(),
|
Handle());
|
||||||
CHECK_NULL);
|
|
||||||
#if INCLUDE_CDS
|
#if INCLUDE_CDS
|
||||||
if (k == NULL) {
|
if (k == NULL) {
|
||||||
// If the class is not already loaded, try to see if it's in the shared
|
// If the class is not already loaded, try to see if it's in the shared
|
||||||
|
@ -903,12 +903,11 @@ Deoptimization::DeoptAction Deoptimization::_unloaded_action
|
|||||||
template<typename CacheType>
|
template<typename CacheType>
|
||||||
class BoxCacheBase : public CHeapObj<mtCompiler> {
|
class BoxCacheBase : public CHeapObj<mtCompiler> {
|
||||||
protected:
|
protected:
|
||||||
static InstanceKlass* find_cache_klass(Symbol* klass_name, TRAPS) {
|
static InstanceKlass* find_cache_klass(Symbol* klass_name) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
char* klass_name_str = klass_name->as_C_string();
|
char* klass_name_str = klass_name->as_C_string();
|
||||||
Klass* k = SystemDictionary::find(klass_name, Handle(), Handle(), THREAD);
|
InstanceKlass* ik = SystemDictionary::find_instance_klass(klass_name, Handle(), Handle());
|
||||||
guarantee(k != NULL, "%s must be loaded", klass_name_str);
|
guarantee(ik != NULL, "%s must be loaded", klass_name_str);
|
||||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
|
||||||
guarantee(ik->is_initialized(), "%s must be initialized", klass_name_str);
|
guarantee(ik->is_initialized(), "%s must be initialized", klass_name_str);
|
||||||
CacheType::compute_offsets(ik);
|
CacheType::compute_offsets(ik);
|
||||||
return ik;
|
return ik;
|
||||||
@ -922,7 +921,7 @@ template<typename PrimitiveType, typename CacheType, typename BoxType> class Box
|
|||||||
protected:
|
protected:
|
||||||
static BoxCache<PrimitiveType, CacheType, BoxType> *_singleton;
|
static BoxCache<PrimitiveType, CacheType, BoxType> *_singleton;
|
||||||
BoxCache(Thread* thread) {
|
BoxCache(Thread* thread) {
|
||||||
InstanceKlass* ik = BoxCacheBase<CacheType>::find_cache_klass(CacheType::symbol(), thread);
|
InstanceKlass* ik = BoxCacheBase<CacheType>::find_cache_klass(CacheType::symbol());
|
||||||
objArrayOop cache = CacheType::cache(ik);
|
objArrayOop cache = CacheType::cache(ik);
|
||||||
assert(cache->length() > 0, "Empty cache");
|
assert(cache->length() > 0, "Empty cache");
|
||||||
_low = BoxType::value(cache->obj_at(0));
|
_low = BoxType::value(cache->obj_at(0));
|
||||||
@ -978,7 +977,7 @@ class BooleanBoxCache : public BoxCacheBase<java_lang_Boolean> {
|
|||||||
protected:
|
protected:
|
||||||
static BooleanBoxCache *_singleton;
|
static BooleanBoxCache *_singleton;
|
||||||
BooleanBoxCache(Thread *thread) {
|
BooleanBoxCache(Thread *thread) {
|
||||||
InstanceKlass* ik = find_cache_klass(java_lang_Boolean::symbol(), thread);
|
InstanceKlass* ik = find_cache_klass(java_lang_Boolean::symbol());
|
||||||
_true_cache = JNIHandles::make_global(Handle(thread, java_lang_Boolean::get_TRUE(ik)));
|
_true_cache = JNIHandles::make_global(Handle(thread, java_lang_Boolean::get_TRUE(ik)));
|
||||||
_false_cache = JNIHandles::make_global(Handle(thread, java_lang_Boolean::get_FALSE(ik)));
|
_false_cache = JNIHandles::make_global(Handle(thread, java_lang_Boolean::get_FALSE(ik)));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -393,7 +393,7 @@ Klass* SignatureStream::as_klass(Handle class_loader, Handle protection_domain,
|
|||||||
} else if (failure_mode == CachedOrNull) {
|
} else if (failure_mode == CachedOrNull) {
|
||||||
NoSafepointVerifier nsv; // no loading, now, we mean it!
|
NoSafepointVerifier nsv; // no loading, now, we mean it!
|
||||||
assert(!HAS_PENDING_EXCEPTION, "");
|
assert(!HAS_PENDING_EXCEPTION, "");
|
||||||
k = SystemDictionary::find(name, class_loader, protection_domain, CHECK_NULL);
|
k = SystemDictionary::find_instance_klass(name, class_loader, protection_domain);
|
||||||
// SD::find does not trigger loading, so there should be no throws
|
// SD::find does not trigger loading, so there should be no throws
|
||||||
// Still, bad things can happen, so we CHECK_NULL and ask callers
|
// Still, bad things can happen, so we CHECK_NULL and ask callers
|
||||||
// to do likewise.
|
// to do likewise.
|
||||||
|
@ -903,15 +903,13 @@ char java_runtime_vendor_version[128] = "";
|
|||||||
char java_runtime_vendor_vm_bug_url[128] = "";
|
char java_runtime_vendor_vm_bug_url[128] = "";
|
||||||
|
|
||||||
// extract the JRE version string from java.lang.VersionProps.java_version
|
// extract the JRE version string from java.lang.VersionProps.java_version
|
||||||
static const char* get_java_version(TRAPS) {
|
static const char* get_java_version(InstanceKlass* ik) {
|
||||||
Klass* k = SystemDictionary::find(vmSymbols::java_lang_VersionProps(),
|
|
||||||
Handle(), Handle(), CHECK_AND_CLEAR_NULL);
|
|
||||||
fieldDescriptor fd;
|
fieldDescriptor fd;
|
||||||
bool found = k != NULL &&
|
bool found = ik != NULL &&
|
||||||
InstanceKlass::cast(k)->find_local_field(vmSymbols::java_version_name(),
|
ik->find_local_field(vmSymbols::java_version_name(),
|
||||||
vmSymbols::string_signature(), &fd);
|
vmSymbols::string_signature(), &fd);
|
||||||
if (found) {
|
if (found) {
|
||||||
oop name_oop = k->java_mirror()->obj_field(fd.offset());
|
oop name_oop = ik->java_mirror()->obj_field(fd.offset());
|
||||||
if (name_oop == NULL) {
|
if (name_oop == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -925,15 +923,13 @@ static const char* get_java_version(TRAPS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// extract the JRE name from java.lang.VersionProps.java_runtime_name
|
// extract the JRE name from java.lang.VersionProps.java_runtime_name
|
||||||
static const char* get_java_runtime_name(TRAPS) {
|
static const char* get_java_runtime_name(InstanceKlass* ik) {
|
||||||
Klass* k = SystemDictionary::find(vmSymbols::java_lang_VersionProps(),
|
|
||||||
Handle(), Handle(), CHECK_AND_CLEAR_NULL);
|
|
||||||
fieldDescriptor fd;
|
fieldDescriptor fd;
|
||||||
bool found = k != NULL &&
|
bool found = ik != NULL &&
|
||||||
InstanceKlass::cast(k)->find_local_field(vmSymbols::java_runtime_name_name(),
|
ik->find_local_field(vmSymbols::java_runtime_name_name(),
|
||||||
vmSymbols::string_signature(), &fd);
|
vmSymbols::string_signature(), &fd);
|
||||||
if (found) {
|
if (found) {
|
||||||
oop name_oop = k->java_mirror()->obj_field(fd.offset());
|
oop name_oop = ik->java_mirror()->obj_field(fd.offset());
|
||||||
if (name_oop == NULL) {
|
if (name_oop == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -947,15 +943,13 @@ static const char* get_java_runtime_name(TRAPS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// extract the JRE version from java.lang.VersionProps.java_runtime_version
|
// extract the JRE version from java.lang.VersionProps.java_runtime_version
|
||||||
static const char* get_java_runtime_version(TRAPS) {
|
static const char* get_java_runtime_version(InstanceKlass* ik) {
|
||||||
Klass* k = SystemDictionary::find(vmSymbols::java_lang_VersionProps(),
|
|
||||||
Handle(), Handle(), CHECK_AND_CLEAR_NULL);
|
|
||||||
fieldDescriptor fd;
|
fieldDescriptor fd;
|
||||||
bool found = k != NULL &&
|
bool found = ik != NULL &&
|
||||||
InstanceKlass::cast(k)->find_local_field(vmSymbols::java_runtime_version_name(),
|
ik->find_local_field(vmSymbols::java_runtime_version_name(),
|
||||||
vmSymbols::string_signature(), &fd);
|
vmSymbols::string_signature(), &fd);
|
||||||
if (found) {
|
if (found) {
|
||||||
oop name_oop = k->java_mirror()->obj_field(fd.offset());
|
oop name_oop = ik->java_mirror()->obj_field(fd.offset());
|
||||||
if (name_oop == NULL) {
|
if (name_oop == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -969,15 +963,13 @@ static const char* get_java_runtime_version(TRAPS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// extract the JRE vendor version from java.lang.VersionProps.VENDOR_VERSION
|
// extract the JRE vendor version from java.lang.VersionProps.VENDOR_VERSION
|
||||||
static const char* get_java_runtime_vendor_version(TRAPS) {
|
static const char* get_java_runtime_vendor_version(InstanceKlass* ik) {
|
||||||
Klass* k = SystemDictionary::find(vmSymbols::java_lang_VersionProps(),
|
|
||||||
Handle(), Handle(), CHECK_AND_CLEAR_NULL);
|
|
||||||
fieldDescriptor fd;
|
fieldDescriptor fd;
|
||||||
bool found = k != NULL &&
|
bool found = ik != NULL &&
|
||||||
InstanceKlass::cast(k)->find_local_field(vmSymbols::java_runtime_vendor_version_name(),
|
ik->find_local_field(vmSymbols::java_runtime_vendor_version_name(),
|
||||||
vmSymbols::string_signature(), &fd);
|
vmSymbols::string_signature(), &fd);
|
||||||
if (found) {
|
if (found) {
|
||||||
oop name_oop = k->java_mirror()->obj_field(fd.offset());
|
oop name_oop = ik->java_mirror()->obj_field(fd.offset());
|
||||||
if (name_oop == NULL) {
|
if (name_oop == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -991,15 +983,13 @@ static const char* get_java_runtime_vendor_version(TRAPS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// extract the JRE vendor VM bug URL from java.lang.VersionProps.VENDOR_URL_VM_BUG
|
// extract the JRE vendor VM bug URL from java.lang.VersionProps.VENDOR_URL_VM_BUG
|
||||||
static const char* get_java_runtime_vendor_vm_bug_url(TRAPS) {
|
static const char* get_java_runtime_vendor_vm_bug_url(InstanceKlass* ik) {
|
||||||
Klass* k = SystemDictionary::find(vmSymbols::java_lang_VersionProps(),
|
|
||||||
Handle(), Handle(), CHECK_AND_CLEAR_NULL);
|
|
||||||
fieldDescriptor fd;
|
fieldDescriptor fd;
|
||||||
bool found = k != NULL &&
|
bool found = ik != NULL &&
|
||||||
InstanceKlass::cast(k)->find_local_field(vmSymbols::java_runtime_vendor_vm_bug_url_name(),
|
ik->find_local_field(vmSymbols::java_runtime_vendor_vm_bug_url_name(),
|
||||||
vmSymbols::string_signature(), &fd);
|
vmSymbols::string_signature(), &fd);
|
||||||
if (found) {
|
if (found) {
|
||||||
oop name_oop = k->java_mirror()->obj_field(fd.offset());
|
oop name_oop = ik->java_mirror()->obj_field(fd.offset());
|
||||||
if (name_oop == NULL) {
|
if (name_oop == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -3022,11 +3012,13 @@ void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
|
|||||||
call_initPhase1(CHECK);
|
call_initPhase1(CHECK);
|
||||||
|
|
||||||
// get the Java runtime name, version, and vendor info after java.lang.System is initialized
|
// get the Java runtime name, version, and vendor info after java.lang.System is initialized
|
||||||
JDK_Version::set_java_version(get_java_version(THREAD));
|
InstanceKlass* ik = SystemDictionary::find_instance_klass(vmSymbols::java_lang_VersionProps(),
|
||||||
JDK_Version::set_runtime_name(get_java_runtime_name(THREAD));
|
Handle(), Handle());
|
||||||
JDK_Version::set_runtime_version(get_java_runtime_version(THREAD));
|
JDK_Version::set_java_version(get_java_version(ik));
|
||||||
JDK_Version::set_runtime_vendor_version(get_java_runtime_vendor_version(THREAD));
|
JDK_Version::set_runtime_name(get_java_runtime_name(ik));
|
||||||
JDK_Version::set_runtime_vendor_vm_bug_url(get_java_runtime_vendor_vm_bug_url(THREAD));
|
JDK_Version::set_runtime_version(get_java_runtime_version(ik));
|
||||||
|
JDK_Version::set_runtime_vendor_version(get_java_runtime_vendor_version(ik));
|
||||||
|
JDK_Version::set_runtime_vendor_vm_bug_url(get_java_runtime_vendor_vm_bug_url(ik));
|
||||||
|
|
||||||
// an instance of OutOfMemory exception has been allocated earlier
|
// an instance of OutOfMemory exception has been allocated earlier
|
||||||
initialize_class(vmSymbols::java_lang_OutOfMemoryError(), CHECK);
|
initialize_class(vmSymbols::java_lang_OutOfMemoryError(), CHECK);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user