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

Need a stable way to select parts of the VM to compile in and out

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • hs24, hs25
    • embedded
    • None

      With the change for JDK-8005915 code guarded by

       #ifndef SERIALGC

      was replaced with code guarded by

      #if INCLUDE_ALL_GCS

      This is an improvement in readability, but it is a bit fragile since we don't have a way to guarantee that INCLUDE_ALL_GCS has been defined. In cases where it is not defined the default value is 0 which will be interpreted as false by the if statement.

      So, in effect we have gone from two cases (SERIALGC defined or not) to three cases (INCLUDE_ALL_GCS defined as true, defined as false or not defined at all).

      We don't want the last case, but since INCLUDE_ALL_GCS is defined in macros.hpp, this means that we need to make sure that all source files include macros.hpp. Unfortunately we have no way of guaranteeing that at the moment.

      We need to find a way to make sure that INCLUDE_ALL_GCS is always defined. This was discussed in the GC team and we can think of three different ways of achieving this:

      (1) Explicitly include macros.hpp in all source files. Make it a guideline to always have this include in all source files.

      (2) Change from defining INCLUDE_ALL_GCS in macros.hpp and instead set in on the compile command line as -DINCLUDE_ALL_GCS=1

      (3) Figure out if there is a warning that can be turned on to warn for #if statements on undefined variables.

      We don't have to pick one of these solutions, but we need to find a way to be sure that we know that INCLUDE_ALL_GCS is always set up.

      Also, this is not limited to the INCLUDE_ALL_GCS define. There are more flags that are used to compile in or out parts of the VM that probably have the same issue. Got this list in an email. I have not verified if they have the same problems or not:

      INCLUDE_JVMTI
      INCLUDE_FPROF
      INCLUDE_VM_STRUCTS
      INCLUDE_JNI_CHECK
      INCLUDE_JNI_CHECK
      INCLUDE_SERVICES
      INCLUDE_MANAGEMENT
      INCLUDE_CDS
      INCLUDE_ALTERNATE_GCS
      INCLUDE_NMT
      INCLUDE_TRACE

            jprovino Joseph Provino (Inactive)
            brutisso Bengt Rutisson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: