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

ZGC: RAII use of IntelJccErratumAlignment

XMLWordPrintable

    • gc
    • b11

      SonarCloud reports the potential bug in the code below:
       Name this temporary "IntelJccErratumAlignment" object if you want to use it in for RAII.

      ```
      static void emit_store_fast_path_check_c2(MacroAssembler* masm, Address ref_addr, bool is_atomic, Label& medium_path) {
      #ifdef COMPILER2
        // This is a JCC erratum mitigation wrapper for calling the inner check
        int size = store_fast_path_check_size(masm, ref_addr, is_atomic, medium_path);
        // Emit JCC erratum mitigation nops with the right size
        IntelJccErratumAlignment(*masm, size); // <----------- COMPLAINS HERE
        // Emit the JCC erratum mitigation guarded code
        emit_store_fast_path_check(masm, ref_addr, is_atomic, medium_path);
      #endif
      ```

      The comment seems to imply that `emit_store_fast_path_check` needs to be guarded by `IntelJccErratumAlignment`. I think it is innocuous at this point, as `~IntelJccErratumAlignment` only carries the assert. Is this use correct, though?

            aboldtch Axel Boldt-Christmas
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: