Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8228336: Refactor native library loading implementation
Reviewed-by: alanb, dholmes
  • Loading branch information
Mandy Chung committed Mar 12, 2020
1 parent 36fac8c commit d5d6dc0caa1d2db6e85b3fe979ae7a204678de57
@@ -65,7 +65,6 @@
template(java_lang_Cloneable, "java/lang/Cloneable") \
template(java_lang_Throwable, "java/lang/Throwable") \
template(java_lang_ClassLoader, "java/lang/ClassLoader") \
template(java_lang_ClassLoader_NativeLibrary, "java/lang/ClassLoader\x024NativeLibrary") \
template(java_lang_ThreadDeath, "java/lang/ThreadDeath") \
template(java_lang_Boolean, "java/lang/Boolean") \
template(java_lang_Character, "java/lang/Character") \
@@ -130,6 +129,7 @@
template(java_util_Iterator, "java/util/Iterator") \
template(java_lang_Record, "java/lang/Record") \
\
template(jdk_internal_loader_NativeLibraries, "jdk/internal/loader/NativeLibraries") \
template(jdk_internal_loader_ClassLoaders_AppClassLoader, "jdk/internal/loader/ClassLoaders$AppClassLoader") \
template(jdk_internal_loader_ClassLoaders_PlatformClassLoader, "jdk/internal/loader/ClassLoaders$PlatformClassLoader") \
\
@@ -397,13 +397,13 @@ JNI_ENTRY(jclass, jni_FindClass(JNIEnv *env, const char *name))
// Special handling to make sure JNI_OnLoad and JNI_OnUnload are executed
// in the correct class context.
if (k->class_loader() == NULL &&
k->name() == vmSymbols::java_lang_ClassLoader_NativeLibrary()) {
k->name() == vmSymbols::jdk_internal_loader_NativeLibraries()) {
JavaValue result(T_OBJECT);
JavaCalls::call_static(&result, k,
vmSymbols::getFromClass_name(),
vmSymbols::void_class_signature(),
CHECK_NULL);
// When invoked from JNI_OnLoad, NativeLibrary::getFromClass returns
// When invoked from JNI_OnLoad, NativeLibraries::getFromClass returns
// a non-NULL Class object. When invoked from JNI_OnUnload,
// it will return NULL to indicate no context.
oop mirror = (oop) result.get_jobject();
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -159,7 +159,7 @@ address NativeLookup::lookup_style(const methodHandle& method, char* pure_name,

// If the loader is null we have a system class, so we attempt a lookup in
// the native Java library. This takes care of any bootstrapping problems.
// Note: It is critical for bootstrapping that Java_java_lang_ClassLoader_00024NativeLibrary_find
// Note: It is critical for bootstrapping that Java_java_lang_ClassLoader_findNative
// gets found the first time around - otherwise an infinite loop can occure. This is
// another VM/library dependency
Handle loader(THREAD, method->method_holder()->class_loader());
@@ -23,7 +23,7 @@
* questions.
*/

package java.lang;
package jdk.internal.loader;

import java.io.File;
import java.util.ArrayList;

0 comments on commit d5d6dc0

Please sign in to comment.