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

Generate source code for the JVMFlag::flags table

XMLWordPrintable

      The following three functions dynamically build up growable arrays to implement constraint checks for JVM options

        JVMFlagRangeList::init();
        JVMFlagConstraintList::init();
        JVMFlagWriteableList::init();

      The code that builds up the arrays is complex

         text data bss dec hex filename
        26055 616 12 26683 683b ./hotspot/variant-server/libjvm/objs/jvmFlagRangeList.o
         4606 0 12 4618 120a ./hotspot/variant-server/libjvm/objs/jvmFlagWriteableList.o
        21811 704 20 22535 5807 ./hotspot/variant-server/libjvm/objs/jvmFlagConstraintList.o

      Also, looking up of the constraint info requires a linear search. See JVMFlagRangeList::find:

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

      There are only 809 flags in the product build, and less than half of them have constraints. The constraint information should be part of the JVMFlag structure. However, due to the way that the flags are declared (in globals.hpp), it's not easy to get the constraint info into JVMFlag using C macros.

      Also, JVMFlag::find_flag does a linear search, and computes the string lengths of all the option names at JVM start-up.

      The best solution is to generate the C source code for JVMFlags::flags during the JDK build. We can sort the flags alphabetically so we can use binary search (or even use a hashtable).

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

              Created:
              Updated:
              Resolved: