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

notproduct flags should be invisible in product builds

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • 23
    • 20
    • hotspot

    Description

      https://github.com/openjdk/jdk/blob/adb3d4f14af1974e7fc9461eb59f98131f0d33f7/src/hotspot/share/runtime/globals.hpp#L37-L41

      // develop flags are settable / visible only during development and are constant in the PRODUCT version
      // product flags are always settable / visible
      // notproduct flags are settable / visible only during development and are not declared in the PRODUCT version
      // develop_pd/product_pd flags are the same as develop/product, except that their default values
      // are specified in platform-dependent header files.

      However, we declare the notproduct flags in a product build anyway:

      https://github.com/openjdk/jdk/blob/adb3d4f14af1974e7fc9461eb59f98131f0d33f7/src/hotspot/share/runtime/globals_shared.hpp#L77

      #ifdef PRODUCT
      #define DECLARE_DEVELOPER_FLAG(type, name, value, ...) const type name = value;
      #define DECLARE_PD_DEVELOPER_FLAG(type, name, ...) const type name = pd_##name;
      #define DECLARE_NOTPRODUCT_FLAG(type, name, value, ...) const type name = value;
      #else
      ...

      After JDK-8292590, we will have a non-consistent behavior such that:

      [1] Reading the flag works:

        if (UseDebuggerErgo) {


      [2] But setting the flag will cause a C++ compile error

          FLAG_SET_ERGO_IF_DEFAULT(UseDebuggerErgo1, true);

      Attachments

        Issue Links

          Activity

            People

              coleenp Coleen Phillimore
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: