OLD | NEW |
1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 #ifndef SRC_SHARED_FLAGS_H_ | 5 #ifndef SRC_SHARED_FLAGS_H_ |
6 #define SRC_SHARED_FLAGS_H_ | 6 #define SRC_SHARED_FLAGS_H_ |
7 | 7 |
8 #include "src/shared/assert.h" | 8 #include "src/shared/assert.h" |
9 #include "src/shared/globals.h" | 9 #include "src/shared/globals.h" |
10 | 10 |
11 namespace fletch { | 11 namespace dartino { |
12 | 12 |
13 // Flags provide access to commmand line flags. | 13 // Flags provide access to commmand line flags. |
14 // | 14 // |
15 // Syntax: | 15 // Syntax: |
16 // -Xname (equivalent to -Xname=true) | 16 // -Xname (equivalent to -Xname=true) |
17 // -Xname=<boolean>|<int>|<address>|<string> | 17 // -Xname=<boolean>|<int>|<address>|<string> |
18 // | 18 // |
19 // debug means the flag is ONLY available in the debug build. | 19 // debug means the flag is ONLY available in the debug build. |
20 // release means the flag is available in both the debug and release build. | 20 // release means the flag is available in both the debug and release build. |
21 | 21 |
(...skipping 19 matching lines...) Expand all Loading... |
41 FLAG_BOOLEAN(debug, print_program_statistics, false, \ | 41 FLAG_BOOLEAN(debug, print_program_statistics, false, \ |
42 "Print statistics about the program") \ | 42 "Print statistics about the program") \ |
43 FLAG_BOOLEAN(release, print_heap_statistics, false, \ | 43 FLAG_BOOLEAN(release, print_heap_statistics, false, \ |
44 "Print heap statistics before GC") \ | 44 "Print heap statistics before GC") \ |
45 FLAG_BOOLEAN(release, verbose, false, "Verbose output") \ | 45 FLAG_BOOLEAN(release, verbose, false, "Verbose output") \ |
46 FLAG_BOOLEAN(debug, print_flags, false, "Print flags") \ | 46 FLAG_BOOLEAN(debug, print_flags, false, "Print flags") \ |
47 FLAG_INTEGER(release, profile_interval, 1000, "Profile interval in us") \ | 47 FLAG_INTEGER(release, profile_interval, 1000, "Profile interval in us") \ |
48 FLAG_CSTRING(release, filter, NULL, "Filter string for unit testing") \ | 48 FLAG_CSTRING(release, filter, NULL, "Filter string for unit testing") \ |
49 FLAG_BOOLEAN(release, tick_sampler, false, \ | 49 FLAG_BOOLEAN(release, tick_sampler, false, \ |
50 "Collect execution time sampels of the entire VM") \ | 50 "Collect execution time sampels of the entire VM") \ |
51 FLAG_CSTRING(release, tick_file, "fletch.ticks", \ | 51 FLAG_CSTRING(release, tick_file, "dartino.ticks", \ |
52 "Write tick samples in this file") \ | 52 "Write tick samples in this file") \ |
53 /* Temporary compiler flags */ \ | 53 /* Temporary compiler flags */ \ |
54 FLAG_BOOLEAN(release, trace_compiler, false, "") \ | 54 FLAG_BOOLEAN(release, trace_compiler, false, "") \ |
55 FLAG_BOOLEAN(release, trace_library, false, "") | 55 FLAG_BOOLEAN(release, trace_library, false, "") |
56 | 56 |
57 #ifdef DEBUG | 57 #ifdef DEBUG |
58 #define DECLARE_DEBUG_FLAG(type, prefix, name, value, doc) static type name; | 58 #define DECLARE_DEBUG_FLAG(type, prefix, name, value, doc) static type name; |
59 #else | 59 #else |
60 #define DECLARE_DEBUG_FLAG(type, prefix, name, value, doc) \ | 60 #define DECLARE_DEBUG_FLAG(type, prefix, name, value, doc) \ |
61 static const type name = value; | 61 static const type name = value; |
62 #endif | 62 #endif |
63 | 63 |
64 #define DECLARE_RELEASE_FLAG(type, prefix, name, value, doc) static type name; | 64 #define DECLARE_RELEASE_FLAG(type, prefix, name, value, doc) static type name; |
65 | 65 |
66 class Flags { | 66 class Flags { |
67 public: | 67 public: |
68 APPLY_TO_FLAGS(DECLARE_DEBUG_FLAG, DECLARE_RELEASE_FLAG) | 68 APPLY_TO_FLAGS(DECLARE_DEBUG_FLAG, DECLARE_RELEASE_FLAG) |
69 | 69 |
70 // Extract the flag values from the command line arguments. | 70 // Extract the flag values from the command line arguments. |
71 static void ExtractFromCommandLine(int* argc, char** argv); | 71 static void ExtractFromCommandLine(int* argc, char** argv); |
72 | 72 |
73 static char* executable() { return executable_; } | 73 static char* executable() { return executable_; } |
74 | 74 |
75 private: | 75 private: |
76 static char* executable_; | 76 static char* executable_; |
77 }; | 77 }; |
78 | 78 |
79 } // namespace fletch | 79 } // namespace dartino |
80 | 80 |
81 #endif // SRC_SHARED_FLAGS_H_ | 81 #endif // SRC_SHARED_FLAGS_H_ |
OLD | NEW |