Mercurial > hg > openjdk > jigsaw > hotspot
changeset 1292:4ac54e858f41 jigsaw-b02
Use jdk-module-image to build hotspot
Summary: gamma launcher to look for jvm from lib/<arch> and jre/lib/<arch>
Reviewed-by: acorn, ohair
author | mchung |
---|---|
date | Fri, 02 Apr 2010 23:08:59 -0700 |
parents | 7541747f1818 |
children | f59c81b1afe9 |
files | make/linux/makefiles/sa.make make/solaris/makefiles/sa.make make/windows/makefiles/vm.make src/os/linux/vm/os_linux.cpp src/os/solaris/vm/os_solaris.cpp |
diffstat | 5 files changed, 40 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/make/linux/makefiles/sa.make Sat Mar 20 16:48:02 2010 -0700 +++ b/make/linux/makefiles/sa.make Fri Apr 02 23:08:59 2010 -0700 @@ -40,6 +40,10 @@ # tools.jar is needed by the JDI - SA binding SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/tools.jar +# FIXME: if it's a modules image, should we check +# if SA module is installed? +MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules + # gnumake 3.78.1 does not accept the *s that # are in AGENT_FILES1 and AGENT_FILES2, so use the shell to expand them AGENT_FILES1 := $(shell /usr/bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES1)) @@ -65,7 +69,7 @@ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ fi - $(QUIETLY) if [ ! -f $(SA_CLASSPATH) ] ; then \ + $(QUIETLY) if [ ! -f $(SA_CLASSPATH) -a ! -d $(MODULELIB_PATH) ] ; then \ echo "Missing $(SA_CLASSPATH) file. Use 1.6.0 or later version of JDK";\ echo ""; \ exit 1; \
--- a/make/solaris/makefiles/sa.make Sat Mar 20 16:48:02 2010 -0700 +++ b/make/solaris/makefiles/sa.make Fri Apr 02 23:08:59 2010 -0700 @@ -36,6 +36,10 @@ # tools.jar is needed by the JDI - SA binding SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/tools.jar +# FIXME: if it's a modules image, should we check +# if SA module is installed? +MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules + # gnumake 3.78.1 does not accept the *s that # are in AGENT_FILES1 and AGENT_FILES2, so use the shell to expand them AGENT_FILES1 := $(shell /usr/bin/test -d $(AGENT_DIR) && /bin/ls $(AGENT_FILES1)) @@ -59,7 +63,7 @@ echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ exit 1; \ fi - $(QUIETLY) if [ ! -f $(SA_CLASSPATH) ] ; then \ + $(QUIETLY) if [ ! -f $(SA_CLASSPATH) -a ! -d $(MODULELIB_PATH) ] ; then \ echo "Missing $(SA_CLASSPATH) file. Use 1.6.0 or later version of JDK";\ echo ""; \ exit 1; \
--- a/make/windows/makefiles/vm.make Sat Mar 20 16:48:02 2010 -0700 +++ b/make/windows/makefiles/vm.make Fri Apr 02 23:08:59 2010 -0700 @@ -108,7 +108,8 @@ /export:JVM_GetVersionInfo \ /export:JVM_GetThreadStateNames \ /export:JVM_GetThreadStateValues \ - /export:JVM_InitAgentProperties + /export:JVM_InitAgentProperties \ + /export:JVM_ExtendBootClassPath CPP_INCLUDE_DIRS=\ /I "..\generated" \
--- a/src/os/linux/vm/os_linux.cpp Sat Mar 20 16:48:02 2010 -0700 +++ b/src/os/linux/vm/os_linux.cpp Fri Apr 02 23:08:59 2010 -0700 @@ -2072,9 +2072,9 @@ static char saved_jvm_path[MAXPATHLEN] = {0}; // Find the full path to the current module, libjvm.so or libjvm_g.so -void os::jvm_path(char *buf, jint len) { +void os::jvm_path(char *buf, jint buflen) { // Error checking. - if (len < MAXPATHLEN) { + if (buflen < MAXPATHLEN) { assert(false, "must use a large-enough buffer"); buf[0] = '\0'; return; @@ -2110,6 +2110,9 @@ // Look for JAVA_HOME in the environment. char* java_home_var = ::getenv("JAVA_HOME"); if (java_home_var != NULL && java_home_var[0] != 0) { + char* jrelib_p; + int len; + // Check the current module name "libjvm.so" or "libjvm_g.so". p = strrchr(buf, '/'); assert(strstr(p, "/libjvm") == p, "invalid library name"); @@ -2117,14 +2120,22 @@ if (realpath(java_home_var, buf) == NULL) return; - sprintf(buf + strlen(buf), "/jre/lib/%s", cpu_arch); + + len = strlen(buf); + jrelib_p = buf + len; + snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch); + if (0 != access(buf, F_OK)) { + snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); + } + if (0 == access(buf, F_OK)) { // Use current module name "libjvm[_g].so" instead of // "libjvm"debug_only("_g")".so" since for fastdebug version // we should have "libjvm.so" but debug_only("_g") adds "_g"! // It is used when we are choosing the HPI library's name // "libhpi[_g].so" in hpi::initialize_get_interface(). - sprintf(buf + strlen(buf), "/hotspot/libjvm%s.so", p); + len = strlen(buf); + snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p); } else { // Go back to path of .so if (realpath(dli_fname, buf) == NULL)
--- a/src/os/solaris/vm/os_solaris.cpp Sat Mar 20 16:48:02 2010 -0700 +++ b/src/os/solaris/vm/os_solaris.cpp Fri Apr 02 23:08:59 2010 -0700 @@ -2439,6 +2439,8 @@ char* java_home_var = ::getenv("JAVA_HOME"); if (java_home_var != NULL && java_home_var[0] != 0) { char cpu_arch[12]; + char* jrelib_p; + int len; sysinfo(SI_ARCHITECTURE, cpu_arch, sizeof(cpu_arch)); #ifdef _LP64 // If we are on sparc running a 64-bit vm, look in jre/lib/sparcv9. @@ -2454,14 +2456,23 @@ p = strstr(p, "_g") ? "_g" : ""; realpath(java_home_var, buf); - sprintf(buf + strlen(buf), "/jre/lib/%s", cpu_arch); + // determine if this is a legacy image or modules image + // modules image doesn't have "jre" subdirectory + len = strlen(buf); + jrelib_p = buf + len; + snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch); + if (0 != access(buf, F_OK)) { + snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); + } + if (0 == access(buf, F_OK)) { // Use current module name "libjvm[_g].so" instead of // "libjvm"debug_only("_g")".so" since for fastdebug version // we should have "libjvm.so" but debug_only("_g") adds "_g"! // It is used when we are choosing the HPI library's name // "libhpi[_g].so" in hpi::initialize_get_interface(). - sprintf(buf + strlen(buf), "/hotspot/libjvm%s.so", p); + len = strlen(buf); + snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p); } else { // Go back to path of .so realpath((char *)dlinfo.dli_fname, buf);