mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8252689: Classes are loaded from jrt:/java.base even when CDS is used
Reviewed-by: iklam, ccheung
This commit is contained in:
parent
c5e63b639e
commit
f978f6fe8a
3 changed files with 22 additions and 16 deletions
|
@ -655,6 +655,22 @@ static RunTimeSharedDictionary _unregistered_dictionary;
|
|||
static RunTimeSharedDictionary _dynamic_builtin_dictionary;
|
||||
static RunTimeSharedDictionary _dynamic_unregistered_dictionary;
|
||||
|
||||
|
||||
Handle SystemDictionaryShared::create_jar_manifest(const char* manifest_chars, size_t size, TRAPS) {
|
||||
typeArrayOop buf = oopFactory::new_byteArray((int)size, CHECK_NH);
|
||||
typeArrayHandle bufhandle(THREAD, buf);
|
||||
ArrayAccess<>::arraycopy_from_native(reinterpret_cast<const jbyte*>(manifest_chars),
|
||||
buf, typeArrayOopDesc::element_offset<jbyte>(0), size);
|
||||
Handle bais = JavaCalls::construct_new_instance(SystemDictionary::ByteArrayInputStream_klass(),
|
||||
vmSymbols::byte_array_void_signature(),
|
||||
bufhandle, CHECK_NH);
|
||||
// manifest = new Manifest(ByteArrayInputStream)
|
||||
Handle manifest = JavaCalls::construct_new_instance(SystemDictionary::Jar_Manifest_klass(),
|
||||
vmSymbols::input_stream_void_signature(),
|
||||
bais, CHECK_NH);
|
||||
return manifest;
|
||||
}
|
||||
|
||||
oop SystemDictionaryShared::shared_protection_domain(int index) {
|
||||
return ((objArrayOop)_shared_protection_domains.resolve())->obj_at(index);
|
||||
}
|
||||
|
@ -671,30 +687,17 @@ Handle SystemDictionaryShared::get_shared_jar_manifest(int shared_path_index, TR
|
|||
Handle manifest ;
|
||||
if (shared_jar_manifest(shared_path_index) == NULL) {
|
||||
SharedClassPathEntry* ent = FileMapInfo::shared_path(shared_path_index);
|
||||
long size = ent->manifest_size();
|
||||
if (size <= 0) {
|
||||
size_t size = (size_t)ent->manifest_size();
|
||||
if (size == 0) {
|
||||
return Handle();
|
||||
}
|
||||
|
||||
// ByteArrayInputStream bais = new ByteArrayInputStream(buf);
|
||||
const char* src = ent->manifest();
|
||||
assert(src != NULL, "No Manifest data");
|
||||
typeArrayOop buf = oopFactory::new_byteArray(size, CHECK_NH);
|
||||
typeArrayHandle bufhandle(THREAD, buf);
|
||||
ArrayAccess<>::arraycopy_from_native(reinterpret_cast<const jbyte*>(src),
|
||||
buf, typeArrayOopDesc::element_offset<jbyte>(0), size);
|
||||
|
||||
Handle bais = JavaCalls::construct_new_instance(SystemDictionary::ByteArrayInputStream_klass(),
|
||||
vmSymbols::byte_array_void_signature(),
|
||||
bufhandle, CHECK_NH);
|
||||
|
||||
// manifest = new Manifest(bais)
|
||||
manifest = JavaCalls::construct_new_instance(SystemDictionary::Jar_Manifest_klass(),
|
||||
vmSymbols::input_stream_void_signature(),
|
||||
bais, CHECK_NH);
|
||||
manifest = create_jar_manifest(src, size, THREAD);
|
||||
atomic_set_shared_jar_manifest(shared_path_index, manifest());
|
||||
}
|
||||
|
||||
manifest = Handle(THREAD, shared_jar_manifest(shared_path_index));
|
||||
assert(manifest.not_null(), "sanity");
|
||||
return manifest;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue