< prev index next >

src/share/vm/runtime/globals.cpp

Print this page




   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 "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 "utilities/ostream.hpp"
  32 #include "utilities/macros.hpp"
  33 #include "utilities/top.hpp"
  34 #include "trace/tracing.hpp"
  35 #if INCLUDE_ALL_GCS
  36 #include "gc_implementation/g1/g1_globals.hpp"
  37 #endif // INCLUDE_ALL_GCS
  38 #ifdef COMPILER1
  39 #include "c1/c1_globals.hpp"
  40 #endif
  41 #ifdef COMPILER2
  42 #include "opto/c2_globals.hpp"
  43 #endif
  44 #ifdef SHARK
  45 #include "shark/shark_globals.hpp"
  46 #endif
  47 
  48 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  49 
  50 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \
  51               MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \
  52               MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \
  53               MATERIALIZE_NOTPRODUCT_FLAG, \
  54               MATERIALIZE_MANAGEABLE_FLAG, MATERIALIZE_PRODUCT_RW_FLAG, \


 593 }
 594 
 595 bool CommandLineFlagsEx::is_cmdline(CommandLineFlag flag) {
 596   assert((size_t)flag < Flag::numFlags, "bad command line flag index");
 597   Flag* f = &Flag::flags[flag];
 598   return f->is_command_line();
 599 }
 600 
 601 bool CommandLineFlags::wasSetOnCmdline(const char* name, bool* value) {
 602   Flag* result = Flag::find_flag((char*)name, strlen(name));
 603   if (result == NULL) return false;
 604   *value = result->is_command_line();
 605   return true;
 606 }
 607 
 608 template<class E, class T>
 609 static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin)
 610 {
 611   E e;
 612   e.set_name(name);
 613   e.set_old_value(old_value);
 614   e.set_new_value(new_value);
 615   e.set_origin(origin);
 616   e.commit();
 617 }
 618 
 619 bool CommandLineFlags::boolAt(const char* name, size_t len, bool* value) {
 620   Flag* result = Flag::find_flag(name, len);
 621   if (result == NULL) return false;
 622   if (!result->is_bool()) return false;
 623   *value = result->get_bool();
 624   return true;
 625 }
 626 
 627 bool CommandLineFlags::boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin) {
 628   Flag* result = Flag::find_flag(name, len);
 629   if (result == NULL) return false;
 630   if (!result->is_bool()) return false;
 631   bool old_value = result->get_bool();
 632   trace_flag_changed<EventBooleanFlagChanged, bool>(name, old_value, *value, origin);
 633   result->set_bool(*value);
 634   *value = old_value;




   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 "jfr/jfrEvents.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "oops/oop.inline.hpp"
  29 #include "runtime/arguments.hpp"
  30 #include "runtime/globals.hpp"
  31 #include "runtime/globals_extension.hpp"
  32 #include "utilities/ostream.hpp"
  33 #include "utilities/macros.hpp"
  34 #include "utilities/top.hpp"

  35 #if INCLUDE_ALL_GCS
  36 #include "gc_implementation/g1/g1_globals.hpp"
  37 #endif // INCLUDE_ALL_GCS
  38 #ifdef COMPILER1
  39 #include "c1/c1_globals.hpp"
  40 #endif
  41 #ifdef COMPILER2
  42 #include "opto/c2_globals.hpp"
  43 #endif
  44 #ifdef SHARK
  45 #include "shark/shark_globals.hpp"
  46 #endif
  47 
  48 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  49 
  50 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \
  51               MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \
  52               MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \
  53               MATERIALIZE_NOTPRODUCT_FLAG, \
  54               MATERIALIZE_MANAGEABLE_FLAG, MATERIALIZE_PRODUCT_RW_FLAG, \


 593 }
 594 
 595 bool CommandLineFlagsEx::is_cmdline(CommandLineFlag flag) {
 596   assert((size_t)flag < Flag::numFlags, "bad command line flag index");
 597   Flag* f = &Flag::flags[flag];
 598   return f->is_command_line();
 599 }
 600 
 601 bool CommandLineFlags::wasSetOnCmdline(const char* name, bool* value) {
 602   Flag* result = Flag::find_flag((char*)name, strlen(name));
 603   if (result == NULL) return false;
 604   *value = result->is_command_line();
 605   return true;
 606 }
 607 
 608 template<class E, class T>
 609 static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin)
 610 {
 611   E e;
 612   e.set_name(name);
 613   e.set_oldValue(old_value);
 614   e.set_newValue(new_value);
 615   e.set_origin(origin);
 616   e.commit();
 617 }
 618 
 619 bool CommandLineFlags::boolAt(const char* name, size_t len, bool* value) {
 620   Flag* result = Flag::find_flag(name, len);
 621   if (result == NULL) return false;
 622   if (!result->is_bool()) return false;
 623   *value = result->get_bool();
 624   return true;
 625 }
 626 
 627 bool CommandLineFlags::boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin) {
 628   Flag* result = Flag::find_flag(name, len);
 629   if (result == NULL) return false;
 630   if (!result->is_bool()) return false;
 631   bool old_value = result->get_bool();
 632   trace_flag_changed<EventBooleanFlagChanged, bool>(name, old_value, *value, origin);
 633   result->set_bool(*value);
 634   *value = old_value;


< prev index next >