blob: 3839e199408917304822f51b5ab93f87b95f5213 [file] [log] [blame]
Brian Carlstrom491ca9e2014-03-02 18:24:38 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_RUNTIME_PARSED_OPTIONS_H_
18#define ART_RUNTIME_PARSED_OPTIONS_H_
19
20#include <string>
Ian Rogerse63db272014-07-15 15:36:11 -070021#include <vector>
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080022
Ian Rogerse63db272014-07-15 15:36:11 -070023#include <jni.h>
24
25#include "globals.h"
Ian Rogers576ca0c2014-06-06 15:58:22 -070026#include "gc/collector_type.h"
Ian Rogerse63db272014-07-15 15:36:11 -070027#include "instruction_set.h"
28#include "profiler_options.h"
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080029
30namespace art {
31
Ian Rogerse63db272014-07-15 15:36:11 -070032class CompilerCallbacks;
33class DexFile;
34
35typedef std::vector<std::pair<std::string, const void*>> RuntimeOptions;
36
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080037class ParsedOptions {
38 public:
39 // returns null if problem parsing and ignore_unrecognized is false
Ian Rogerse63db272014-07-15 15:36:11 -070040 static ParsedOptions* Create(const RuntimeOptions& options, bool ignore_unrecognized);
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080041
42 const std::vector<const DexFile*>* boot_class_path_;
43 std::string boot_class_path_string_;
44 std::string class_path_string_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080045 std::string image_;
46 bool check_jni_;
Ian Rogers68d8b422014-07-17 11:09:10 -070047 bool force_copy_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080048 std::string jni_trace_;
Calin Juravlea68629e2014-08-22 12:53:59 +010049 std::string native_bridge_library_filename_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080050 CompilerCallbacks* compiler_callbacks_;
51 bool is_zygote_;
Alex Lighta59dd802014-07-02 16:28:08 -070052 bool must_relocate_;
Nicolas Geoffray4fcdc942014-07-22 10:48:00 +010053 bool dex2oat_enabled_;
Alex Light64ad14d2014-08-19 14:23:13 -070054 bool image_dex2oat_enabled_;
Alex Lighta59dd802014-07-02 16:28:08 -070055 std::string patchoat_executable_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080056 bool interpreter_only_;
57 bool is_explicit_gc_disabled_;
58 bool use_tlab_;
59 bool verify_pre_gc_heap_;
Mathieu Chartier6f365cc2014-04-23 12:42:27 -070060 bool verify_pre_sweeping_heap_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080061 bool verify_post_gc_heap_;
62 bool verify_pre_gc_rosalloc_;
Mathieu Chartier6f365cc2014-04-23 12:42:27 -070063 bool verify_pre_sweeping_rosalloc_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080064 bool verify_post_gc_rosalloc_;
Andreas Gampe39d92182014-03-05 16:46:44 -080065 unsigned int long_pause_log_threshold_;
66 unsigned int long_gc_log_threshold_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080067 bool dump_gc_performance_on_shutdown_;
68 bool ignore_max_footprint_;
69 size_t heap_initial_size_;
70 size_t heap_maximum_size_;
71 size_t heap_growth_limit_;
72 size_t heap_min_free_;
73 size_t heap_max_free_;
Mathieu Chartier6a7824d2014-08-22 14:53:04 -070074 size_t heap_non_moving_space_capacity_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080075 double heap_target_utilization_;
Mathieu Chartier2f8da3e2014-04-15 15:37:02 -070076 double foreground_heap_growth_multiplier_;
Andreas Gampe39d92182014-03-05 16:46:44 -080077 unsigned int parallel_gc_threads_;
78 unsigned int conc_gc_threads_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080079 gc::CollectorType collector_type_;
80 gc::CollectorType background_collector_type_;
81 size_t stack_size_;
Andreas Gampe39d92182014-03-05 16:46:44 -080082 unsigned int max_spins_before_thin_lock_inflation_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080083 bool low_memory_mode_;
Andreas Gampe39d92182014-03-05 16:46:44 -080084 unsigned int lock_profiling_threshold_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080085 std::string stack_trace_file_;
86 bool method_trace_;
87 std::string method_trace_file_;
Andreas Gampe39d92182014-03-05 16:46:44 -080088 unsigned int method_trace_file_size_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080089 bool (*hook_is_sensitive_thread_)();
90 jint (*hook_vfprintf_)(FILE* stream, const char* format, va_list ap);
91 void (*hook_exit_)(jint status);
92 void (*hook_abort_)();
93 std::vector<std::string> properties_;
Tsu Chiang Chuang12e6d742014-05-22 10:22:25 -070094 std::string compiler_executable_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080095 std::vector<std::string> compiler_options_;
96 std::vector<std::string> image_compiler_options_;
Calin Juravlec1b643c2014-05-30 23:44:11 +010097 ProfilerOptions profiler_options_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -080098 std::string profile_output_filename_;
Ian Rogerse63db272014-07-15 15:36:11 -070099 TraceClockSource profile_clock_source_;
Jeff Hao4a200f52014-04-01 14:58:49 -0700100 bool verify_;
Narayan Kamath11d9f062014-04-23 20:24:57 +0100101 InstructionSet image_isa_;
Brian Carlstrom491ca9e2014-03-02 18:24:38 -0800102
Zuo Wangf37a88b2014-07-10 04:26:41 -0700103 // Whether or not we use homogeneous space compaction to avoid OOM errors. If enabled,
104 // the heap will attempt to create an extra space which enables compacting from a malloc space to
105 // another malloc space when we are about to throw OOM.
106 bool use_homogeneous_space_compaction_for_oom_;
107 // Minimal interval allowed between two homogeneous space compactions caused by OOM.
108 uint64_t min_interval_homogeneous_space_compaction_by_oom_;
Nicolas Geoffray0025a862014-07-11 08:26:40 +0000109
Brian Carlstrom491ca9e2014-03-02 18:24:38 -0800110 private:
Andreas Gampe313f4032014-08-29 16:01:25 -0700111 ParsedOptions();
Brian Carlstrom491ca9e2014-03-02 18:24:38 -0800112
113 void Usage(const char* fmt, ...);
114 void UsageMessage(FILE* stream, const char* fmt, ...);
115 void UsageMessageV(FILE* stream, const char* fmt, va_list ap);
116
117 void Exit(int status);
118 void Abort();
119
Ian Rogerse63db272014-07-15 15:36:11 -0700120 bool Parse(const RuntimeOptions& options, bool ignore_unrecognized);
Mathieu Chartier6f365cc2014-04-23 12:42:27 -0700121 bool ParseXGcOption(const std::string& option);
Brian Carlstrom491ca9e2014-03-02 18:24:38 -0800122 bool ParseStringAfterChar(const std::string& option, char after_char, std::string* parsed_value);
123 bool ParseInteger(const std::string& option, char after_char, int* parsed_value);
124 bool ParseUnsignedInteger(const std::string& option, char after_char, unsigned int* parsed_value);
125 bool ParseDouble(const std::string& option, char after_char, double min, double max,
126 double* parsed_value);
127};
128
129} // namespace art
130
131#endif // ART_RUNTIME_PARSED_OPTIONS_H_