Small VM change #2: JVM_ entry point to extend the boot class path
Mark Reinhold
mr at sun.com
Mon May 18 15:34:27 PDT 2009
> Date: Mon, 18 May 2009 16:47:53 -0400
> From: karen.kinnear at sun.com
> Let's consider this a temporary J1 approach please. After J1 let's
> have some discussions about alternative approaches please.
Sure, absolutely.
> Question: in jvm.cpp and .hpp in the new
> JVM_ExtendBootClassPath(JNIEnv *env, jclass cls, const char *path)
> what is jclass cls used for?
Nothing; that's leftover from an initial version where I thought I was
going to use RegisterNatives for this entry point. Removed.
> also in that method, I suspect you too would like the
> ClassLoader::print_bootclasspath() to be conditional on
> TraceClassLoading - unless for the demo you want this to print always.
I meant to remove that entirely, but gating it on TraceClassLoading makes
sense, so I'll do that.
> Other than that - just for the demo - go for it.
Thanks. New patch attached FYI.
- Mark
-------------- next part --------------
diff -r 403a1b93874f make/linux/makefiles/mapfile-vers-debug
--- a/make/linux/makefiles/mapfile-vers-debug Thu May 14 14:48:35 2009 -0700
+++ b/make/linux/makefiles/mapfile-vers-debug Mon May 18 15:32:49 2009 -0700
@@ -87,6 +87,7 @@
JVM_DumpThreads;
JVM_EnableCompiler;
JVM_Exit;
+ JVM_ExtendBootClassPath;
JVM_FillInStackTrace;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
diff -r 403a1b93874f make/linux/makefiles/mapfile-vers-product
--- a/make/linux/makefiles/mapfile-vers-product Thu May 14 14:48:35 2009 -0700
+++ b/make/linux/makefiles/mapfile-vers-product Mon May 18 15:32:49 2009 -0700
@@ -87,6 +87,7 @@
JVM_DumpThreads;
JVM_EnableCompiler;
JVM_Exit;
+ JVM_ExtendBootClassPath;
JVM_FillInStackTrace;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
diff -r 403a1b93874f src/share/vm/classfile/classLoader.cpp
--- a/src/share/vm/classfile/classLoader.cpp Thu May 14 14:48:35 2009 -0700
+++ b/src/share/vm/classfile/classLoader.cpp Mon May 18 15:32:49 2009 -0700
@@ -512,12 +512,15 @@
// File or directory found
ClassPathEntry* new_entry = NULL;
create_class_path_entry((char *)path, st, &new_entry, LazyBootClassLoader);
- // The kernel VM adds dynamically to the end of the classloader path and
- // doesn't reorder the bootclasspath which would break java.lang.Package
- // (see PackageInfo).
- // Add new entry to linked list
+ // The kernel VM, and Jigsaw, add dynamically to the end of the classloader
+ // path and don't reorder the bootclasspath, which would break
+ // java.lang.Package (see PackageInfo).
if (!check_for_duplicates || !contains_entry(new_entry)) {
+ // Add new entry to linked list
add_to_list(new_entry);
+ if (TraceClassLoading) {
+ print_bootclasspath();
+ }
}
}
}
diff -r 403a1b93874f src/share/vm/classfile/classLoader.hpp
--- a/src/share/vm/classfile/classLoader.hpp Thu May 14 14:48:35 2009 -0700
+++ b/src/share/vm/classfile/classLoader.hpp Mon May 18 15:32:49 2009 -0700
@@ -190,7 +190,7 @@
// to avoid confusing the zip library
static bool get_canonical_path(char* orig, char* out, int len);
public:
- // Used by the kernel jvm.
+ // Used by the kernel jvm, and by Jigsaw via JVM_ExtendBootClassPath
static void update_class_path_entry_list(const char *path,
bool check_for_duplicates);
static void print_bootclasspath();
diff -r 403a1b93874f src/share/vm/prims/jvm.cpp
--- a/src/share/vm/prims/jvm.cpp Thu May 14 14:48:35 2009 -0700
+++ b/src/share/vm/prims/jvm.cpp Mon May 18 15:32:49 2009 -0700
@@ -851,6 +851,17 @@
(jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
JVM_END
+JVM_ENTRY(void, JVM_ExtendBootClassPath(JNIEnv *env, const char *path))
+ JVMWrapper2("JVM_ExtendBootClassPath(%s)", path)
+ {
+ // cf. SystemDictionary::download_and_retry_class_load
+ HandleMark hm(THREAD);
+ ResourceMark rm(THREAD);
+ Handle loader_lock(THREAD, SystemDictionary::system_loader_lock());
+ ObjectLocker ol(loader_lock, THREAD);
+ ClassLoader::update_class_path_entry_list(path, true);
+ }
+JVM_END
// Reflection support //////////////////////////////////////////////////////////////////////////////
diff -r 403a1b93874f src/share/vm/prims/jvm.h
--- a/src/share/vm/prims/jvm.h Thu May 14 14:48:35 2009 -0700
+++ b/src/share/vm/prims/jvm.h Mon May 18 15:32:49 2009 -0700
@@ -438,6 +438,12 @@
jobjectArray constants);
/*
+ * Append a path to the boot class path
+ */
+JNIEXPORT void JNICALL
+JVM_ExtendBootClassPath(JNIEnv *env, const char *path);
+
+/*
* Reflection support functions
*/
More information about the jigsaw-dev
mailing list