1 /* 2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 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 #include "precompiled.hpp" 26 #include "runtime/commandLineFlagWriteableList.hpp" 27 #include "runtime/os.hpp" 28 #if INCLUDE_ALL_GCS 29 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp" 30 #include "gc/g1/g1_globals.hpp" 31 #include "gc/g1/heapRegionBounds.inline.hpp" 32 #include "gc/shared/plab.hpp" 33 #endif // INCLUDE_ALL_GCS 34 #ifdef COMPILER1 35 #include "c1/c1_globals.hpp" 36 #endif // COMPILER1 37 #ifdef COMPILER2 38 #include "opto/c2_globals.hpp" 39 #endif // COMPILER2 40 #if INCLUDE_JVMCI 41 #include "jvmci/jvmci_globals.hpp" 42 #endif 43 44 bool CommandLineFlagWriteable::is_writeable(void) { 45 return _writeable; 46 } 47 48 void CommandLineFlagWriteable::mark_once(void) { 49 if (_type == Once) { 50 _writeable = false; 51 } 52 } 53 54 void CommandLineFlagWriteable::mark_startup(void) { 55 if (_type == CommandLineFlagWriteable::CommandLineOnly) { 56 _writeable = false; 57 } 58 } 59 60 // No control emitting 61 void emit_writeable_no(...) { /* NOP */ } 62 63 // No control emitting if type argument is NOT provided 64 void emit_writeable_bool(const char* /*name*/) { /* NOP */ } 65 void emit_writeable_ccstr(const char* /*name*/) { /* NOP */ } 66 void emit_writeable_ccstrlist(const char* /*name*/) { /* NOP */ } 67 void emit_writeable_int(const char* /*name*/) { /* NOP */ } 68 void emit_writeable_intx(const char* /*name*/) { /* NOP */ } 69 void emit_writeable_uint(const char* /*name*/) { /* NOP */ } 70 void emit_writeable_uintx(const char* /*name*/) { /* NOP */ } 71 void emit_writeable_uint64_t(const char* /*name*/) { /* NOP */ } 72 void emit_writeable_size_t(const char* /*name*/) { /* NOP */ } 73 void emit_writeable_double(const char* /*name*/) { /* NOP */ } 74 75 // CommandLineFlagWriteable emitting code functions if range arguments are provided 76 void emit_writeable_bool(const char* name, CommandLineFlagWriteable::WriteableType type) { 77 CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); 78 } 79 void emit_writeable_int(const char* name, CommandLineFlagWriteable::WriteableType type) { 80 CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); 81 } 82 void emit_writeable_intx(const char* name, CommandLineFlagWriteable::WriteableType type) { 83 CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); 84 } 85 void emit_writeable_uint(const char* name, CommandLineFlagWriteable::WriteableType type) { 86 CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); 87 } 88 void emit_writeable_uintx(const char* name, CommandLineFlagWriteable::WriteableType type) { 89 CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); 90 } 91 void emit_writeable_uint64_t(const char* name, CommandLineFlagWriteable::WriteableType type) { 92 CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); 93 } 94 void emit_writeable_size_t(const char* name, CommandLineFlagWriteable::WriteableType type) { 95 CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); 96 } 97 void emit_writeable_double(const char* name, CommandLineFlagWriteable::WriteableType type) { 98 CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); 99 } 100 101 // Generate code to call emit_writeable_xxx function 102 #define EMIT_WRITEABLE_PRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 103 #define EMIT_WRITEABLE_COMMERCIAL_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 104 #define EMIT_WRITEABLE_DIAGNOSTIC_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 105 #define EMIT_WRITEABLE_EXPERIMENTAL_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 106 #define EMIT_WRITEABLE_MANAGEABLE_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 107 #define EMIT_WRITEABLE_PRODUCT_RW_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 108 #define EMIT_WRITEABLE_PD_PRODUCT_FLAG(type, name, doc) ); emit_writeable_##type(#name 109 #define EMIT_WRITEABLE_DEVELOPER_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 110 #define EMIT_WRITEABLE_PD_DEVELOPER_FLAG(type, name, doc) ); emit_writeable_##type(#name 111 #define EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG(type, name, doc) ); emit_writeable_##type(#name 112 #define EMIT_WRITEABLE_NOTPRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 113 #define EMIT_WRITEABLE_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 114 115 // Generate type argument to pass into emit_writeable_xxx functions 116 #define EMIT_WRITEABLE(a) , CommandLineFlagWriteable::a 117 118 #define INITIAL_WRITEABLES_SIZE 2 119 GrowableArray<CommandLineFlagWriteable*>* CommandLineFlagWriteableList::_controls = NULL; 120 121 void CommandLineFlagWriteableList::init(void) { 122 123 _controls = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<CommandLineFlagWriteable*>(INITIAL_WRITEABLES_SIZE, true); 124 125 emit_writeable_no(NULL RUNTIME_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, 126 EMIT_WRITEABLE_PD_DEVELOPER_FLAG, 127 EMIT_WRITEABLE_PRODUCT_FLAG, 128 EMIT_WRITEABLE_PD_PRODUCT_FLAG, 129 EMIT_WRITEABLE_DIAGNOSTIC_FLAG, 130 EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG, 131 EMIT_WRITEABLE_EXPERIMENTAL_FLAG, 132 EMIT_WRITEABLE_NOTPRODUCT_FLAG, 133 EMIT_WRITEABLE_MANAGEABLE_FLAG, 134 EMIT_WRITEABLE_PRODUCT_RW_FLAG, 135 EMIT_WRITEABLE_LP64_PRODUCT_FLAG, 136 IGNORE_RANGE, 137 IGNORE_CONSTRAINT, 138 EMIT_WRITEABLE)); 139 140 EMIT_WRITEABLES_FOR_GLOBALS_EXT 141 142 emit_writeable_no(NULL ARCH_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, 143 EMIT_WRITEABLE_PRODUCT_FLAG, 189 EMIT_WRITEABLE)); 190 #endif // COMPILER2 191 192 #if INCLUDE_ALL_GCS 193 emit_writeable_no(NULL G1_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, 194 EMIT_WRITEABLE_PD_DEVELOPER_FLAG, 195 EMIT_WRITEABLE_PRODUCT_FLAG, 196 EMIT_WRITEABLE_PD_PRODUCT_FLAG, 197 EMIT_WRITEABLE_DIAGNOSTIC_FLAG, 198 EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG, 199 EMIT_WRITEABLE_EXPERIMENTAL_FLAG, 200 EMIT_WRITEABLE_NOTPRODUCT_FLAG, 201 EMIT_WRITEABLE_MANAGEABLE_FLAG, 202 EMIT_WRITEABLE_PRODUCT_RW_FLAG, 203 IGNORE_RANGE, 204 IGNORE_CONSTRAINT, 205 EMIT_WRITEABLE)); 206 #endif // INCLUDE_ALL_GCS 207 } 208 209 CommandLineFlagWriteable* CommandLineFlagWriteableList::find(const char* name) { 210 CommandLineFlagWriteable* found = NULL; 211 for (int i=0; i<length(); i++) { 212 CommandLineFlagWriteable* writeable = at(i); 213 if (strcmp(writeable->name(), name) == 0) { 214 found = writeable; 215 break; 216 } 217 } 218 return found; 219 } 220 221 void CommandLineFlagWriteableList::mark_startup(void) { 222 for (int i=0; i<length(); i++) { 223 CommandLineFlagWriteable* writeable = at(i); 224 writeable->mark_startup(); 225 } 226 } | 1 /* 2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 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 #include "precompiled.hpp" 26 #include "runtime/flags/jvmFlagWriteableList.hpp" 27 #include "runtime/os.hpp" 28 #if INCLUDE_ALL_GCS 29 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp" 30 #include "gc/g1/g1_globals.hpp" 31 #include "gc/g1/heapRegionBounds.inline.hpp" 32 #include "gc/shared/plab.hpp" 33 #endif // INCLUDE_ALL_GCS 34 #ifdef COMPILER1 35 #include "c1/c1_globals.hpp" 36 #endif // COMPILER1 37 #ifdef COMPILER2 38 #include "opto/c2_globals.hpp" 39 #endif // COMPILER2 40 #if INCLUDE_JVMCI 41 #include "jvmci/jvmci_globals.hpp" 42 #endif 43 44 bool JVMFlagWriteable::is_writeable(void) { 45 return _writeable; 46 } 47 48 void JVMFlagWriteable::mark_once(void) { 49 if (_type == Once) { 50 _writeable = false; 51 } 52 } 53 54 void JVMFlagWriteable::mark_startup(void) { 55 if (_type == JVMFlagWriteable::CommandLineOnly) { 56 _writeable = false; 57 } 58 } 59 60 // No control emitting 61 void emit_writeable_no(...) { /* NOP */ } 62 63 // No control emitting if type argument is NOT provided 64 void emit_writeable_bool(const char* /*name*/) { /* NOP */ } 65 void emit_writeable_ccstr(const char* /*name*/) { /* NOP */ } 66 void emit_writeable_ccstrlist(const char* /*name*/) { /* NOP */ } 67 void emit_writeable_int(const char* /*name*/) { /* NOP */ } 68 void emit_writeable_intx(const char* /*name*/) { /* NOP */ } 69 void emit_writeable_uint(const char* /*name*/) { /* NOP */ } 70 void emit_writeable_uintx(const char* /*name*/) { /* NOP */ } 71 void emit_writeable_uint64_t(const char* /*name*/) { /* NOP */ } 72 void emit_writeable_size_t(const char* /*name*/) { /* NOP */ } 73 void emit_writeable_double(const char* /*name*/) { /* NOP */ } 74 75 // JVMFlagWriteable emitting code functions if range arguments are provided 76 void emit_writeable_bool(const char* name, JVMFlagWriteable::WriteableType type) { 77 JVMFlagWriteableList::add(new JVMFlagWriteable(name, type)); 78 } 79 void emit_writeable_int(const char* name, JVMFlagWriteable::WriteableType type) { 80 JVMFlagWriteableList::add(new JVMFlagWriteable(name, type)); 81 } 82 void emit_writeable_intx(const char* name, JVMFlagWriteable::WriteableType type) { 83 JVMFlagWriteableList::add(new JVMFlagWriteable(name, type)); 84 } 85 void emit_writeable_uint(const char* name, JVMFlagWriteable::WriteableType type) { 86 JVMFlagWriteableList::add(new JVMFlagWriteable(name, type)); 87 } 88 void emit_writeable_uintx(const char* name, JVMFlagWriteable::WriteableType type) { 89 JVMFlagWriteableList::add(new JVMFlagWriteable(name, type)); 90 } 91 void emit_writeable_uint64_t(const char* name, JVMFlagWriteable::WriteableType type) { 92 JVMFlagWriteableList::add(new JVMFlagWriteable(name, type)); 93 } 94 void emit_writeable_size_t(const char* name, JVMFlagWriteable::WriteableType type) { 95 JVMFlagWriteableList::add(new JVMFlagWriteable(name, type)); 96 } 97 void emit_writeable_double(const char* name, JVMFlagWriteable::WriteableType type) { 98 JVMFlagWriteableList::add(new JVMFlagWriteable(name, type)); 99 } 100 101 // Generate code to call emit_writeable_xxx function 102 #define EMIT_WRITEABLE_PRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 103 #define EMIT_WRITEABLE_COMMERCIAL_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 104 #define EMIT_WRITEABLE_DIAGNOSTIC_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 105 #define EMIT_WRITEABLE_EXPERIMENTAL_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 106 #define EMIT_WRITEABLE_MANAGEABLE_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 107 #define EMIT_WRITEABLE_PRODUCT_RW_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 108 #define EMIT_WRITEABLE_PD_PRODUCT_FLAG(type, name, doc) ); emit_writeable_##type(#name 109 #define EMIT_WRITEABLE_DEVELOPER_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 110 #define EMIT_WRITEABLE_PD_DEVELOPER_FLAG(type, name, doc) ); emit_writeable_##type(#name 111 #define EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG(type, name, doc) ); emit_writeable_##type(#name 112 #define EMIT_WRITEABLE_NOTPRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 113 #define EMIT_WRITEABLE_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name 114 115 // Generate type argument to pass into emit_writeable_xxx functions 116 #define EMIT_WRITEABLE(a) , JVMFlagWriteable::a 117 118 #define INITIAL_WRITEABLES_SIZE 2 119 GrowableArray<JVMFlagWriteable*>* JVMFlagWriteableList::_controls = NULL; 120 121 void JVMFlagWriteableList::init(void) { 122 123 _controls = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<JVMFlagWriteable*>(INITIAL_WRITEABLES_SIZE, true); 124 125 emit_writeable_no(NULL RUNTIME_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, 126 EMIT_WRITEABLE_PD_DEVELOPER_FLAG, 127 EMIT_WRITEABLE_PRODUCT_FLAG, 128 EMIT_WRITEABLE_PD_PRODUCT_FLAG, 129 EMIT_WRITEABLE_DIAGNOSTIC_FLAG, 130 EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG, 131 EMIT_WRITEABLE_EXPERIMENTAL_FLAG, 132 EMIT_WRITEABLE_NOTPRODUCT_FLAG, 133 EMIT_WRITEABLE_MANAGEABLE_FLAG, 134 EMIT_WRITEABLE_PRODUCT_RW_FLAG, 135 EMIT_WRITEABLE_LP64_PRODUCT_FLAG, 136 IGNORE_RANGE, 137 IGNORE_CONSTRAINT, 138 EMIT_WRITEABLE)); 139 140 EMIT_WRITEABLES_FOR_GLOBALS_EXT 141 142 emit_writeable_no(NULL ARCH_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, 143 EMIT_WRITEABLE_PRODUCT_FLAG, 189 EMIT_WRITEABLE)); 190 #endif // COMPILER2 191 192 #if INCLUDE_ALL_GCS 193 emit_writeable_no(NULL G1_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, 194 EMIT_WRITEABLE_PD_DEVELOPER_FLAG, 195 EMIT_WRITEABLE_PRODUCT_FLAG, 196 EMIT_WRITEABLE_PD_PRODUCT_FLAG, 197 EMIT_WRITEABLE_DIAGNOSTIC_FLAG, 198 EMIT_WRITEABLE_PD_DIAGNOSTIC_FLAG, 199 EMIT_WRITEABLE_EXPERIMENTAL_FLAG, 200 EMIT_WRITEABLE_NOTPRODUCT_FLAG, 201 EMIT_WRITEABLE_MANAGEABLE_FLAG, 202 EMIT_WRITEABLE_PRODUCT_RW_FLAG, 203 IGNORE_RANGE, 204 IGNORE_CONSTRAINT, 205 EMIT_WRITEABLE)); 206 #endif // INCLUDE_ALL_GCS 207 } 208 209 JVMFlagWriteable* JVMFlagWriteableList::find(const char* name) { 210 JVMFlagWriteable* found = NULL; 211 for (int i=0; i<length(); i++) { 212 JVMFlagWriteable* writeable = at(i); 213 if (strcmp(writeable->name(), name) == 0) { 214 found = writeable; 215 break; 216 } 217 } 218 return found; 219 } 220 221 void JVMFlagWriteableList::mark_startup(void) { 222 for (int i=0; i<length(); i++) { 223 JVMFlagWriteable* writeable = at(i); 224 writeable->mark_startup(); 225 } 226 } |