diff options
author | Tom Tromey <tromey@redhat.com> | 2005-04-01 19:19:13 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2005-04-01 19:19:13 +0000 |
commit | ef87438639663154314e2cc5cd692eddaebfc799 (patch) | |
tree | 3d09f5cb569908269df7399fc0b8e4ca62d64f71 /libjava/java/lang/VMClassLoader.java | |
parent | 35913faefbd7d9de8847f449ac4fd750b383e75f (diff) | |
download | gcc-ef87438639663154314e2cc5cd692eddaebfc799.zip gcc-ef87438639663154314e2cc5cd692eddaebfc799.tar.gz gcc-ef87438639663154314e2cc5cd692eddaebfc799.tar.bz2 |
natVMClassLoader.cc (getSystemClassLoaderInternal): Updated for name change.
* java/lang/natVMClassLoader.cc (getSystemClassLoaderInternal):
Updated for name change.
(nativeFindClass): New method.
(loadClass): Use nativeFindClass.
* java/lang/natClassLoader.cc (_Jv_FindClass): Use single-argument
form of loadClass.
* java/lang/VMClassLoader.java (tried_libraries, lib_control,
LIB_FULL, LIB_CACHE, LIB_NEVER): New fields from old
VMClassLoader.
(initialize): New method.
(nativeFindClass): Declare.
* gnu/gcj/runtime/natVMClassLoader.cc: Removed.
* gnu/gcj/runtime/VMClassLoader.java: Removed.
* gnu/gcj/runtime/ExtensionClassLoader.java: Renamed from
VMClassLoader.java.
(definePackageForNative): Removed.
(tried_libraries, LIB_CACHE, LIB_FULL, LIB_NEVER, lib_control):
Moved to VMClassLoader.java.
* prims.cc (_Jv_CreateJavaVM): Updated for renaming.
* Makefile.am (gnu/gcj/runtime/ExtensionClassLoader.h): Renamed.
(ordinary_java_source_files): Added ExtensionClassLoader.java,
removed VMClassLoader.java.
(nat_source_files): Removed natVMClassLoader.cc.
From-SVN: r97414
Diffstat (limited to 'libjava/java/lang/VMClassLoader.java')
-rw-r--r-- | libjava/java/lang/VMClassLoader.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libjava/java/lang/VMClassLoader.java b/libjava/java/lang/VMClassLoader.java index dfbfba4..c48fc70 100644 --- a/libjava/java/lang/VMClassLoader.java +++ b/libjava/java/lang/VMClassLoader.java @@ -51,6 +51,7 @@ import java.security.ProtectionDomain; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.StringTokenizer; import gnu.gcj.runtime.BootClassLoader; @@ -87,6 +88,17 @@ final class VMClassLoader // until we've initialized the system, at which point it is created. static BootClassLoader bootLoader; + // This keeps track of shared libraries we've already tried to load. + private static HashSet tried_libraries; + + // Holds one of the LIB_* constants; used to determine how shared + // library loads are done. + private static int lib_control; + + private static final int LIB_FULL = 0; + private static final int LIB_CACHE = 1; + private static final int LIB_NEVER = 2; + /** * Helper to define a class using a string of bytes. This assumes that * the security checks have already been performed, if necessary. @@ -298,6 +310,30 @@ final class VMClassLoader static native void initBootLoader(String libdir); + static void initialize(String libdir) + { + initBootLoader(libdir); + + String p + = System.getProperty ("gnu.gcj.runtime.VMClassLoader.library_control", + ""); + if ("never".equals(p)) + lib_control = LIB_NEVER; + else if ("cache".equals(p)) + lib_control = LIB_CACHE; + else if ("full".equals(p)) + lib_control = LIB_FULL; + else + lib_control = LIB_CACHE; + + tried_libraries = new HashSet(); + } + + /** + * Possibly load a .so and search it for classes. + */ + static native Class nativeFindClass(String name); + static ClassLoader getSystemClassLoader() { // This method is called as the initialization of systemClassLoader, |