提交 abb19b99 编写于 作者: P phh

6792705: Add JAR file to bootclasspath when using AggressiveOpts

Summary: During argument processing, add alt-rt.jar to the bootclasspath between bootclasspath/p and default elements.
Reviewed-by: xlu, coleenp
上级 28dbf98d
...@@ -229,6 +229,7 @@ public: ...@@ -229,6 +229,7 @@ public:
inline void set_base(const char* base); inline void set_base(const char* base);
inline void add_prefix(const char* prefix); inline void add_prefix(const char* prefix);
inline void add_suffix_to_prefix(const char* suffix);
inline void add_suffix(const char* suffix); inline void add_suffix(const char* suffix);
inline void reset_path(const char* base); inline void reset_path(const char* base);
...@@ -290,6 +291,10 @@ inline void SysClassPath::add_prefix(const char* prefix) { ...@@ -290,6 +291,10 @@ inline void SysClassPath::add_prefix(const char* prefix) {
_items[_scp_prefix] = add_to_path(_items[_scp_prefix], prefix, true); _items[_scp_prefix] = add_to_path(_items[_scp_prefix], prefix, true);
} }
inline void SysClassPath::add_suffix_to_prefix(const char* suffix) {
_items[_scp_prefix] = add_to_path(_items[_scp_prefix], suffix, false);
}
inline void SysClassPath::add_suffix(const char* suffix) { inline void SysClassPath::add_suffix(const char* suffix) {
_items[_scp_suffix] = add_to_path(_items[_scp_suffix], suffix, false); _items[_scp_suffix] = add_to_path(_items[_scp_suffix], suffix, false);
} }
...@@ -512,7 +517,6 @@ static bool set_bool_flag(char* name, bool value, FlagValueOrigin origin) { ...@@ -512,7 +517,6 @@ static bool set_bool_flag(char* name, bool value, FlagValueOrigin origin) {
return CommandLineFlags::boolAtPut(name, &value, origin); return CommandLineFlags::boolAtPut(name, &value, origin);
} }
static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) { static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) {
double v; double v;
if (sscanf(value, "%lf", &v) != 1) { if (sscanf(value, "%lf", &v) != 1) {
...@@ -525,7 +529,6 @@ static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) ...@@ -525,7 +529,6 @@ static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin)
return false; return false;
} }
static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) { static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) {
julong v; julong v;
intx intx_v; intx intx_v;
...@@ -555,7 +558,6 @@ static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) { ...@@ -555,7 +558,6 @@ static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) {
return false; return false;
} }
static bool set_string_flag(char* name, const char* value, FlagValueOrigin origin) { static bool set_string_flag(char* name, const char* value, FlagValueOrigin origin) {
if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false; if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false;
// Contract: CommandLineFlags always returns a pointer that needs freeing. // Contract: CommandLineFlags always returns a pointer that needs freeing.
...@@ -591,7 +593,6 @@ static bool append_to_string_flag(char* name, const char* new_value, FlagValueOr ...@@ -591,7 +593,6 @@ static bool append_to_string_flag(char* name, const char* new_value, FlagValueOr
return true; return true;
} }
bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) { bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) {
// range of acceptable characters spelled out for portability reasons // range of acceptable characters spelled out for portability reasons
...@@ -652,7 +653,6 @@ bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) { ...@@ -652,7 +653,6 @@ bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) {
return false; return false;
} }
void Arguments::add_string(char*** bldarray, int* count, const char* arg) { void Arguments::add_string(char*** bldarray, int* count, const char* arg) {
assert(bldarray != NULL, "illegal argument"); assert(bldarray != NULL, "illegal argument");
...@@ -756,7 +756,6 @@ bool Arguments::process_argument(const char* arg, ...@@ -756,7 +756,6 @@ bool Arguments::process_argument(const char* arg,
return true; return true;
} }
bool Arguments::process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized) { bool Arguments::process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized) {
FILE* stream = fopen(file_name, "rb"); FILE* stream = fopen(file_name, "rb");
if (stream == NULL) { if (stream == NULL) {
...@@ -932,7 +931,6 @@ void Arguments::set_mode_flags(Mode mode) { ...@@ -932,7 +931,6 @@ void Arguments::set_mode_flags(Mode mode) {
} }
} }
// Conflict: required to use shared spaces (-Xshare:on), but // Conflict: required to use shared spaces (-Xshare:on), but
// incompatible command line options were chosen. // incompatible command line options were chosen.
...@@ -946,7 +944,6 @@ static void no_shared_spaces() { ...@@ -946,7 +944,6 @@ static void no_shared_spaces() {
} }
} }
// If the user has chosen ParallelGCThreads > 0, we set UseParNewGC // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC
// if it's not explictly set or unset. If the user has chosen // if it's not explictly set or unset. If the user has chosen
// UseParNewGC and not explicitly set ParallelGCThreads we // UseParNewGC and not explicitly set ParallelGCThreads we
...@@ -1714,6 +1711,21 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) { ...@@ -1714,6 +1711,21 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) {
return result; return result;
} }
if (AggressiveOpts) {
// Insert alt-rt.jar between user-specified bootclasspath
// prefix and the default bootclasspath. os::set_boot_path()
// uses meta_index_dir as the default bootclasspath directory.
const char* altclasses_jar = "alt-rt.jar";
size_t altclasses_path_len = strlen(get_meta_index_dir()) + 1 +
strlen(altclasses_jar);
char* altclasses_path = NEW_C_HEAP_ARRAY(char, altclasses_path_len);
strcpy(altclasses_path, get_meta_index_dir());
strcat(altclasses_path, altclasses_jar);
scp.add_suffix_to_prefix(altclasses_path);
scp_assembly_required = true;
FREE_C_HEAP_ARRAY(char, altclasses_path);
}
// Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM)
result = parse_java_options_environment_variable(&scp, &scp_assembly_required); result = parse_java_options_environment_variable(&scp, &scp_assembly_required);
if (result != JNI_OK) { if (result != JNI_OK) {
...@@ -1729,7 +1741,6 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) { ...@@ -1729,7 +1741,6 @@ jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) {
return JNI_OK; return JNI_OK;
} }
jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
SysClassPath* scp_p, SysClassPath* scp_p,
bool* scp_assembly_required_p, bool* scp_assembly_required_p,
...@@ -1795,7 +1806,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, ...@@ -1795,7 +1806,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
*scp_assembly_required_p = true; *scp_assembly_required_p = true;
// -Xrun // -Xrun
} else if (match_option(option, "-Xrun", &tail)) { } else if (match_option(option, "-Xrun", &tail)) {
if(tail != NULL) { if (tail != NULL) {
const char* pos = strchr(tail, ':'); const char* pos = strchr(tail, ':');
size_t len = (pos == NULL) ? strlen(tail) : pos - tail; size_t len = (pos == NULL) ? strlen(tail) : pos - tail;
char* name = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len + 1), tail, len); char* name = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len + 1), tail, len);
...@@ -2558,7 +2569,6 @@ jint Arguments::parse(const JavaVMInitArgs* args) { ...@@ -2558,7 +2569,6 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
} }
} }
// Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS
jint result = parse_vm_init_args(args); jint result = parse_vm_init_args(args);
if (result != JNI_OK) { if (result != JNI_OK) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册