Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8236988

Modular Design for JVM Flags

XMLWordPrintable

      DESIGN DOC: https://wiki.openjdk.java.net/display/HotSpot/HotSpot+Command-Line+Flags+Overhaul+-+Design+Doc

      (The below description is a bit out-dated. Will fix soon. For now please refer to the link above for motivation and proposed design).
      ====
      Currently all JVM flags are grouped under a giant macro ALL_FLAGS

      http://hg.openjdk.java.net/jdk/jdk/file/2fbc66ef1a1d/src/hotspot/share/runtime/globals.hpp#l2539

      This is very hard to maintain. Erik Österlund and Stefan Karlsson have suggested a new design where flags can be individually maintain by different modules. The basic idea is to declare a flag like this in a header file:

      extern int SomeFlag;

      and then define the flag in a C file:

      int SomeFlag = initial_val;
      ProductFlag Flag_SomeFlag("SomeFlag, &SomeFlag, .....);

      We can build up a list of all the ProductFlags in the VM (using C++ static initialization) for command-line processing, etc.

      class ProductFlag {
          static ProductFlag* _head;
          ProductFlag* _next;
          void* _value_addr;
          char* _name;
      public:
          ProductFlag(char* name, void* valid_addr, ...) {
              _name = name;
              _value_addr = value_addr;
              _next = _head;
              _head = this;
              ...
          }
      };

      This list will replace the flagTable[] in

      http://hg.openjdk.java.net/jdk/jdk/file/2fbc66ef1a1d/src/hotspot/share/runtime/flags/jvmFlag.cpp#l825

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: