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

Remove implicit arguments for RegisterMap constructor

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 20
    • 20
    • hotspot
    • b08

    Description

      Currently the RegisterMap constructor uses implicit arguments for boolean flags:
        RegisterMap(JavaThread *thread, bool update_map = true, bool process_frames = true, bool walk_cont = false);
        RegisterMap(oop continuation, bool update_map = true);

      This pattern makes it hard to read code at usage sites.
      E.g.: RegisterMap reg_map(_thread, true, true, true);
      It is also unclear if some developer intend to signal extra information when providing the already implicit default argument.
      E.g.: RegisterMap register_map(jt, true);

      This enhancements aims to make the code consistent by refactoring every call site to use all arguments as well as having a comment describing the boolean flag type.
      E.g.:
      RegisterMap reg_map(_thread, true, true, true); -> RegisterMap reg_map(_thread, true /* update_map */, true /* process_frames */, true /* walk_cont */);
      RegisterMap register_map(jt, true); -> RegisterMap register_map(jt, true /* update_map */, true /* process_frames */, false /* walk_cont */);

      * Update *
      After this change every call site will use all arguments, instead of using boolean literals and comments, instead use scoped enums which are both clear (no need for comments) and enforced by the type system.

      Attachments

        Issue Links

          Activity

            People

              aboldtch Axel Boldt-Christmas
              aboldtch Axel Boldt-Christmas
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: