Closing the loop on this question that I asked earlier:
Just curious, when gamma was renamed to hotspot on Windows, that
change wasn't made on Linux on Solaris. Any particular reason?
On Solaris there is a "hotspot" shell script and a "gamma" binary.
I suspect the same it true for Linux (and possibly MacOS).
Dan
On 12/19/12 8:22 AM, Daniel D. Daugherty wrote:
On 12/19/12 1:27 AM, Staffan Larsen wrote:
On 18 dec 2012, at 22:11, Daniel D. Daugherty
<daniel.daughe...@oracle.com> wrote:
Just for the record: I have reviewed all of Ron's changes
and I approve them.
One thing I noticed of interest to launcher folks that
is not due to any changes that Ron made:
src/os/windows/vm/os_windows.cpp:
1718 // Find the full path to the current module, jvm.dll
1719 void os::jvm_path(char *buf, jint buflen) {
1720 // Error checking.
1721 if (buflen < MAX_PATH) {
1722 assert(false, "must use a large-enough buffer");
1723 buf[0] = '\0';
1724 return;
1725 }
1726 // Lazy resolve the path to current module.
1727 if (saved_jvm_path[0] != 0) {
1728 strcpy(buf, saved_jvm_path);
1729 return;
1730 }
1731
1732 buf[0] = '\0';
1733 if (Arguments::created_by_gamma_launcher()) {
1734 // Support for the gamma launcher. Check for an
1735 // JAVA_HOME environment variable
1736 // and fix up the path so it looks like
1737 // libjvm.so is installed there (append a fake suffix
1738 // hotspot/libjvm.so).
1739 char* java_home_var = ::getenv("JAVA_HOME");
1740 if (java_home_var != NULL && java_home_var[0] != 0) {
1741
1742 strncpy(buf, java_home_var, buflen);
1743
1744 // determine if this is a legacy image or modules image
1745 // modules image doesn't have "jre" subdirectory
1746 size_t len = strlen(buf);
1747 char* jrebin_p = buf + len;
1748 jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
1749 if (0 != _access(buf, 0)) {
1750 jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
1751 }
1752 len = strlen(buf);
1753 jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");
1754 }
1755 }
1756
1757 if(buf[0] == '\0') {
1758 GetModuleFileName(vm_lib_handle, buf, buflen);
1759 }
1760 strcpy(saved_jvm_path, buf);
1761 }
the block from line 1733 -> 1755 is dead code on Windows.
The launcher on Windows is now called "hotspot" and is not
called "gamma" so Arguments::created_by_gamma_launcher()
will not return true on Windows.
And one more launcher nit:
$ grep gamma make/windows/makefiles/launcher.make
/D LAUNCHER_TYPE=\"gamma\" \
Isn't it this line that makes it work?
Arguments::created_by_gamma_launcher() essentially checks that
-Dsun.java.launcher=gamma is set. And the LAUNCHER_TYPE=gamma is what
sets -Dsun.java.launcher=gamma. I think, but I may be missing something?
Thanks,
/Staffan
Nope you weren't missing anything. I was thinking process name
is "hotspot" instead of looking more closely at how the launcher
origin was determined.
Just curious, when gamma was renamed to hotspot on Windows, that
change wasn't made on Linux on Solaris. Any particular reason?
Gory details below...
Dan
Chasing it back...
src/os/windows/vm/os_windows.cpp:
1733 if (Arguments::created_by_gamma_launcher()) {
src/share/vm/runtime/arguments.cpp:
1671 bool Arguments::created_by_gamma_launcher() {
1672 return _created_by_gamma_launcher;
1673 }
1659 void Arguments::process_java_launcher_argument(const char*
launcher, void* extra_info) {
1660 _sun_java_launcher = strdup(launcher);
1661 if (strcmp("gamma", _sun_java_launcher) == 0) {
1662 _created_by_gamma_launcher = true;
1663 }
1664 }
126 // Process java launcher properties.
127 void
Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
128 // See if sun.java.launcher or sun.java.launcher.pid is
defined.
129 // Must do this before setting up other system properties,
130 // as some of them may depend on launcher type.
131 for (int index = 0; index < args->nOptions; index++) {
132 const JavaVMOption* option = args->options + index;
133 const char* tail;
134
135 if (match_option(option, "-Dsun.java.launcher=", &tail)) {
136 process_java_launcher_argument(tail, option->extraInfo);
137 continue;
138 }
src/share/tools/launcher/java.c:
1659 /*
1660 * JVM would like to know if it's created by a standard Sun
launcher, or by
1661 * user native application, the following property indicates
the former.
1662 */
1663 void SetJavaLauncherProp() {
1664 AddOption("-Dsun.java.launcher=" LAUNCHER_TYPE, NULL);
1665 }
make/windows/makefiles/launcher.make
26 LAUNCHER_FLAGS=$(CXX_FLAGS) $(ARCHFLAG) \
27 /D FULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
28 /D JDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
29 /D JDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
30 /D GAMMA \
31 /D LAUNCHER_TYPE=\"gamma\" \