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

Compiler directives should enable DebugNonSafepoints when PrintAssembly is requested

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b17

      Description

      Found this while working on jcstress support, see CODETOOLS-7902865. jcstress opts in to PrintAssembly for the particular method by using the compile directive:
       https://github.com/openjdk/jcstress/blob/master/jcstress-core/src/main/java/org/openjdk/jcstress/TestExecutor.java#L246-L248

      When supplied on JVM command line, -XX:+PrintAssembly implicitly enables -XX:+DebugNonSafepoints:

      jint Arguments::apply_ergo() {
        ...
        if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
          warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
          DebugNonSafepoints = true;
        }
        ...
      }

      When -XX:CompileCommand=Print is used, it also opts in:

      void compilerOracle_init() {
        ...
        if (has_command(CompileCommand::Print)) {
          if (PrintAssembly) {
            warning("CompileCommand and/or %s file contains 'print' commands, but PrintAssembly is also enabled", default_cc_file);
          } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) {
            warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output");
            DebugNonSafepoints = true;
          }
        }
        ...

      But CompilerDirectives do not seem to have the same heuristics.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              neliasso Nils Eliasson
              Reporter:
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: