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

G1AdaptiveIHOP has swapped current_occupancy and additional_buffer_size

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11, 15, 16
    • Fix Version/s: 16
    • Component/s: hotspot
    • Subcomponent:
      gc
    • Resolved In Build:
      b14

      Description

      CLion static analyzer highlighted the potential mismatch in argument passing order. Look at this call chain:

      void G1AdaptiveIHOPControl::send_trace_event(G1NewTracer* tracer) {
        ...
        tracer->report_adaptive_ihop_statistics(get_conc_mark_start_threshold(),
                                                actual_target_threshold(),
                                                G1CollectedHeap::heap()->used(),
                                                _last_unrestrained_young_size,
                                                ...);
      }

      void G1NewTracer::report_adaptive_ihop_statistics(size_t threshold,
                                                        size_t internal_target_occupancy,
                                                        size_t current_occupancy,
                                                        size_t additional_buffer_size,
                                                        ...) {
        send_adaptive_ihop_statistics(threshold,
                                      internal_target_occupancy,
                                      additional_buffer_size, // SWAPPED HERE
                                      current_occupancy, // SWAPPED HERE
                                      ...);
      }

      void G1NewTracer::send_adaptive_ihop_statistics(size_t threshold,
                                                      size_t internal_target_occupancy,
                                                      size_t current_occupancy,
                                                      size_t additional_buffer_size,
                                                      ...) {
        ...
          evt.set_currentOccupancy(current_occupancy);
          evt.set_additionalBufferSize(additional_buffer_size);
        ...
      }

      I think current_occupancy and additional_buffer_size were swapped accidentally in G1NewTracer::report_adaptive_ihop_statistics.

      I have not looked at the actual JFR event dump, only to the code inspection.

        Attachments

          Activity

            People

            Assignee:
            tschatzl Thomas Schatzl
            Reporter:
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: