39 typedef void (JNICALL *abort_hook_t)(void); |
39 typedef void (JNICALL *abort_hook_t)(void); |
40 typedef void (JNICALL *exit_hook_t)(jint code); |
40 typedef void (JNICALL *exit_hook_t)(jint code); |
41 typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args) ATTRIBUTE_PRINTF(2, 0); |
41 typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args) ATTRIBUTE_PRINTF(2, 0); |
42 } |
42 } |
43 |
43 |
44 // Forward declarations |
44 // PathString is used as: |
45 class ArgumentBootClassPath; |
45 // - the underlying value for a SystemProperty |
46 |
46 // - the path portion of an -Xpatch module/path pair |
47 // PathString is used as the underlying value container for a |
47 // - the string that represents the system boot class path, Arguments::_system_boot_class_path. |
48 // SystemProperty and for the string that represents the system |
|
49 // boot class path, Arguments::_system_boot_class_path. |
|
50 class PathString : public CHeapObj<mtArguments> { |
48 class PathString : public CHeapObj<mtArguments> { |
51 protected: |
49 protected: |
52 char* _value; |
50 char* _value; |
53 public: |
51 public: |
54 char* value() const { return _value; } |
52 char* value() const { return _value; } |
55 |
53 |
56 bool set_value(const char *value) { |
54 bool set_value(const char *value) { |
57 if (_value != NULL) { |
55 if (_value != NULL) { |
58 FreeHeap(_value); |
56 FreeHeap(_value); |
59 } |
57 } |
90 _value = sp; |
88 _value = sp; |
91 } |
89 } |
92 } |
90 } |
93 } |
91 } |
94 |
92 |
95 // Constructor |
|
96 PathString(const char* value) { |
93 PathString(const char* value) { |
97 if (value == NULL) { |
94 if (value == NULL) { |
98 _value = NULL; |
95 _value = NULL; |
99 } else { |
96 } else { |
100 _value = AllocateHeap(strlen(value)+1, mtArguments); |
97 _value = AllocateHeap(strlen(value)+1, mtArguments); |
101 strcpy(_value, value); |
98 strcpy(_value, value); |
102 } |
99 } |
103 } |
100 } |
|
101 |
|
102 ~PathString() { |
|
103 if (_value != NULL) { |
|
104 FreeHeap(_value); |
|
105 _value = NULL; |
|
106 } |
|
107 } |
|
108 }; |
|
109 |
|
110 // ModuleXPatchPath records the module/path pair as specified to -Xpatch. |
|
111 class ModuleXPatchPath : public CHeapObj<mtInternal> { |
|
112 private: |
|
113 char* _module_name; |
|
114 PathString* _path; |
|
115 public: |
|
116 ModuleXPatchPath(const char* module_name, const char* path) { |
|
117 assert(module_name != NULL && path != NULL, "Invalid module name or path value"); |
|
118 size_t len = strlen(module_name) + 1; |
|
119 _module_name = AllocateHeap(len, mtInternal); |
|
120 strncpy(_module_name, module_name, len); // copy the trailing null |
|
121 _path = new PathString(path); |
|
122 } |
|
123 |
|
124 ~ModuleXPatchPath() { |
|
125 if (_module_name != NULL) { |
|
126 FreeHeap(_module_name); |
|
127 _module_name = NULL; |
|
128 } |
|
129 if (_path != NULL) { |
|
130 delete _path; |
|
131 _path = NULL; |
|
132 } |
|
133 } |
|
134 |
|
135 inline void set_path(const char* path) { _path->set_value(path); } |
|
136 inline const char* module_name() const { return _module_name; } |
|
137 inline char* path_string() const { return _path->value(); } |
104 }; |
138 }; |
105 |
139 |
106 // Element describing System and User (-Dkey=value flags) defined property. |
140 // Element describing System and User (-Dkey=value flags) defined property. |
107 // |
141 // |
108 // An internal SystemProperty is one that has been removed in |
142 // An internal SystemProperty is one that has been removed in |
312 static SystemProperty *_java_library_path; |
346 static SystemProperty *_java_library_path; |
313 static SystemProperty *_java_home; |
347 static SystemProperty *_java_home; |
314 static SystemProperty *_java_class_path; |
348 static SystemProperty *_java_class_path; |
315 static SystemProperty *_jdk_boot_class_path_append; |
349 static SystemProperty *_jdk_boot_class_path_append; |
316 |
350 |
|
351 // -Xpatch:module=<file>(<pathsep><file>)* |
|
352 // Each element contains the associated module name, path |
|
353 // string pair as specified to -Xpatch. |
|
354 static GrowableArray<ModuleXPatchPath*>* _xpatchprefix; |
|
355 |
317 // The constructed value of the system class path after |
356 // The constructed value of the system class path after |
318 // argument processing and JVMTI OnLoad additions via |
357 // argument processing and JVMTI OnLoad additions via |
319 // calls to AddToBootstrapClassLoaderSearch. This is the |
358 // calls to AddToBootstrapClassLoaderSearch. This is the |
320 // final form before ClassLoader::setup_bootstrap_search(). |
359 // final form before ClassLoader::setup_bootstrap_search(). |
|
360 // Note: since -Xpatch is a module name/path pair, the system |
|
361 // boot class path string no longer contains the "prefix" to |
|
362 // the boot class path base piece as it did when |
|
363 // -Xbootclasspath/p was supported. |
321 static PathString *_system_boot_class_path; |
364 static PathString *_system_boot_class_path; |
322 |
365 |
323 // temporary: to emit warning if the default ext dirs are not empty. |
366 // temporary: to emit warning if the default ext dirs are not empty. |
324 // remove this variable when the warning is no longer needed. |
367 // remove this variable when the warning is no longer needed. |
325 static char* _ext_dirs; |
368 static char* _ext_dirs; |
370 |
413 |
371 // Capture the index location of -Xbootclasspath\a within sysclasspath. |
414 // Capture the index location of -Xbootclasspath\a within sysclasspath. |
372 // Used when setting up the bootstrap search path in order to |
415 // Used when setting up the bootstrap search path in order to |
373 // mark the boot loader's append path observability boundary. |
416 // mark the boot loader's append path observability boundary. |
374 static int _bootclassloader_append_index; |
417 static int _bootclassloader_append_index; |
375 |
|
376 // -Xpatch flag |
|
377 static char** _patch_dirs; |
|
378 static int _patch_dirs_count; |
|
379 static void set_patch_dirs(char** dirs) { _patch_dirs = dirs; } |
|
380 static void set_patch_dirs_count(int count) { _patch_dirs_count = count; } |
|
381 |
418 |
382 // -Xdebug flag |
419 // -Xdebug flag |
383 static bool _xdebug_mode; |
420 static bool _xdebug_mode; |
384 static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; } |
421 static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; } |
385 static bool xdebug_mode() { return _xdebug_mode; } |
422 static bool xdebug_mode() { return _xdebug_mode; } |
463 static bool handle_deprecated_print_gc_flags(); |
500 static bool handle_deprecated_print_gc_flags(); |
464 |
501 |
465 static jint parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args, |
502 static jint parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args, |
466 const JavaVMInitArgs *java_options_args, |
503 const JavaVMInitArgs *java_options_args, |
467 const JavaVMInitArgs *cmd_line_args); |
504 const JavaVMInitArgs *cmd_line_args); |
468 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, ArgumentBootClassPath* bcp_p, bool* bcp_assembly_required_p, Flag::Flags origin); |
505 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_javabase, Flag::Flags origin); |
469 static jint finalize_vm_init_args(ArgumentBootClassPath* bcp_p, bool bcp_assembly_required); |
506 static jint finalize_vm_init_args(); |
470 static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type); |
507 static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type); |
471 |
508 |
472 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) { |
509 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) { |
473 return is_bad_option(option, ignore, NULL); |
510 return is_bad_option(option, ignore, NULL); |
474 } |
511 } |
635 // -Xbootclasspath/a |
672 // -Xbootclasspath/a |
636 static int bootclassloader_append_index() { |
673 static int bootclassloader_append_index() { |
637 return _bootclassloader_append_index; |
674 return _bootclassloader_append_index; |
638 } |
675 } |
639 static void set_bootclassloader_append_index(int value) { |
676 static void set_bootclassloader_append_index(int value) { |
640 _bootclassloader_append_index = value; |
677 // Set only if the index has not been set yet |
641 } |
678 if (_bootclassloader_append_index == -1) { |
642 |
679 _bootclassloader_append_index = value; |
643 // -Xpatch |
680 } |
644 static char** patch_dirs() { return _patch_dirs; } |
681 } |
645 static int patch_dirs_count() { return _patch_dirs_count; } |
|
646 |
682 |
647 // -Xrun |
683 // -Xrun |
648 static AgentLibrary* libraries() { return _libraryList.first(); } |
684 static AgentLibrary* libraries() { return _libraryList.first(); } |
649 static bool init_libraries_at_startup() { return !_libraryList.is_empty(); } |
685 static bool init_libraries_at_startup() { return !_libraryList.is_empty(); } |
650 static void convert_library_to_agent(AgentLibrary* lib) |
686 static void convert_library_to_agent(AgentLibrary* lib) |
699 static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); } |
735 static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); } |
700 static void set_java_home(const char *value) { _java_home->set_value(value); } |
736 static void set_java_home(const char *value) { _java_home->set_value(value); } |
701 static void set_library_path(const char *value) { _java_library_path->set_value(value); } |
737 static void set_library_path(const char *value) { _java_library_path->set_value(value); } |
702 static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); } |
738 static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); } |
703 |
739 |
704 // Set up of the underlying system boot class path |
740 // Set up the underlying pieces of the system boot class path |
705 static void set_jdkbootclasspath_append(); |
741 static void add_xpatchprefix(const char *module_name, const char *path, bool* xpatch_javabase); |
706 static void set_sysclasspath(const char *value) { |
742 static void set_sysclasspath(const char *value) { |
707 _system_boot_class_path->set_value(value); |
743 _system_boot_class_path->set_value(value); |
708 set_jdkbootclasspath_append(); |
744 set_jdkbootclasspath_append(); |
709 } |
745 } |
710 static void append_sysclasspath(const char *value) { |
746 static void append_sysclasspath(const char *value) { |
711 _system_boot_class_path->append_value(value); |
747 _system_boot_class_path->append_value(value); |
712 set_jdkbootclasspath_append(); |
748 set_jdkbootclasspath_append(); |
713 } |
749 } |
714 |
750 static void set_jdkbootclasspath_append(); |
715 static char* get_java_home() { return _java_home->value(); } |
751 |
716 static char* get_dll_dir() { return _sun_boot_library_path->value(); } |
752 static GrowableArray<ModuleXPatchPath*>* get_xpatchprefix() { return _xpatchprefix; } |
717 static char* get_sysclasspath() { return _system_boot_class_path->value(); } |
753 static char* get_sysclasspath() { return _system_boot_class_path->value(); } |
718 static char* get_ext_dirs() { return _ext_dirs; } |
754 static char* get_jdk_boot_class_path_append() { return _jdk_boot_class_path_append->value(); } |
|
755 |
|
756 static char* get_java_home() { return _java_home->value(); } |
|
757 static char* get_dll_dir() { return _sun_boot_library_path->value(); } |
|
758 static char* get_ext_dirs() { return _ext_dirs; } |
719 static char* get_appclasspath() { return _java_class_path->value(); } |
759 static char* get_appclasspath() { return _java_class_path->value(); } |
720 static void fix_appclasspath(); |
760 static void fix_appclasspath(); |
721 |
761 |
722 |
762 |
723 // Operation modi |
763 // Operation modi |