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

Fix debug.hpp / globalDefinitions.hpp dependency inversion

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 10
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b21
    • CPU:
      generic
    • OS:
      generic

      Description

      debug.hpp presently #includes globalDefinitions.hpp, in order to obtain a few things from there.

      One consequence of this is that globalDefinitions.hpp is unable to use the various macros, like [vm]assert, that are provided by debug.hpp. The "workaround" being used is to have globalDefinitions.hpp use

        #ifdef ASSERT if (pred) basic_fatal(...) #endif

      blocks where vmassert and the like ought to be used. This provides less information in those places than would be provided by assert. We don't even get the file / line where the real error occured, unless we can get a decoded stack trace.

      This may also have resulted in fewer error checks being placed in the globalDefinitions.hpp code, due to the inconvenience of that workaround vs a simple assert.

      Another consequence of this dependency inversion is that small, lightweight files that just want to include asserts or the like end up pulling in much more stuff. One place this is being run into is adding metaprogramming tools that make use of STATIC_ASSERT, which has a natural home in debug.hpp. But this dependency inversion would prevent the use of such tools to improve some of the definitions in globalDefinitions.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kbarrett Kim Barrett
                Reporter:
                kbarrett Kim Barrett
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: