8027113: decouple the '-XXaltjvm=<path>' option from the gamma launcher
Decoupled the '-XXaltjvm=<path>' option from the gamma launcher. Clearing the way for removing the remaining cruft associated with the previously removed gamma launcher. Reviewed-by: dcubed, dholmes
This commit is contained in:
parent
455663f56e
commit
97d55c801e
@ -557,11 +557,11 @@ $(JDK_IMAGE_DIR)/jre/lib/rt.jar:
|
||||
|
||||
|
||||
# Testing the built JVM
|
||||
RUN_JVM=JAVA_HOME=$(JDK_IMPORT_PATH) $(JDK_IMPORT_PATH)/bin/java -d$(ARCH_DATA_MODEL) -Dsun.java.launcher=gamma
|
||||
RUN_JVM=JAVA_HOME=$(JDK_IMPORT_PATH) $(JDK_IMPORT_PATH)/bin/java -d$(ARCH_DATA_MODEL) -XXaltjvm=$(ALTJVM_DIR) -Dsun.java.launcher.is_altjvm=true
|
||||
generic_test:
|
||||
@$(ECHO) "Running with: $(ALTJVM_DIR)"
|
||||
@$(RUN_JVM) -XXaltjvm=$(ALTJVM_DIR) -Xinternalversion
|
||||
@$(RUN_JVM) -XXaltjvm=$(ALTJVM_DIR) -showversion -help
|
||||
@$(RUN_JVM) -Xinternalversion
|
||||
@$(RUN_JVM) -showversion -help
|
||||
|
||||
# C2 test targets
|
||||
test_product test_optimized test_fastdebug test_debug:
|
||||
|
@ -49,7 +49,7 @@ then
|
||||
GDB=gdb
|
||||
fi
|
||||
|
||||
# This is the name of the gdb binary to use
|
||||
# This is the name of the dbx binary to use
|
||||
if [ ! "$DBX" ]
|
||||
then
|
||||
DBX=dbx
|
||||
@ -68,9 +68,16 @@ EMACS=emacs
|
||||
# End of user changeable parameters -----------------------------------------
|
||||
#
|
||||
|
||||
OS=`uname -s`
|
||||
|
||||
# Make sure the paths are fully specified, i.e. they must begin with /.
|
||||
REL_MYDIR=`dirname $0`
|
||||
MYDIR=`cd $REL_MYDIR && pwd`
|
||||
case "$OS" in
|
||||
CYGWIN*)
|
||||
MYDIR=`cygpath -m "$MYDIR"`
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
# Look whether the user wants to run inside gdb
|
||||
@ -102,8 +109,17 @@ else
|
||||
JDK=@@JDK_IMPORT_PATH@@
|
||||
fi
|
||||
|
||||
if [ "${JDK}" = "" ]; then
|
||||
echo "Failed to find JDK. Either ALT_JAVA_HOME is not set or JDK_IMPORT_PATH is empty."
|
||||
if [ "${JDK}" != "" ]; then
|
||||
case "$OS" in
|
||||
CYGWIN*)
|
||||
JDK=`cygpath -m "$JDK"`
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
echo "Failed to find JDK." \
|
||||
"Either ALT_JAVA_HOME is not set or JDK_IMPORT_PATH is empty."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We will set the LD_LIBRARY_PATH as follows:
|
||||
@ -120,7 +136,6 @@ SBP=${MYDIR}:${JRE}/lib/${ARCH}
|
||||
|
||||
|
||||
# Set up a suitable LD_LIBRARY_PATH or DYLD_LIBRARY_PATH
|
||||
OS=`uname -s`
|
||||
if [ "${OS}" = "Darwin" ]
|
||||
then
|
||||
if [ -z "$DYLD_LIBRARY_PATH" ]
|
||||
@ -141,7 +156,7 @@ else
|
||||
export LD_LIBRARY_PATH
|
||||
fi
|
||||
|
||||
JPARMS="-Dsun.java.launcher=gamma -XXaltjvm=$MYDIR $@ $JAVA_ARGS";
|
||||
JPARMS="-XXaltjvm=$MYDIR -Dsun.java.launcher.is_altjvm=true $@ $JAVA_ARGS";
|
||||
|
||||
# Locate the java launcher
|
||||
LAUNCHER=$JDK/bin/java
|
||||
@ -152,6 +167,11 @@ fi
|
||||
|
||||
GDBSRCDIR=$MYDIR
|
||||
BASEDIR=`cd $MYDIR/../../.. && pwd`
|
||||
case "$OS" in
|
||||
CYGWIN*)
|
||||
BASEDIR=`cygpath -m "$BASEDIR"`
|
||||
;;
|
||||
esac
|
||||
|
||||
init_gdb() {
|
||||
# Create a gdb script in case we should run inside gdb
|
||||
|
@ -1788,12 +1788,14 @@ void os::jvm_path(char *buf, jint buflen) {
|
||||
if (rp == NULL)
|
||||
return;
|
||||
|
||||
if (Arguments::created_by_gamma_launcher()) {
|
||||
// Support for the gamma launcher. Typical value for buf is
|
||||
// "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm". If "/jre/lib/" appears at
|
||||
// the right place in the string, then assume we are installed in a JDK and
|
||||
// we're done. Otherwise, check for a JAVA_HOME environment variable and
|
||||
// construct a path to the JVM being overridden.
|
||||
if (Arguments::sun_java_launcher_is_altjvm()) {
|
||||
// Support for the java launcher's '-XXaltjvm=<path>' option. Typical
|
||||
// value for buf is "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so"
|
||||
// or "<JAVA_HOME>/jre/lib/<vmtype>/libjvm.dylib". If "/jre/lib/"
|
||||
// appears at the right place in the string, then assume we are
|
||||
// installed in a JDK and we're done. Otherwise, check for a
|
||||
// JAVA_HOME environment variable and construct a path to the JVM
|
||||
// being overridden.
|
||||
|
||||
const char *p = buf + strlen(buf) - 1;
|
||||
for (int count = 0; p > buf && count < 5; ++count) {
|
||||
|
@ -2371,13 +2371,14 @@ void os::jvm_path(char *buf, jint buflen) {
|
||||
if (rp == NULL)
|
||||
return;
|
||||
|
||||
if (Arguments::created_by_gamma_launcher()) {
|
||||
// Support for the gamma launcher. Typical value for buf is
|
||||
// "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so". If "/jre/lib/" appears at
|
||||
// the right place in the string, then assume we are installed in a JDK and
|
||||
// we're done. Otherwise, check for a JAVA_HOME environment variable and fix
|
||||
// up the path so it looks like libjvm.so is installed there (append a
|
||||
// fake suffix hotspot/libjvm.so).
|
||||
if (Arguments::sun_java_launcher_is_altjvm()) {
|
||||
// Support for the java launcher's '-XXaltjvm=<path>' option. Typical
|
||||
// value for buf is "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so".
|
||||
// If "/jre/lib/" appears at the right place in the string, then
|
||||
// assume we are installed in a JDK and we're done. Otherwise, check
|
||||
// for a JAVA_HOME environment variable and fix up the path so it
|
||||
// looks like libjvm.so is installed there (append a fake suffix
|
||||
// hotspot/libjvm.so).
|
||||
const char *p = buf + strlen(buf) - 1;
|
||||
for (int count = 0; p > buf && count < 5; ++count) {
|
||||
for (--p; p > buf && *p != '/'; --p)
|
||||
|
@ -2441,13 +2441,14 @@ void os::jvm_path(char *buf, jint buflen) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Arguments::created_by_gamma_launcher()) {
|
||||
// Support for the gamma launcher. Typical value for buf is
|
||||
// "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so". If "/jre/lib/" appears at
|
||||
// the right place in the string, then assume we are installed in a JDK and
|
||||
// we're done. Otherwise, check for a JAVA_HOME environment variable and fix
|
||||
// up the path so it looks like libjvm.so is installed there (append a
|
||||
// fake suffix hotspot/libjvm.so).
|
||||
if (Arguments::sun_java_launcher_is_altjvm()) {
|
||||
// Support for the java launcher's '-XXaltjvm=<path>' option. Typical
|
||||
// value for buf is "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so".
|
||||
// If "/jre/lib/" appears at the right place in the string, then
|
||||
// assume we are installed in a JDK and we're done. Otherwise, check
|
||||
// for a JAVA_HOME environment variable and fix up the path so it
|
||||
// looks like libjvm.so is installed there (append a fake suffix
|
||||
// hotspot/libjvm.so).
|
||||
const char *p = buf + strlen(buf) - 1;
|
||||
for (int count = 0; p > buf && count < 5; ++count) {
|
||||
for (--p; p > buf && *p != '/'; --p)
|
||||
|
@ -1810,32 +1810,30 @@ void os::jvm_path(char *buf, jint buflen) {
|
||||
}
|
||||
|
||||
buf[0] = '\0';
|
||||
if (Arguments::created_by_gamma_launcher()) {
|
||||
// Support for the gamma launcher. Check for an
|
||||
// JAVA_HOME environment variable
|
||||
// and fix up the path so it looks like
|
||||
// libjvm.so is installed there (append a fake suffix
|
||||
// hotspot/libjvm.so).
|
||||
char* java_home_var = ::getenv("JAVA_HOME");
|
||||
if (java_home_var != NULL && java_home_var[0] != 0) {
|
||||
if (Arguments::sun_java_launcher_is_altjvm()) {
|
||||
// Support for the java launcher's '-XXaltjvm=<path>' option. Check
|
||||
// for a JAVA_HOME environment variable and fix up the path so it
|
||||
// looks like jvm.dll is installed there (append a fake suffix
|
||||
// hotspot/jvm.dll).
|
||||
char* java_home_var = ::getenv("JAVA_HOME");
|
||||
if (java_home_var != NULL && java_home_var[0] != 0) {
|
||||
strncpy(buf, java_home_var, buflen);
|
||||
|
||||
strncpy(buf, java_home_var, buflen);
|
||||
|
||||
// determine if this is a legacy image or modules image
|
||||
// modules image doesn't have "jre" subdirectory
|
||||
size_t len = strlen(buf);
|
||||
char* jrebin_p = buf + len;
|
||||
jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
|
||||
if (0 != _access(buf, 0)) {
|
||||
jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
|
||||
}
|
||||
len = strlen(buf);
|
||||
jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");
|
||||
}
|
||||
// determine if this is a legacy image or modules image
|
||||
// modules image doesn't have "jre" subdirectory
|
||||
size_t len = strlen(buf);
|
||||
char* jrebin_p = buf + len;
|
||||
jio_snprintf(jrebin_p, buflen-len, "\\jre\\bin\\");
|
||||
if (0 != _access(buf, 0)) {
|
||||
jio_snprintf(jrebin_p, buflen-len, "\\bin\\");
|
||||
}
|
||||
len = strlen(buf);
|
||||
jio_snprintf(buf + len, buflen-len, "hotspot\\jvm.dll");
|
||||
}
|
||||
}
|
||||
|
||||
if(buf[0] == '\0') {
|
||||
GetModuleFileName(vm_lib_handle, buf, buflen);
|
||||
if (buf[0] == '\0') {
|
||||
GetModuleFileName(vm_lib_handle, buf, buflen);
|
||||
}
|
||||
strcpy(saved_jvm_path, buf);
|
||||
}
|
||||
|
@ -161,7 +161,18 @@ public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 {
|
||||
for (BuildConfig cfg : allConfigs) {
|
||||
startTag(cfg, "PropertyGroup");
|
||||
tagData("LocalDebuggerCommand", cfg.get("JdkTargetRoot") + "\\bin\\java.exe");
|
||||
tagData("LocalDebuggerCommandArguments", "-XXaltjvm=$(TargetDir) -Dsun.java.launcher=gamma");
|
||||
// The JVM loads some libraries using a path relative to
|
||||
// itself because it expects to be in a JRE or a JDK. The java
|
||||
// launcher's '-XXaltjvm=' option allows the JVM to be outside
|
||||
// the JRE or JDK so '-Dsun.java.launcher.is_altjvm=true'
|
||||
// forces a fake JAVA_HOME relative path to be used to
|
||||
// find the other libraries. The '-XX:+PauseAtExit' option
|
||||
// causes the VM to wait for key press before exiting; this
|
||||
// allows any stdout or stderr messages to be seen before
|
||||
// the cmdtool exits.
|
||||
tagData("LocalDebuggerCommandArguments", "-XXaltjvm=$(TargetDir) "
|
||||
+ "-Dsun.java.launcher.is_altjvm=true "
|
||||
+ "-XX:+UnlockDiagnosticVMOptions -XX:+PauseAtExit");
|
||||
tagData("LocalDebuggerEnvironment", "JAVA_HOME=" + cfg.get("JdkTargetRoot"));
|
||||
endTag();
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ bool Arguments::_xdebug_mode = false;
|
||||
const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG;
|
||||
const char* Arguments::_sun_java_launcher = DEFAULT_JAVA_LAUNCHER;
|
||||
int Arguments::_sun_java_launcher_pid = -1;
|
||||
bool Arguments::_created_by_gamma_launcher = false;
|
||||
bool Arguments::_sun_java_launcher_is_altjvm = false;
|
||||
|
||||
// These parameters are reset in method parse_vm_init_args(JavaVMInitArgs*)
|
||||
bool Arguments::_AlwaysCompileLoopMethods = AlwaysCompileLoopMethods;
|
||||
@ -151,7 +151,8 @@ static void logOption(const char* opt) {
|
||||
|
||||
// Process java launcher properties.
|
||||
void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
|
||||
// See if sun.java.launcher or sun.java.launcher.pid is defined.
|
||||
// See if sun.java.launcher, sun.java.launcher.is_altjvm or
|
||||
// sun.java.launcher.pid is defined.
|
||||
// Must do this before setting up other system properties,
|
||||
// as some of them may depend on launcher type.
|
||||
for (int index = 0; index < args->nOptions; index++) {
|
||||
@ -162,6 +163,12 @@ void Arguments::process_sun_java_launcher_properties(JavaVMInitArgs* args) {
|
||||
process_java_launcher_argument(tail, option->extraInfo);
|
||||
continue;
|
||||
}
|
||||
if (match_option(option, "-Dsun.java.launcher.is_altjvm=", &tail)) {
|
||||
if (strcmp(tail, "true") == 0) {
|
||||
_sun_java_launcher_is_altjvm = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (match_option(option, "-Dsun.java.launcher.pid=", &tail)) {
|
||||
_sun_java_launcher_pid = atoi(tail);
|
||||
continue;
|
||||
@ -1013,9 +1020,10 @@ bool Arguments::add_property(const char* prop) {
|
||||
_java_command = value;
|
||||
|
||||
// Record value in Arguments, but let it get passed to Java.
|
||||
} else if (strcmp(key, "sun.java.launcher.pid") == 0) {
|
||||
// launcher.pid property is private and is processed
|
||||
// in process_sun_java_launcher_properties();
|
||||
} else if (strcmp(key, "sun.java.launcher.is_altjvm") == 0 ||
|
||||
strcmp(key, "sun.java.launcher.pid") == 0) {
|
||||
// sun.java.launcher.is_altjvm and sun.java.launcher.pid property are
|
||||
// private and are processed in process_sun_java_launcher_properties();
|
||||
// the sun.java.launcher property is passed on to the java application
|
||||
FreeHeap(key);
|
||||
if (eq != NULL) {
|
||||
@ -1800,9 +1808,6 @@ void Arguments::process_java_compiler_argument(char* arg) {
|
||||
|
||||
void Arguments::process_java_launcher_argument(const char* launcher, void* extra_info) {
|
||||
_sun_java_launcher = strdup(launcher);
|
||||
if (strcmp("gamma", _sun_java_launcher) == 0) {
|
||||
_created_by_gamma_launcher = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Arguments::created_by_java_launcher() {
|
||||
@ -1810,8 +1815,8 @@ bool Arguments::created_by_java_launcher() {
|
||||
return strcmp(DEFAULT_JAVA_LAUNCHER, _sun_java_launcher) != 0;
|
||||
}
|
||||
|
||||
bool Arguments::created_by_gamma_launcher() {
|
||||
return _created_by_gamma_launcher;
|
||||
bool Arguments::sun_java_launcher_is_altjvm() {
|
||||
return _sun_java_launcher_is_altjvm;
|
||||
}
|
||||
|
||||
//===========================================================================================================
|
||||
@ -3765,16 +3770,6 @@ jint Arguments::apply_ergo() {
|
||||
}
|
||||
}
|
||||
|
||||
// set PauseAtExit if the gamma launcher was used and a debugger is attached
|
||||
// but only if not already set on the commandline
|
||||
if (Arguments::created_by_gamma_launcher() && os::is_debugger_attached()) {
|
||||
bool set = false;
|
||||
CommandLineFlags::wasSetOnCmdline("PauseAtExit", &set);
|
||||
if (!set) {
|
||||
FLAG_SET_DEFAULT(PauseAtExit, true);
|
||||
}
|
||||
}
|
||||
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
|
@ -268,14 +268,14 @@ class Arguments : AllStatic {
|
||||
static const char* _java_vendor_url_bug;
|
||||
|
||||
// sun.java.launcher, private property to provide information about
|
||||
// java/gamma launcher
|
||||
// java launcher
|
||||
static const char* _sun_java_launcher;
|
||||
|
||||
// sun.java.launcher.pid, private property
|
||||
static int _sun_java_launcher_pid;
|
||||
|
||||
// was this VM created by the gamma launcher
|
||||
static bool _created_by_gamma_launcher;
|
||||
// was this VM created via the -XXaltjvm=<path> option
|
||||
static bool _sun_java_launcher_is_altjvm;
|
||||
|
||||
// Option flags
|
||||
static bool _has_profile;
|
||||
@ -483,8 +483,8 @@ class Arguments : AllStatic {
|
||||
static const char* sun_java_launcher() { return _sun_java_launcher; }
|
||||
// Was VM created by a Java launcher?
|
||||
static bool created_by_java_launcher();
|
||||
// Was VM created by the gamma Java launcher?
|
||||
static bool created_by_gamma_launcher();
|
||||
// -Dsun.java.launcher.is_altjvm
|
||||
static bool sun_java_launcher_is_altjvm();
|
||||
// -Dsun.java.launcher.pid
|
||||
static int sun_java_launcher_pid() { return _sun_java_launcher_pid; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user