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 #include "precompiled.hpp"
26 #include "memory/allocation.inline.hpp"
27 #include "oops/oop.inline.hpp"
28 #include "runtime/arguments.hpp"
29 #include "runtime/globals.hpp"
30 #include "runtime/globals_extension.hpp"
31 #include "runtime/commandLineFlagConstraintList.hpp"
32 #include "runtime/commandLineFlagWriteableList.hpp"
33 #include "runtime/commandLineFlagRangeList.hpp"
34 #include "runtime/os.hpp"
35 #include "runtime/sharedRuntime.hpp"
36 #include "trace/tracing.hpp"
37 #include "utilities/defaultStream.hpp"
38 #include "utilities/macros.hpp"
39 #include "utilities/ostream.hpp"
40 #if INCLUDE_ALL_GCS
41 #include "gc/g1/g1_globals.hpp"
42 #endif // INCLUDE_ALL_GCS
43 #ifdef COMPILER1
44 #include "c1/c1_globals.hpp"
45 #endif
46 #if INCLUDE_JVMCI
47 #include "jvmci/jvmci_globals.hpp"
48 #endif
49 #ifdef COMPILER2
50 #include "opto/c2_globals.hpp"
51 #endif
52 #ifdef SHARK
53 #include "shark/shark_globals.hpp"
54 #endif
55
56 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \
57 MATERIALIZE_PD_DEVELOPER_FLAG, \
58 MATERIALIZE_PRODUCT_FLAG, \
59 MATERIALIZE_PD_PRODUCT_FLAG, \
60 MATERIALIZE_DIAGNOSTIC_FLAG, \
61 MATERIALIZE_PD_DIAGNOSTIC_FLAG, \
62 MATERIALIZE_EXPERIMENTAL_FLAG, \
63 MATERIALIZE_NOTPRODUCT_FLAG, \
64 MATERIALIZE_MANAGEABLE_FLAG, \
65 MATERIALIZE_PRODUCT_RW_FLAG, \
66 MATERIALIZE_LP64_PRODUCT_FLAG, \
67 IGNORE_RANGE, \
68 IGNORE_CONSTRAINT, \
69 IGNORE_WRITEABLE)
70
71 RUNTIME_OS_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \
72 MATERIALIZE_PD_DEVELOPER_FLAG, \
73 MATERIALIZE_PRODUCT_FLAG, \
74 MATERIALIZE_PD_PRODUCT_FLAG, \
971 assert((size_t)flag < Flag::numFlags, "bad command line flag index");
972 Flag* f = &Flag::flags[flag];
973 return f->is_command_line();
974 }
975
976 bool CommandLineFlags::wasSetOnCmdline(const char* name, bool* value) {
977 Flag* result = Flag::find_flag((char*)name, strlen(name));
978 if (result == NULL) return false;
979 *value = result->is_command_line();
980 return true;
981 }
982
983 void CommandLineFlagsEx::setOnCmdLine(CommandLineFlagWithType flag) {
984 Flag* faddr = address_of_flag(flag);
985 assert(faddr != NULL, "Unknown flag");
986 faddr->set_command_line();
987 }
988
989 template<class E, class T>
990 static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) {
991 E e;
992 e.set_name(name);
993 e.set_oldValue(old_value);
994 e.set_newValue(new_value);
995 e.set_origin(origin);
996 e.commit();
997 }
998
999 static Flag::Error apply_constraint_and_check_range_bool(const char* name, bool new_value, bool verbose) {
1000 Flag::Error status = Flag::SUCCESS;
1001 CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
1002 if (constraint != NULL) {
1003 status = constraint->apply_bool(new_value, verbose);
1004 }
1005 return status;
1006 }
1007
1008 Flag::Error CommandLineFlags::boolAt(const char* name, size_t len, bool* value, bool allow_locked, bool return_flag) {
1009 Flag* result = Flag::find_flag(name, len, allow_locked, return_flag);
1010 if (result == NULL) return Flag::INVALID_FLAG;
1011 if (!result->is_bool()) return Flag::WRONG_FORMAT;
1012 *value = result->get_bool();
1013 return Flag::SUCCESS;
1014 }
1015
1016 Flag::Error CommandLineFlags::boolAtPut(Flag* flag, bool* value, Flag::Flags origin) {
|
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 #include "precompiled.hpp"
26 #include "memory/allocation.inline.hpp"
27 #include "oops/oop.inline.hpp"
28 #include "runtime/arguments.hpp"
29 #include "runtime/globals.hpp"
30 #include "runtime/globals_extension.hpp"
31 #include "runtime/commandLineFlagConstraintList.hpp"
32 #include "runtime/commandLineFlagWriteableList.hpp"
33 #include "runtime/commandLineFlagRangeList.hpp"
34 #include "runtime/os.hpp"
35 #include "runtime/sharedRuntime.hpp"
36 #include "utilities/defaultStream.hpp"
37 #include "utilities/macros.hpp"
38 #include "utilities/ostream.hpp"
39 #if INCLUDE_ALL_GCS
40 #include "gc/g1/g1_globals.hpp"
41 #endif // INCLUDE_ALL_GCS
42 #ifdef COMPILER1
43 #include "c1/c1_globals.hpp"
44 #endif
45 #if INCLUDE_JVMCI
46 #include "jvmci/jvmci_globals.hpp"
47 #endif
48 #ifdef COMPILER2
49 #include "opto/c2_globals.hpp"
50 #endif
51 #ifdef SHARK
52 #include "shark/shark_globals.hpp"
53 #endif
54 #if INCLUDE_TRACE
55 #include "trace/tracing.hpp"
56 #endif
57
58 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \
59 MATERIALIZE_PD_DEVELOPER_FLAG, \
60 MATERIALIZE_PRODUCT_FLAG, \
61 MATERIALIZE_PD_PRODUCT_FLAG, \
62 MATERIALIZE_DIAGNOSTIC_FLAG, \
63 MATERIALIZE_PD_DIAGNOSTIC_FLAG, \
64 MATERIALIZE_EXPERIMENTAL_FLAG, \
65 MATERIALIZE_NOTPRODUCT_FLAG, \
66 MATERIALIZE_MANAGEABLE_FLAG, \
67 MATERIALIZE_PRODUCT_RW_FLAG, \
68 MATERIALIZE_LP64_PRODUCT_FLAG, \
69 IGNORE_RANGE, \
70 IGNORE_CONSTRAINT, \
71 IGNORE_WRITEABLE)
72
73 RUNTIME_OS_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \
74 MATERIALIZE_PD_DEVELOPER_FLAG, \
75 MATERIALIZE_PRODUCT_FLAG, \
76 MATERIALIZE_PD_PRODUCT_FLAG, \
973 assert((size_t)flag < Flag::numFlags, "bad command line flag index");
974 Flag* f = &Flag::flags[flag];
975 return f->is_command_line();
976 }
977
978 bool CommandLineFlags::wasSetOnCmdline(const char* name, bool* value) {
979 Flag* result = Flag::find_flag((char*)name, strlen(name));
980 if (result == NULL) return false;
981 *value = result->is_command_line();
982 return true;
983 }
984
985 void CommandLineFlagsEx::setOnCmdLine(CommandLineFlagWithType flag) {
986 Flag* faddr = address_of_flag(flag);
987 assert(faddr != NULL, "Unknown flag");
988 faddr->set_command_line();
989 }
990
991 template<class E, class T>
992 static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) {
993 #if INCLUDE_TRACE
994 E e;
995 e.set_name(name);
996 e.set_oldValue(old_value);
997 e.set_newValue(new_value);
998 e.set_origin(origin);
999 e.commit();
1000 #endif
1001 }
1002
1003 static Flag::Error apply_constraint_and_check_range_bool(const char* name, bool new_value, bool verbose) {
1004 Flag::Error status = Flag::SUCCESS;
1005 CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
1006 if (constraint != NULL) {
1007 status = constraint->apply_bool(new_value, verbose);
1008 }
1009 return status;
1010 }
1011
1012 Flag::Error CommandLineFlags::boolAt(const char* name, size_t len, bool* value, bool allow_locked, bool return_flag) {
1013 Flag* result = Flag::find_flag(name, len, allow_locked, return_flag);
1014 if (result == NULL) return Flag::INVALID_FLAG;
1015 if (!result->is_bool()) return Flag::WRONG_FORMAT;
1016 *value = result->get_bool();
1017 return Flag::SUCCESS;
1018 }
1019
1020 Flag::Error CommandLineFlags::boolAtPut(Flag* flag, bool* value, Flag::Flags origin) {
|