10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_RUNTIME_ARGUMENTS_HPP
26 #define SHARE_VM_RUNTIME_ARGUMENTS_HPP
27
28 #include "runtime/java.hpp"
29 #include "runtime/perfData.hpp"
30 #include "utilities/top.hpp"
31
32 // Arguments parses the command line and recognizes options
33
34 // Invocation API hook typedefs (these should really be defined in jni.hpp)
35 extern "C" {
36 typedef void (JNICALL *abort_hook_t)(void);
37 typedef void (JNICALL *exit_hook_t)(jint code);
38 typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args);
39 }
40
41 // Forward declarations
42
43 class SysClassPath;
44
45 // Element describing System and User (-Dkey=value flags) defined property.
46
47 class SystemProperty: public CHeapObj<mtInternal> {
48 private:
49 char* _key;
333 // Aggressive optimization flags.
334 static void set_aggressive_opts_flags();
335
336 // Argument parsing
337 static void do_pd_flag_adjustments();
338 static bool parse_argument(const char* arg, FlagValueOrigin origin);
339 static bool process_argument(const char* arg, jboolean ignore_unrecognized, FlagValueOrigin origin);
340 static void process_java_launcher_argument(const char*, void*);
341 static void process_java_compiler_argument(char* arg);
342 static jint parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p);
343 static jint parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
344 static jint parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
345 static jint parse_vm_init_args(const JavaVMInitArgs* args);
346 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, FlagValueOrigin origin);
347 static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required);
348 static bool is_bad_option(const JavaVMOption* option, jboolean ignore,
349 const char* option_type);
350 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
351 return is_bad_option(option, ignore, NULL);
352 }
353 static bool verify_interval(uintx val, uintx min,
354 uintx max, const char* name);
355 static bool verify_min_value(intx val, intx min, const char* name);
356 static bool verify_percentage(uintx value, const char* name);
357 static void describe_range_error(ArgsRange errcode);
358 static ArgsRange check_memory_size(julong size, julong min_size);
359 static ArgsRange parse_memory_size(const char* s, julong* long_arg,
360 julong min_size);
361 // Parse a string for a unsigned integer. Returns true if value
362 // is an unsigned integer greater than or equal to the minimum
363 // parameter passed and returns the value in uintx_arg. Returns
364 // false otherwise, with uintx_arg undefined.
365 static bool parse_uintx(const char* value, uintx* uintx_arg,
366 uintx min_size);
367
368 // methods to build strings from individual args
369 static void build_jvm_args(const char* arg);
370 static void build_jvm_flags(const char* arg);
371 static void add_string(char*** bldarray, int* count, const char* arg);
372 static const char* build_resource_string(char** args, int count);
394 static char** CompileOnlyClasses;
395 static bool* CompileOnlyAllMethods;
396
397 static short CompileOnlyMethodsNum;
398 static short CompileOnlyMethodsMax;
399 static char** CompileOnlyMethods;
400 static bool* CompileOnlyAllClasses;
401
402 static short InterpretOnlyClassesNum;
403 static short InterpretOnlyClassesMax;
404 static char** InterpretOnlyClasses;
405 static bool* InterpretOnlyAllMethods;
406
407 static bool CheckCompileOnly;
408
409 static char* SharedArchivePath;
410
411 public:
412 // Parses the arguments
413 static jint parse(const JavaVMInitArgs* args);
414 // Check for consistency in the selection of the garbage collector.
415 static bool check_gc_consistency();
416 // Check consistecy or otherwise of VM argument settings
417 static bool check_vm_args_consistency();
418 // Check stack pages settings
419 static bool check_stack_pages();
420 // Used by os_solaris
421 static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);
422
423 // return a char* array containing all options
424 static char** jvm_flags_array() { return _jvm_flags_array; }
425 static char** jvm_args_array() { return _jvm_args_array; }
426 static int num_jvm_flags() { return _num_jvm_flags; }
427 static int num_jvm_args() { return _num_jvm_args; }
428 // return the arguments passed to the Java application
429 static const char* java_command() { return _java_command; }
430
431 // print jvm_flags, jvm_args and java_command
432 static void print_on(outputStream* st);
433
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_RUNTIME_ARGUMENTS_HPP
26 #define SHARE_VM_RUNTIME_ARGUMENTS_HPP
27
28 #include "runtime/java.hpp"
29 #include "runtime/perfData.hpp"
30 #include "utilities/debug.hpp"
31 #include "utilities/top.hpp"
32
33 // Arguments parses the command line and recognizes options
34
35 // Invocation API hook typedefs (these should really be defined in jni.hpp)
36 extern "C" {
37 typedef void (JNICALL *abort_hook_t)(void);
38 typedef void (JNICALL *exit_hook_t)(jint code);
39 typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args);
40 }
41
42 // Forward declarations
43
44 class SysClassPath;
45
46 // Element describing System and User (-Dkey=value flags) defined property.
47
48 class SystemProperty: public CHeapObj<mtInternal> {
49 private:
50 char* _key;
334 // Aggressive optimization flags.
335 static void set_aggressive_opts_flags();
336
337 // Argument parsing
338 static void do_pd_flag_adjustments();
339 static bool parse_argument(const char* arg, FlagValueOrigin origin);
340 static bool process_argument(const char* arg, jboolean ignore_unrecognized, FlagValueOrigin origin);
341 static void process_java_launcher_argument(const char*, void*);
342 static void process_java_compiler_argument(char* arg);
343 static jint parse_options_environment_variable(const char* name, SysClassPath* scp_p, bool* scp_assembly_required_p);
344 static jint parse_java_tool_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
345 static jint parse_java_options_environment_variable(SysClassPath* scp_p, bool* scp_assembly_required_p);
346 static jint parse_vm_init_args(const JavaVMInitArgs* args);
347 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, SysClassPath* scp_p, bool* scp_assembly_required_p, FlagValueOrigin origin);
348 static jint finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required);
349 static bool is_bad_option(const JavaVMOption* option, jboolean ignore,
350 const char* option_type);
351 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
352 return is_bad_option(option, ignore, NULL);
353 }
354 static bool is_percentage(uintx val) {
355 return val <= 100;
356 }
357 static bool verify_interval(uintx val, uintx min,
358 uintx max, const char* name);
359 static bool verify_min_value(intx val, intx min, const char* name);
360 static bool verify_percentage(uintx value, const char* name);
361 static void describe_range_error(ArgsRange errcode);
362 static ArgsRange check_memory_size(julong size, julong min_size);
363 static ArgsRange parse_memory_size(const char* s, julong* long_arg,
364 julong min_size);
365 // Parse a string for a unsigned integer. Returns true if value
366 // is an unsigned integer greater than or equal to the minimum
367 // parameter passed and returns the value in uintx_arg. Returns
368 // false otherwise, with uintx_arg undefined.
369 static bool parse_uintx(const char* value, uintx* uintx_arg,
370 uintx min_size);
371
372 // methods to build strings from individual args
373 static void build_jvm_args(const char* arg);
374 static void build_jvm_flags(const char* arg);
375 static void add_string(char*** bldarray, int* count, const char* arg);
376 static const char* build_resource_string(char** args, int count);
398 static char** CompileOnlyClasses;
399 static bool* CompileOnlyAllMethods;
400
401 static short CompileOnlyMethodsNum;
402 static short CompileOnlyMethodsMax;
403 static char** CompileOnlyMethods;
404 static bool* CompileOnlyAllClasses;
405
406 static short InterpretOnlyClassesNum;
407 static short InterpretOnlyClassesMax;
408 static char** InterpretOnlyClasses;
409 static bool* InterpretOnlyAllMethods;
410
411 static bool CheckCompileOnly;
412
413 static char* SharedArchivePath;
414
415 public:
416 // Parses the arguments
417 static jint parse(const JavaVMInitArgs* args);
418 // Verifies that the given value will fit as a MinHeapFreeRatio. If not, an error
419 // message is returned in the provided buffer.
420 static bool verify_MinHeapFreeRatio(FormatBuffer<80>& err_msg, uintx min_heap_free_ratio);
421 // Verifies that the given value will fit as a MaxHeapFreeRatio. If not, an error
422 // message is returned in the provided buffer.
423 static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio);
424 // Check for consistency in the selection of the garbage collector.
425 static bool check_gc_consistency();
426 // Check consistecy or otherwise of VM argument settings
427 static bool check_vm_args_consistency();
428 // Check stack pages settings
429 static bool check_stack_pages();
430 // Used by os_solaris
431 static bool process_settings_file(const char* file_name, bool should_exist, jboolean ignore_unrecognized);
432
433 // return a char* array containing all options
434 static char** jvm_flags_array() { return _jvm_flags_array; }
435 static char** jvm_args_array() { return _jvm_args_array; }
436 static int num_jvm_flags() { return _num_jvm_flags; }
437 static int num_jvm_args() { return _num_jvm_args; }
438 // return the arguments passed to the Java application
439 static const char* java_command() { return _java_command; }
440
441 // print jvm_flags, jvm_args and java_command
442 static void print_on(outputStream* st);
443
|