--- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c Wed May 10 23:06:49 2017 +0530
+++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c Wed May 10 15:12:43 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -136,8 +136,7 @@
* |
* \|/
* ParseArguments
- * (removes -d32 and -d64 if any,
- * processes version options,
+ * (processes version options,
* creates argument list for vm,
* etc.)
* |
@@ -147,20 +146,20 @@
* |
* |
* \|/
- * Path is desired JRE ? YES --> Have Desired Model ? NO --> Re-exec --> Main
- * NO YES --> Continue
+ * Path is desired JRE ? YES --> Continue
+ * NO
* |
* |
* \|/
* Paths have well known
- * jvm paths ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
- * YES YES --> Continue
+ * jvm paths ? --> NO --> Continue
+ * YES
* |
* |
* \|/
* Does libjvm.so exist
- * in any of them ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
- * YES YES --> Continue
+ * in any of them ? --> NO --> Continue
+ * YES
* |
* |
* \|/
@@ -217,7 +216,7 @@
}
char jvmPath[PATH_MAX];
- jboolean gotJVMPath = GetJVMPath(jrePath, preferredJVM, jvmPath, sizeof(jvmPath), CURRENT_DATA_MODEL);
+ jboolean gotJVMPath = GetJVMPath(jrePath, preferredJVM, jvmPath, sizeof(jvmPath));
if (!gotJVMPath) {
JLI_ReportErrorMessage("Failed to GetJVMPath()");
return NULL;
@@ -362,203 +361,51 @@
char jrepath[], jint so_jrepath,
char jvmpath[], jint so_jvmpath,
char jvmcfg[], jint so_jvmcfg) {
- /*
- * First, determine if we are running the desired data model. If we
- * are running the desired data model, all the error messages
- * associated with calling GetJREPath, ReadKnownVMs, etc. should be
- * output. However, if we are not running the desired data model,
- * some of the errors should be suppressed since it is more
- * informative to issue an error message based on whether or not the
- * os/processor combination has dual mode capabilities.
- */
jboolean jvmpathExists;
/* Compute/set the name of the executable */
SetExecname(*pargv);
- /* Check data model flags, and exec process, if needed */
- {
- char * jvmtype = NULL;
- int argc = *pargc;
- char **argv = *pargv;
- int running = CURRENT_DATA_MODEL;
-
- int wanted = running; /* What data mode is being
- asked for? Current model is
- fine unless another model
- is asked for */
-
- char** newargv = NULL;
- int newargc = 0;
-
- /*
- * Starting in 1.5, all unix platforms accept the -d32 and -d64
- * options. On platforms where only one data-model is supported
- * (e.g. ia-64 Linux), using the flag for the other data model is
- * an error and will terminate the program.
- */
-
- { /* open new scope to declare local variables */
- int i;
-
- newargv = (char **)JLI_MemAlloc((argc+1) * sizeof(char*));
- newargv[newargc++] = argv[0];
-
- /* scan for data model arguments and remove from argument list;
- last occurrence determines desired data model */
- for (i=1; i < argc; i++) {
-
- if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) {
- wanted = 64;
- continue;
- }
- if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) {
- wanted = 32;
- continue;
- }
- newargv[newargc++] = argv[i];
-
- if (IsJavaArgs()) {
- if (argv[i][0] != '-') continue;
- } else {
- if (JLI_StrCmp(argv[i], "-classpath") == 0 || JLI_StrCmp(argv[i], "-cp") == 0) {
- i++;
- if (i >= argc) break;
- newargv[newargc++] = argv[i];
- continue;
- }
- if (argv[i][0] != '-') { i++; break; }
- }
- }
-
- /* copy rest of args [i .. argc) */
- while (i < argc) {
- newargv[newargc++] = argv[i++];
- }
- newargv[newargc] = NULL;
-
- /*
- * newargv has all proper arguments here
- */
-
- argc = newargc;
- argv = newargv;
- }
-
- /* If the data model is not changing, it is an error if the
- jvmpath does not exist */
- if (wanted == running) {
- /* Find out where the JRE is that we will be using. */
- if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE) ) {
- JLI_ReportErrorMessage(JRE_ERROR1);
- exit(2);
- }
- JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg",
- jrepath, FILESEP, FILESEP, "", "");
- /* Find the specified JVM type */
- if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
- JLI_ReportErrorMessage(CFG_ERROR7);
- exit(1);
- }
+ char * jvmtype = NULL;
+ int argc = *pargc;
+ char **argv = *pargv;
- jvmpath[0] = '\0';
- jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE);
- if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
- JLI_ReportErrorMessage(CFG_ERROR9);
- exit(4);
- }
-
- if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, wanted)) {
- JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);
- exit(4);
- }
-
- /*
- * Mac OS X requires the Cocoa event loop to be run on the "main"
- * thread. Spawn off a new thread to run main() and pass
- * this thread off to the Cocoa event loop.
- */
- MacOSXStartup(argc, argv);
-
- /*
- * we seem to have everything we need, so without further ado
- * we return back, otherwise proceed to set the environment.
- */
- return;
- } else { /* do the same speculatively or exit */
-#if defined(DUAL_MODE)
- if (running != wanted) {
- /* Find out where the JRE is that we will be using. */
- if (!GetJREPath(jrepath, so_jrepath, JNI_TRUE)) {
- /* give up and let other code report error message */
- JLI_ReportErrorMessage(JRE_ERROR2, wanted);
- exit(1);
- }
- JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg",
- jrepath, FILESEP, FILESEP, "", "");
- /*
- * Read in jvm.cfg for target data model and process vm
- * selection options.
- */
- if (ReadKnownVMs(jvmcfg, JNI_TRUE) < 1) {
- /* give up and let other code report error message */
- JLI_ReportErrorMessage(JRE_ERROR2, wanted);
- exit(1);
- }
- jvmpath[0] = '\0';
- jvmtype = CheckJvmType(pargc, pargv, JNI_TRUE);
- if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
- JLI_ReportErrorMessage(CFG_ERROR9);
- exit(4);
- }
-
- /* exec child can do error checking on the existence of the path */
- jvmpathExists = GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, wanted);
- }
-#else /* ! DUAL_MODE */
- JLI_ReportErrorMessage(JRE_ERROR2, wanted);
- exit(1);
-#endif /* DUAL_MODE */
- }
- {
- char *newexec = execname;
- JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
- (void) fflush(stdout);
- (void) fflush(stderr);
- /*
- * Use posix_spawn() instead of execv() on Mac OS X.
- * This allows us to choose which architecture the child process
- * should run as.
- */
- {
- posix_spawnattr_t attr;
- size_t unused_size;
- pid_t unused_pid;
-
-#if defined(__i386__) || defined(__x86_64__)
- cpu_type_t cpu_type[] = { (wanted == 64) ? CPU_TYPE_X86_64 : CPU_TYPE_X86,
- (running== 64) ? CPU_TYPE_X86_64 : CPU_TYPE_X86 };
-#else
- cpu_type_t cpu_type[] = { CPU_TYPE_ANY };
-#endif /* __i386 .. */
-
- posix_spawnattr_init(&attr);
- posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETEXEC);
- posix_spawnattr_setbinpref_np(&attr, sizeof(cpu_type) / sizeof(cpu_type_t),
- cpu_type, &unused_size);
-
- posix_spawn(&unused_pid, newexec, NULL, &attr, argv, environ);
- }
- JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
-
-#if defined(DUAL_MODE)
- if (running != wanted) {
- JLI_ReportErrorMessage(JRE_ERROR5, wanted, running);
- }
-#endif /* DUAL_MODE */
- }
+ /* Find out where the JRE is that we will be using. */
+ if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE) ) {
+ JLI_ReportErrorMessage(JRE_ERROR1);
+ exit(2);
+ }
+ JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%sjvm.cfg",
+ jrepath, FILESEP, FILESEP);
+ /* Find the specified JVM type */
+ if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
+ JLI_ReportErrorMessage(CFG_ERROR7);
exit(1);
}
+
+ jvmpath[0] = '\0';
+ jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE);
+ if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
+ JLI_ReportErrorMessage(CFG_ERROR9);
+ exit(4);
+ }
+
+ if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath)) {
+ JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);
+ exit(4);
+ }
+
+ /*
+ * Mac OS X requires the Cocoa event loop to be run on the "main"
+ * thread. Spawn off a new thread to run main() and pass
+ * this thread off to the Cocoa event loop.
+ */
+ MacOSXStartup(argc, argv);
+
+ /*
+ * we seem to have everything we need
+ */
+ return;
}
/*
@@ -566,7 +413,7 @@
*/
static jboolean
GetJVMPath(const char *jrepath, const char *jvmtype,
- char *jvmpath, jint jvmpathsize, int bitsWanted)
+ char *jvmpath, jint jvmpathsize)
{
struct stat s;
@@ -577,8 +424,7 @@
* macosx client library is built thin, i386 only.
* 64 bit client requests must load server library
*/
- const char *jvmtypeUsed = ((bitsWanted == 64) && (strcmp(jvmtype, "client") == 0)) ? "server" : jvmtype;
- JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/%s/" JVM_DLL, jrepath, jvmtypeUsed);
+ JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/server/" JVM_DLL, jrepath);
}
JLI_TraceLauncher("Does `%s' exist ... ", jvmpath);
--- a/jdk/src/java.base/share/native/libjli/java.c Wed May 10 23:06:49 2017 +0530
+++ b/jdk/src/java.base/share/native/libjli/java.c Wed May 10 15:12:43 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -123,7 +123,6 @@
static void SetPaths(int argc, char **argv);
static void DumpState();
-static jboolean RemovableOption(char *option);
enum OptionKind {
LAUNCHER_OPTION = 0,
@@ -742,17 +741,16 @@
}
/*
- * static void SetJvmEnvironment(int argc, char **argv);
- * Is called just before the JVM is loaded. We can set env variables
- * that are consumed by the JVM. This function is non-destructive,
- * leaving the arg list intact. The first use is for the JVM flag
- * -XX:NativeMemoryTracking=value.
+ * This method must be called before the VM is loaded, primarily
+ * used to parse and set any VM related options or env variables.
+ * This function is non-destructive leaving the argument list intact.
*/
static void
SetJvmEnvironment(int argc, char **argv) {
static const char* NMT_Env_Name = "NMT_LEVEL_";
int i;
+ /* process only the launcher arguments */
for (i = 0; i < argc; i++) {
char *arg = argv[i];
/*
@@ -811,11 +809,8 @@
printf("TRACER_MARKER: NativeMemoryTracking: got value %s\n",envBuf);
free(envName);
}
-
}
-
}
-
}
}
@@ -1383,8 +1378,6 @@
; /* Ignore machine independent options already handled */
} else if (ProcessPlatformOption(arg)) {
; /* Processing of platform dependent options */
- } else if (RemovableOption(arg)) {
- ; /* Do not pass option to vm. */
} else {
/* java.class.path set on the command line */
if (JLI_StrCCmp(arg, "-Djava.class.path=") == 0) {
@@ -2263,34 +2256,6 @@
}
/*
- * Return JNI_TRUE for an option string that has no effect but should
- * _not_ be passed on to the vm; return JNI_FALSE otherwise. On
- * Solaris SPARC, this screening needs to be done if:
- * -d32 or -d64 is passed to a binary with an unmatched data model
- * (the exec in CreateExecutionEnvironment removes -d<n> options and points the
- * exec to the proper binary). In the case of when the data model and the
- * requested version is matched, an exec would not occur, and these options
- * were erroneously passed to the vm.
- */
-jboolean
-RemovableOption(char * option)
-{
- /*
- * Unconditionally remove both -d32 and -d64 options since only
- * the last such options has an effect; e.g.
- * java -d32 -d64 -d32 -version
- * is equivalent to
- * java -d32 -version
- */
-
- if( (JLI_StrCCmp(option, "-d32") == 0 ) ||
- (JLI_StrCCmp(option, "-d64") == 0 ) )
- return JNI_TRUE;
- else
- return JNI_FALSE;
-}
-
-/*
* A utility procedure to always print to stderr
*/
void
--- a/jdk/src/java.base/unix/native/libjli/java_md.h Wed May 10 23:06:49 2017 +0530
+++ b/jdk/src/java.base/unix/native/libjli/java_md.h Wed May 10 15:12:43 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
const char *SetExecname(char **argv);
const char *GetExecName();
static jboolean GetJVMPath(const char *jrepath, const char *jvmtype,
- char *jvmpath, jint jvmpathsize, int bitsWanted);
+ char *jvmpath, jint jvmpathsize);
static jboolean GetJREPath(char *path, jint pathsize, jboolean speculative);
#if defined(_AIX)
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c Wed May 10 23:06:49 2017 +0530
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c Wed May 10 15:12:43 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -62,9 +62,7 @@
*
* The selection of the proper vm shared library to open depends on
* several classes of command line options, including vm "flavor"
- * options (-client, -server) and the data model options, -d32 and
- * -d64, as well as a version specification which may have come from
- * the command line or from the manifest of an executable jar file.
+ * options (-client, -server).
* The vm selection options are not passed to the running
* virtual machine; they must be screened out by the launcher.
*
@@ -120,34 +118,30 @@
* |
* \|/
* ParseArguments
- * (removes -d32 and -d64 if any,
- * processes version options,
- * creates argument list for vm,
- * etc.)
* |
* |
* \|/
* RequiresSetenv
* Is LD_LIBRARY_PATH
- * and friends set ? --> NO --> Have Desired Model ? NO --> Error/Exit
- * YES YES --> Continue
+ * and friends set ? --> NO --> Continue
+ * YES
* |
* |
* \|/
- * Path is desired JRE ? YES --> Have Desired Model ? NO --> Error/Exit
- * NO YES --> Continue
+ * Path is desired JRE ? YES --> Continue
+ * NO
* |
* |
* \|/
* Paths have well known
- * jvm paths ? --> NO --> Have Desired Model ? NO --> Error/Exit
- * YES YES --> Continue
+ * jvm paths ? --> NO --> Error/Exit
+ * YES
* |
* |
* \|/
- * Does libjvm.so exit
- * in any of them ? --> NO --> Have Desired Model ? NO --> Error/Exit
- * YES YES --> Continue
+ * Does libjvm.so exist
+ * in any of them ? --> NO --> Continue
+ * YES
* |
* |
* \|/
@@ -302,229 +296,97 @@
char jrepath[], jint so_jrepath,
char jvmpath[], jint so_jvmpath,
char jvmcfg[], jint so_jvmcfg) {
- /*
- * First, determine if we are running the desired data model. If we
- * are running the desired data model, all the error messages
- * associated with calling GetJREPath, ReadKnownVMs, etc. should be
- * output, otherwise we simply exit with an error, as we no longer
- * support dual data models.
- */
- jboolean jvmpathExists;
+
+ char * jvmtype = NULL;
+ int argc = *pargc;
+ char **argv = *pargv;
+
+#ifdef SETENV_REQUIRED
+ jboolean mustsetenv = JNI_FALSE;
+ char *runpath = NULL; /* existing effective LD_LIBRARY_PATH setting */
+ char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */
+ char* newpath = NULL; /* path on new LD_LIBRARY_PATH */
+ char* lastslash = NULL;
+ char** newenvp = NULL; /* current environment */
+ size_t new_runpath_size;
+#endif /* SETENV_REQUIRED */
/* Compute/set the name of the executable */
SetExecname(*pargv);
- /* Check data model flags, and exec process, if needed */
- {
- char * jvmtype = NULL;
- int argc = *pargc;
- char **argv = *pargv;
- int running = CURRENT_DATA_MODEL;
- /*
- * As of jdk9, there is no support for dual mode operations, however
- * for legacy error reporting purposes and until -d options are supported
- * we need this.
- */
- int wanted = running;
-#ifdef SETENV_REQUIRED
- jboolean mustsetenv = JNI_FALSE;
- char *runpath = NULL; /* existing effective LD_LIBRARY_PATH setting */
- char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */
- char* newpath = NULL; /* path on new LD_LIBRARY_PATH */
- char* lastslash = NULL;
- char** newenvp = NULL; /* current environment */
- size_t new_runpath_size;
-#ifdef __solaris__
- char* dmpath = NULL; /* data model specific LD_LIBRARY_PATH,
- Solaris only */
-#endif /* __solaris__ */
-#endif /* SETENV_REQUIRED */
+ /* Check to see if the jvmpath exists */
+ /* Find out where the JRE is that we will be using. */
+ if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE)) {
+ JLI_ReportErrorMessage(JRE_ERROR1);
+ exit(2);
+ }
+ JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%sjvm.cfg",
+ jrepath, FILESEP, FILESEP);
+ /* Find the specified JVM type */
+ if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
+ JLI_ReportErrorMessage(CFG_ERROR7);
+ exit(1);
+ }
- char** newargv = NULL;
- int newargc = 0;
-
- /*
- * Starting in 1.5, all unix platforms accept the -d32 and -d64
- * options. On platforms where only one data-model is supported
- * (e.g. ia-64 Linux), using the flag for the other data model is
- * an error and will terminate the program.
- */
-
- { /* open new scope to declare local variables */
- int i;
+ jvmpath[0] = '\0';
+ jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE);
+ if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
+ JLI_ReportErrorMessage(CFG_ERROR9);
+ exit(4);
+ }
- newargv = (char **)JLI_MemAlloc((argc+1) * sizeof(char*));
- newargv[newargc++] = argv[0];
-
- /* scan for data model arguments and remove from argument list;
- last occurrence determines desired data model */
- for (i=1; i < argc; i++) {
-
- if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) {
- wanted = 64;
- continue;
- }
- if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) {
- wanted = 32;
- continue;
- }
- newargv[newargc++] = argv[i];
+ if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath)) {
+ JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);
+ exit(4);
+ }
+ /*
+ * we seem to have everything we need, so without further ado
+ * we return back, otherwise proceed to set the environment.
+ */
+#ifdef SETENV_REQUIRED
+ mustsetenv = RequiresSetenv(jvmpath);
+ JLI_TraceLauncher("mustsetenv: %s\n", mustsetenv ? "TRUE" : "FALSE");
- if (IsJavaArgs()) {
- if (argv[i][0] != '-') continue;
- } else {
- if (JLI_StrCmp(argv[i], "-classpath") == 0 || JLI_StrCmp(argv[i], "-cp") == 0) {
- i++;
- if (i >= argc) break;
- newargv[newargc++] = argv[i];
- continue;
- }
- if (argv[i][0] != '-') { i++; break; }
- }
- }
+ if (mustsetenv == JNI_FALSE) {
+ return;
+ }
+#else
+ return;
+#endif /* SETENV_REQUIRED */
- /* copy rest of args [i .. argc) */
- while (i < argc) {
- newargv[newargc++] = argv[i++];
- }
- newargv[newargc] = NULL;
-
+#ifdef SETENV_REQUIRED
+ if (mustsetenv) {
/*
- * newargv has all proper arguments here
+ * We will set the LD_LIBRARY_PATH as follows:
+ *
+ * o $JVMPATH (directory portion only)
+ * o $JRE/lib
+ * o $JRE/../lib
+ *
+ * followed by the user's previous effective LD_LIBRARY_PATH, if
+ * any.
*/
- argc = newargc;
- argv = newargv;
- }
-
- /* If the data model is not changing, it is an error if the
- jvmpath does not exist */
- if (wanted == running) {
- /* Find out where the JRE is that we will be using. */
- if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE) ) {
- JLI_ReportErrorMessage(JRE_ERROR1);
- exit(2);
- }
- JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%sjvm.cfg",
- jrepath, FILESEP, FILESEP, FILESEP);
- /* Find the specified JVM type */
- if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
- JLI_ReportErrorMessage(CFG_ERROR7);
- exit(1);
- }
-
- jvmpath[0] = '\0';
- jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE);
- if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
- JLI_ReportErrorMessage(CFG_ERROR9);
- exit(4);
- }
-
- if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, 0 )) {
- JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);
- exit(4);
- }
- /*
- * we seem to have everything we need, so without further ado
- * we return back, otherwise proceed to set the environment.
- */
-#ifdef SETENV_REQUIRED
- mustsetenv = RequiresSetenv(jvmpath);
- JLI_TraceLauncher("mustsetenv: %s\n", mustsetenv ? "TRUE" : "FALSE");
+ runpath = getenv(LD_LIBRARY_PATH);
- if (mustsetenv == JNI_FALSE) {
- JLI_MemFree(newargv);
- return;
- }
-#else
- JLI_MemFree(newargv);
- return;
-#endif /* SETENV_REQUIRED */
- } else { /* do the same speculatively or exit */
- JLI_ReportErrorMessage(JRE_ERROR2, wanted);
- exit(1);
- }
-#ifdef SETENV_REQUIRED
- if (mustsetenv) {
- /*
- * We will set the LD_LIBRARY_PATH as follows:
- *
- * o $JVMPATH (directory portion only)
- * o $JRE/lib
- * o $JRE/../lib
- *
- * followed by the user's previous effective LD_LIBRARY_PATH, if
- * any.
- */
+ /* runpath contains current effective LD_LIBRARY_PATH setting */
+ { /* New scope to declare local variable */
+ char *new_jvmpath = JLI_StringDup(jvmpath);
+ new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
+ 2 * JLI_StrLen(jrepath) +
+#ifdef AIX
+ /* On AIX we additionally need 'jli' in the path because ld doesn't support $ORIGIN. */
+ JLI_StrLen(jrepath) + JLI_StrLen("/lib//jli:") +
+#endif
+ JLI_StrLen(new_jvmpath) + 52;
+ new_runpath = JLI_MemAlloc(new_runpath_size);
+ newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "=");
-#ifdef __solaris__
- /*
- * Starting in Solaris 7, ld.so.1 supports three LD_LIBRARY_PATH
- * variables:
- *
- * 1. LD_LIBRARY_PATH -- used for 32 and 64 bit searches if
- * data-model specific variables are not set.
- *
- * 2. LD_LIBRARY_PATH_64 -- overrides and replaces LD_LIBRARY_PATH
- * for 64-bit binaries.
- * The vm uses LD_LIBRARY_PATH to set the java.library.path system
- * property. To shield the vm from the complication of multiple
- * LD_LIBRARY_PATH variables, if the appropriate data model
- * specific variable is set, we will act as if LD_LIBRARY_PATH had
- * the value of the data model specific variant and the data model
- * specific variant will be unset. Note that the variable for the
- * *wanted* data model must be used (if it is set), not simply the
- * current running data model.
- */
-
- switch (wanted) {
- case 0:
- case 64:
- dmpath = getenv("LD_LIBRARY_PATH_64");
- wanted = 64;
- break;
-
- default:
- JLI_ReportErrorMessage(JRE_ERROR3, __LINE__);
- exit(1); /* unknown value in wanted */
- break;
- }
/*
- * If dmpath is NULL, the relevant data model specific variable is
- * not set and normal LD_LIBRARY_PATH should be used.
- */
- if (dmpath == NULL) {
- runpath = getenv("LD_LIBRARY_PATH");
- } else {
- runpath = dmpath;
- }
-#else /* ! __solaris__ */
- /*
- * If not on Solaris, assume only a single LD_LIBRARY_PATH
- * variable.
+ * Create desired LD_LIBRARY_PATH value for target data model.
*/
- runpath = getenv(LD_LIBRARY_PATH);
-#endif /* __solaris__ */
-
- /* runpath contains current effective LD_LIBRARY_PATH setting */
- { /* New scope to declare local variable */
- char *new_jvmpath = JLI_StringDup(jvmpath);
- new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
- 2 * JLI_StrLen(jrepath) +
-#ifdef AIX
- /* On AIX we additionally need 'jli' in the path because ld doesn't support $ORIGIN. */
- JLI_StrLen(jrepath) + JLI_StrLen("/lib//jli:") +
-#endif
- JLI_StrLen(new_jvmpath) + 52;
- new_runpath = JLI_MemAlloc(new_runpath_size);
- newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "=");
-
-
- /*
- * Create desired LD_LIBRARY_PATH value for target data model.
- */
- {
+ {
/* remove the name of the .so from the JVM path */
lastslash = JLI_StrRChr(new_jvmpath, '/');
if (lastslash)
@@ -555,85 +417,66 @@
*/
if (runpath != NULL &&
JLI_StrNCmp(newpath, runpath, JLI_StrLen(newpath)) == 0 &&
- (runpath[JLI_StrLen(newpath)] == 0 || runpath[JLI_StrLen(newpath)] == ':') &&
- (running == wanted) /* data model does not have to be changed */
-#ifdef __solaris__
- && (dmpath == NULL) /* data model specific variables not set */
-#endif /* __solaris__ */
- ) {
- JLI_MemFree(newargv);
+ (runpath[JLI_StrLen(newpath)] == 0 ||
+ runpath[JLI_StrLen(newpath)] == ':')) {
JLI_MemFree(new_runpath);
return;
}
- }
}
+ }
- /*
- * Place the desired environment setting onto the prefix of
- * LD_LIBRARY_PATH. Note that this prevents any possible infinite
- * loop of execv() because we test for the prefix, above.
- */
- if (runpath != 0) {
- /* ensure storage for runpath + colon + NULL */
- if ((JLI_StrLen(runpath) + 1 + 1) > new_runpath_size) {
- JLI_ReportErrorMessageSys(JRE_ERROR11);
- exit(1);
- }
- JLI_StrCat(new_runpath, ":");
- JLI_StrCat(new_runpath, runpath);
+ /*
+ * Place the desired environment setting onto the prefix of
+ * LD_LIBRARY_PATH. Note that this prevents any possible infinite
+ * loop of execv() because we test for the prefix, above.
+ */
+ if (runpath != 0) {
+ /* ensure storage for runpath + colon + NULL */
+ if ((JLI_StrLen(runpath) + 1 + 1) > new_runpath_size) {
+ JLI_ReportErrorMessageSys(JRE_ERROR11);
+ exit(1);
}
-
- if (putenv(new_runpath) != 0) {
- exit(1); /* problem allocating memory; LD_LIBRARY_PATH not set
- properly */
- }
+ JLI_StrCat(new_runpath, ":");
+ JLI_StrCat(new_runpath, runpath);
+ }
- /*
- * Unix systems document that they look at LD_LIBRARY_PATH only
- * once at startup, so we have to re-exec the current executable
- * to get the changed environment variable to have an effect.
- */
+ if (putenv(new_runpath) != 0) {
+ /* problem allocating memory; LD_LIBRARY_PATH not set properly */
+ exit(1);
+ }
-#ifdef __solaris__
- /*
- * If dmpath is not NULL, remove the data model specific string
- * in the environment for the exec'ed child.
- */
- if (dmpath != NULL)
- (void)UnsetEnv("LD_LIBRARY_PATH_64");
-#endif /* __solaris */
+ /*
+ * Unix systems document that they look at LD_LIBRARY_PATH only
+ * once at startup, so we have to re-exec the current executable
+ * to get the changed environment variable to have an effect.
+ */
- newenvp = environ;
- }
+ newenvp = environ;
+ }
#endif /* SETENV_REQUIRED */
- {
- char *newexec = execname;
- JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
- (void) fflush(stdout);
- (void) fflush(stderr);
+ {
+ char *newexec = execname;
+ JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
+ (void) fflush(stdout);
+ (void) fflush(stderr);
#ifdef SETENV_REQUIRED
- if (mustsetenv) {
- execve(newexec, argv, newenvp);
- } else {
- execv(newexec, argv);
- }
+ if (mustsetenv) {
+ execve(newexec, argv, newenvp);
+ } else {
+ execv(newexec, argv);
+ }
#else /* !SETENV_REQUIRED */
- execv(newexec, argv);
+ execv(newexec, argv);
#endif /* SETENV_REQUIRED */
- JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
- }
- exit(1);
+ JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
}
+ exit(1);
}
-/*
- * On Solaris VM choosing is done by the launcher (java.c),
- * bitsWanted is used by MacOSX, on Solaris and Linux this.
- * parameter is unused.
- */
+
static jboolean
GetJVMPath(const char *jrepath, const char *jvmtype,
- char *jvmpath, jint jvmpathsize, int bitsWanted)
+ char *jvmpath, jint jvmpathsize)
{
struct stat s;
--- a/jdk/src/java.base/windows/native/libjli/java_md.c Wed May 10 23:06:49 2017 +0530
+++ b/jdk/src/java.base/windows/native/libjli/java_md.c Wed May 10 15:12:43 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -158,32 +158,10 @@
char *jrepath, jint so_jrepath,
char *jvmpath, jint so_jvmpath,
char *jvmcfg, jint so_jvmcfg) {
- char * jvmtype;
+
+ char *jvmtype;
int i = 0;
- int running = CURRENT_DATA_MODEL;
-
- int wanted = running;
-
char** argv = *pargv;
- for (i = 1; i < *pargc ; i++) {
- if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) {
- wanted = 64;
- continue;
- }
- if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) {
- wanted = 32;
- continue;
- }
-
- if (IsJavaArgs() && argv[i][0] != '-')
- continue;
- if (argv[i][0] != '-')
- break;
- }
- if (running != wanted) {
- JLI_ReportErrorMessage(JRE_ERROR2, wanted);
- exit(1);
- }
/* Find out where the JRE is that we will be using. */
if (!GetJREPath(jrepath, so_jrepath)) {
--- a/jdk/test/ProblemList.txt Wed May 10 23:06:49 2017 +0530
+++ b/jdk/test/ProblemList.txt Wed May 10 15:12:43 2017 -0700
@@ -99,9 +99,8 @@
# 1. Make sure test passes on all platforms with samevm, or mark it othervm
# 2. Make sure test passes on all platforms when run with it's entire group
# 3. Make sure both VMs are tested, -server and -client, if possible
-# 4. Make sure you try the -d64 option on Solaris
-# 5. Use a tool like JPRT or something to verify these results
-# 6. Delete lines in this file, include the changes with your test changes
+# 4. Use a tool like JPRT or something to verify these results
+# 5. Delete lines in this file, include the changes with your test changes
#
# You may need to repeat your testing 2 or even 3 times to verify good
# results, some of these samevm failures are not very predictable.
--- a/jdk/test/java/awt/JAWT/JAWT.sh Wed May 10 23:06:49 2017 +0530
+++ b/jdk/test/java/awt/JAWT/JAWT.sh Wed May 10 15:12:43 2017 -0700
@@ -85,7 +85,7 @@
MAKEFILE="Makefile.win"
CC="cl"
MAKE="nmake"
- ${TESTJAVA}${FS}bin${FS}java -d64 -version 2>&1 | grep '64-Bit' > $NULL
+ ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL
if [ "$?" -eq '0' ]
then
ARCH="amd64"
@@ -100,7 +100,7 @@
FS="/"
MAKEFILE="Makefile.cygwin"
CC="gcc"
- ${TESTJAVA}${FS}bin${FS}java -d64 -version 2>&1 | grep '64-Bit' > $NULL
+ ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL
if [ "$?" -eq '0' ]
then
ARCH="amd64"
--- a/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh Wed May 10 23:06:49 2017 +0530
+++ b/jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh Wed May 10 15:12:43 2017 -0700
@@ -47,12 +47,7 @@
TESTCLASSES=`pwd`
JAVA=java
which $JAVA
- ${JAVA} -d64 -version > /dev/null 2<&1
- if [ $? = 1 ]; then
${JAVA} -version
- else
- ${JAVA} -d64 -version
- fi
else
JAVA="${TESTJAVA}/bin/java"
fi
--- a/jdk/test/java/util/Arrays/Big.java Wed May 10 23:06:49 2017 +0530
+++ b/jdk/test/java/util/Arrays/Big.java Wed May 10 15:12:43 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
// A proper regression test for 5045582 requires too much memory.
// If you have a really big machine, run like this:
-// java -d64 -Xms25g -Xmx25g Big 30
+// java -Xms25g -Xmx25g Big 30
import java.util.*;
@@ -68,7 +68,7 @@
}
// To test Object arrays larger than 1<<30, you need 13GB. Run like:
- // java -d64 -Xms13g -Xmx13g Big 30 2
+ // java -Xms13g -Xmx13g Big 30 2
if ((tasks & 0x2) != 0) {
System.out.println("Integer[]");
System.gc();
--- a/jdk/test/tools/launcher/ChangeDataModel.java Wed May 10 23:06:49 2017 +0530
+++ b/jdk/test/tools/launcher/ChangeDataModel.java Wed May 10 15:12:43 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,104 +23,57 @@
/**
* @test
- * @bug 4894330 4810347 6277269 8029388
+ * @bug 4894330 4810347 6277269 8029388 8169646
* @compile -XDignore.symbol.file ChangeDataModel.java
* @run main ChangeDataModel
- * @summary Verify -d32 and -d64 options are accepted(rejected) on all platforms
+ * @summary Verify -d32, -d64 and -J prefixed data-model options are rejected on all platforms
* @author Joseph D. Darcy, ksrini
*/
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
+
+import java.util.Arrays;
public class ChangeDataModel extends TestHelper {
- private static final File TestJar = new File("test" + JAR_FILE_EXT);
- private static final String OptionName = "Args";
- private static final File TestOptionJar = new File(OptionName + JAR_FILE_EXT);
- private static final String OPT_PREFIX = "ARCH_OPT:";
- static void createTestJar() throws Exception {
- String[] code = {
- " public static void main(String argv[]) {",
- " System.out.println(\"" + OPT_PREFIX + "-d\" + System.getProperty(\"sun.arch.data.model\", \"none\"));",
- " }",};
- createJar(TestJar, code);
- }
public static void main(String... args) throws Exception {
- createTestJar();
- createOptionsJar();
+ new ChangeDataModel().run(args);
+ }
- // verify if data model flag for default data model is accepted, also
- // verify if the complimentary data model is rejected.
- if (is32Bit) {
- checkAcceptance(javaCmd, "-d32");
- checkRejection(javaCmd, "-d64");
- checkOption(javaCmd, "-d64");
- } else if (is64Bit) {
- checkAcceptance(javaCmd, "-d64");
- checkRejection(javaCmd, "-d32");
- checkOption(javaCmd, "-d32");
- } else {
- throw new Error("unsupported data model");
- }
+ @Test
+ public void check32bitRejection() throws Exception {
+ checkRejection("-d32");
+ }
+
+ @Test
+ public void check64bitRejection() throws Exception {
+ checkRejection("-d64");
}
- static void checkAcceptance(String cmd, String dmodel) {
- TestResult tr = doExec(cmd, dmodel, "-jar", TestJar.getAbsolutePath());
- if (!tr.contains(OPT_PREFIX + dmodel)) {
+ void checkRejection(String dmodel) throws Exception {
+ String expect = "Unrecognized option: " + dmodel;
+ String[] cmds1 = {
+ javaCmd,
+ dmodel,
+ "-version"
+ };
+ checkRejection(expect, cmds1);
+
+ String[] cmds2 = {
+ javacCmd,
+ "-J" + dmodel,
+ "-version"
+ };
+ checkRejection(expect, cmds2);
+ }
+
+
+ void checkRejection(String expect, String... cmds) throws Exception {
+ TestResult tr = doExec(cmds);
+ tr.checkNegative();
+ if (!tr.contains(expect)) {
System.out.println(tr);
- String message = "Data model flag " + dmodel +
- " not accepted or had improper effect.";
- throw new RuntimeException(message);
+ String error = "did not get " + "\'" + expect + "\'" +
+ "with options " + Arrays.asList(cmds);
+ throw new Exception(error);
}
}
-
- static void checkRejection(String cmd, String dmodel) {
- TestResult tr = doExec(cmd, dmodel, "-jar", TestJar.getAbsolutePath());
- if (tr.contains(OPT_PREFIX + dmodel)) {
- System.out.println(tr);
- String message = "Data model flag " + dmodel + " was accepted.";
- throw new RuntimeException(message);
- }
- }
-
- static void checkOption(String cmd, String dmodel) throws Exception {
- TestResult tr = doExec(cmd, "-jar", TestOptionJar.getAbsolutePath(), dmodel);
- verifyOption(tr, dmodel);
-
- tr = doExec(cmd, "-cp", ".", OptionName, dmodel);
- verifyOption(tr, dmodel);
- }
-
- static void verifyOption(TestResult tr, String dmodel) {
- if (!tr.contains(OPT_PREFIX + dmodel)) {
- System.out.println(tr);
- String message = "app argument: " + dmodel + " not found.";
- throw new RuntimeException(message);
- }
- if (!tr.isOK()) {
- System.out.println(tr);
- String message = "app argument: " + dmodel + " interpreted ?";
- throw new RuntimeException(message);
- }
- }
-
- static void createOptionsJar() throws Exception {
- List<String> code = new ArrayList<>();
- code.add("public class Args {");
- code.add(" public static void main(String argv[]) {");
- code.add(" for (String x : argv)");
- code.add(" System.out.println(\"" + OPT_PREFIX + "\" + x);");
- code.add(" }");
- code.add("}");
- File optionsJava = new File(OptionName + JAVA_FILE_EXT);
- createFile(optionsJava, code);
- File optionsClass = new File(OptionName + CLASS_FILE_EXT);
-
- compile(optionsJava.getName());
- createJar("cvfe",
- TestOptionJar.getName(),
- OptionName,
- optionsClass.getName());
- }
}
--- a/jdk/test/tools/launcher/Test7029048.java Wed May 10 23:06:49 2017 +0530
+++ b/jdk/test/tools/launcher/Test7029048.java Wed May 10 15:12:43 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -193,7 +193,7 @@
if (isSolaris) {
/*
* Case 3: set the appropriate LLP_XX flag,
- * java64 -d64, LLP_64 is relevant, LLP_32 is ignored
+ * java64 LLP_64 is relevant, LLP_32 is ignored
*/
env.clear();
env.put(LD_LIBRARY_PATH_64, dstServerDir.getAbsolutePath());