227 SysClassPath(const char* base); |
227 SysClassPath(const char* base); |
228 ~SysClassPath(); |
228 ~SysClassPath(); |
229 |
229 |
230 inline void set_base(const char* base); |
230 inline void set_base(const char* base); |
231 inline void add_prefix(const char* prefix); |
231 inline void add_prefix(const char* prefix); |
|
232 inline void add_suffix_to_prefix(const char* suffix); |
232 inline void add_suffix(const char* suffix); |
233 inline void add_suffix(const char* suffix); |
233 inline void reset_path(const char* base); |
234 inline void reset_path(const char* base); |
234 |
235 |
235 // Expand the jar/zip files in each directory listed by the java.endorsed.dirs |
236 // Expand the jar/zip files in each directory listed by the java.endorsed.dirs |
236 // property. Must be called after all command-line arguments have been |
237 // property. Must be called after all command-line arguments have been |
286 _items[_scp_base] = base; |
287 _items[_scp_base] = base; |
287 } |
288 } |
288 |
289 |
289 inline void SysClassPath::add_prefix(const char* prefix) { |
290 inline void SysClassPath::add_prefix(const char* prefix) { |
290 _items[_scp_prefix] = add_to_path(_items[_scp_prefix], prefix, true); |
291 _items[_scp_prefix] = add_to_path(_items[_scp_prefix], prefix, true); |
|
292 } |
|
293 |
|
294 inline void SysClassPath::add_suffix_to_prefix(const char* suffix) { |
|
295 _items[_scp_prefix] = add_to_path(_items[_scp_prefix], suffix, false); |
291 } |
296 } |
292 |
297 |
293 inline void SysClassPath::add_suffix(const char* suffix) { |
298 inline void SysClassPath::add_suffix(const char* suffix) { |
294 _items[_scp_suffix] = add_to_path(_items[_scp_suffix], suffix, false); |
299 _items[_scp_suffix] = add_to_path(_items[_scp_suffix], suffix, false); |
295 } |
300 } |
510 |
515 |
511 static bool set_bool_flag(char* name, bool value, FlagValueOrigin origin) { |
516 static bool set_bool_flag(char* name, bool value, FlagValueOrigin origin) { |
512 return CommandLineFlags::boolAtPut(name, &value, origin); |
517 return CommandLineFlags::boolAtPut(name, &value, origin); |
513 } |
518 } |
514 |
519 |
515 |
|
516 static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) { |
520 static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) { |
517 double v; |
521 double v; |
518 if (sscanf(value, "%lf", &v) != 1) { |
522 if (sscanf(value, "%lf", &v) != 1) { |
519 return false; |
523 return false; |
520 } |
524 } |
552 if (!is_neg && CommandLineFlags::uintxAtPut(name, &uintx_v, origin)) { |
555 if (!is_neg && CommandLineFlags::uintxAtPut(name, &uintx_v, origin)) { |
553 return true; |
556 return true; |
554 } |
557 } |
555 return false; |
558 return false; |
556 } |
559 } |
557 |
|
558 |
560 |
559 static bool set_string_flag(char* name, const char* value, FlagValueOrigin origin) { |
561 static bool set_string_flag(char* name, const char* value, FlagValueOrigin origin) { |
560 if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false; |
562 if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false; |
561 // Contract: CommandLineFlags always returns a pointer that needs freeing. |
563 // Contract: CommandLineFlags always returns a pointer that needs freeing. |
562 FREE_C_HEAP_ARRAY(char, value); |
564 FREE_C_HEAP_ARRAY(char, value); |
589 FREE_C_HEAP_ARRAY(char, free_this_too); |
591 FREE_C_HEAP_ARRAY(char, free_this_too); |
590 } |
592 } |
591 return true; |
593 return true; |
592 } |
594 } |
593 |
595 |
594 |
|
595 bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) { |
596 bool Arguments::parse_argument(const char* arg, FlagValueOrigin origin) { |
596 |
597 |
597 // range of acceptable characters spelled out for portability reasons |
598 // range of acceptable characters spelled out for portability reasons |
598 #define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]" |
599 #define NAME_RANGE "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]" |
599 #define BUFLEN 255 |
600 #define BUFLEN 255 |
649 return set_numeric_flag(name, value, origin); |
650 return set_numeric_flag(name, value, origin); |
650 } |
651 } |
651 |
652 |
652 return false; |
653 return false; |
653 } |
654 } |
654 |
|
655 |
655 |
656 void Arguments::add_string(char*** bldarray, int* count, const char* arg) { |
656 void Arguments::add_string(char*** bldarray, int* count, const char* arg) { |
657 assert(bldarray != NULL, "illegal argument"); |
657 assert(bldarray != NULL, "illegal argument"); |
658 |
658 |
659 if (arg == NULL) { |
659 if (arg == NULL) { |
930 ClipInlining = false; |
929 ClipInlining = false; |
931 break; |
930 break; |
932 } |
931 } |
933 } |
932 } |
934 |
933 |
935 |
|
936 // Conflict: required to use shared spaces (-Xshare:on), but |
934 // Conflict: required to use shared spaces (-Xshare:on), but |
937 // incompatible command line options were chosen. |
935 // incompatible command line options were chosen. |
938 |
936 |
939 static void no_shared_spaces() { |
937 static void no_shared_spaces() { |
940 if (RequireSharedSpaces) { |
938 if (RequireSharedSpaces) { |
943 vm_exit_during_initialization("Unable to use shared archive.", NULL); |
941 vm_exit_during_initialization("Unable to use shared archive.", NULL); |
944 } else { |
942 } else { |
945 FLAG_SET_DEFAULT(UseSharedSpaces, false); |
943 FLAG_SET_DEFAULT(UseSharedSpaces, false); |
946 } |
944 } |
947 } |
945 } |
948 |
|
949 |
946 |
950 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC |
947 // If the user has chosen ParallelGCThreads > 0, we set UseParNewGC |
951 // if it's not explictly set or unset. If the user has chosen |
948 // if it's not explictly set or unset. If the user has chosen |
952 // UseParNewGC and not explicitly set ParallelGCThreads we |
949 // UseParNewGC and not explicitly set ParallelGCThreads we |
953 // set it, unless this is a single cpu machine. |
950 // set it, unless this is a single cpu machine. |
1712 result = parse_each_vm_init_arg(args, &scp, &scp_assembly_required, COMMAND_LINE); |
1709 result = parse_each_vm_init_arg(args, &scp, &scp_assembly_required, COMMAND_LINE); |
1713 if (result != JNI_OK) { |
1710 if (result != JNI_OK) { |
1714 return result; |
1711 return result; |
1715 } |
1712 } |
1716 |
1713 |
|
1714 if (AggressiveOpts) { |
|
1715 // Insert alt-rt.jar between user-specified bootclasspath |
|
1716 // prefix and the default bootclasspath. os::set_boot_path() |
|
1717 // uses meta_index_dir as the default bootclasspath directory. |
|
1718 const char* altclasses_jar = "alt-rt.jar"; |
|
1719 size_t altclasses_path_len = strlen(get_meta_index_dir()) + 1 + |
|
1720 strlen(altclasses_jar); |
|
1721 char* altclasses_path = NEW_C_HEAP_ARRAY(char, altclasses_path_len); |
|
1722 strcpy(altclasses_path, get_meta_index_dir()); |
|
1723 strcat(altclasses_path, altclasses_jar); |
|
1724 scp.add_suffix_to_prefix(altclasses_path); |
|
1725 scp_assembly_required = true; |
|
1726 FREE_C_HEAP_ARRAY(char, altclasses_path); |
|
1727 } |
|
1728 |
1717 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) |
1729 // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM) |
1718 result = parse_java_options_environment_variable(&scp, &scp_assembly_required); |
1730 result = parse_java_options_environment_variable(&scp, &scp_assembly_required); |
1719 if (result != JNI_OK) { |
1731 if (result != JNI_OK) { |
1720 return result; |
1732 return result; |
1721 } |
1733 } |
1726 return result; |
1738 return result; |
1727 } |
1739 } |
1728 |
1740 |
1729 return JNI_OK; |
1741 return JNI_OK; |
1730 } |
1742 } |
1731 |
|
1732 |
1743 |
1733 jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, |
1744 jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, |
1734 SysClassPath* scp_p, |
1745 SysClassPath* scp_p, |
1735 bool* scp_assembly_required_p, |
1746 bool* scp_assembly_required_p, |
1736 FlagValueOrigin origin) { |
1747 FlagValueOrigin origin) { |
1793 } else if (match_option(option, "-Xbootclasspath/p:", &tail)) { |
1804 } else if (match_option(option, "-Xbootclasspath/p:", &tail)) { |
1794 scp_p->add_prefix(tail); |
1805 scp_p->add_prefix(tail); |
1795 *scp_assembly_required_p = true; |
1806 *scp_assembly_required_p = true; |
1796 // -Xrun |
1807 // -Xrun |
1797 } else if (match_option(option, "-Xrun", &tail)) { |
1808 } else if (match_option(option, "-Xrun", &tail)) { |
1798 if(tail != NULL) { |
1809 if (tail != NULL) { |
1799 const char* pos = strchr(tail, ':'); |
1810 const char* pos = strchr(tail, ':'); |
1800 size_t len = (pos == NULL) ? strlen(tail) : pos - tail; |
1811 size_t len = (pos == NULL) ? strlen(tail) : pos - tail; |
1801 char* name = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len + 1), tail, len); |
1812 char* name = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len + 1), tail, len); |
1802 name[len] = '\0'; |
1813 name[len] = '\0'; |
1803 |
1814 |