diff --git a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp index c39514922fc..fb5c30f824a 100644 --- a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp +++ b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -300,11 +300,11 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy { virtual void clear_generation_free_space_flags(); - float major_pause_old_slope() { return _major_pause_old_estimator->slope(); } - float major_pause_young_slope() { + double major_pause_old_slope() { return _major_pause_old_estimator->slope(); } + double major_pause_young_slope() { return _major_pause_young_estimator->slope(); } - float major_collection_slope() { return _major_collection_estimator->slope();} + double major_collection_slope() { return _major_collection_estimator->slope();} // Given the amount of live data in the heap, should we // perform a Full GC? diff --git a/src/hotspot/share/gc/shared/adaptiveSizePolicy.hpp b/src/hotspot/share/gc/shared/adaptiveSizePolicy.hpp index 8af72a9f3b8..ca5458cd49c 100644 --- a/src/hotspot/share/gc/shared/adaptiveSizePolicy.hpp +++ b/src/hotspot/share/gc/shared/adaptiveSizePolicy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -367,14 +367,14 @@ class AdaptiveSizePolicy : public CHeapObj { return _major_collection_estimator; } - float minor_pause_young_slope() { + double minor_pause_young_slope() { return _minor_pause_young_estimator->slope(); } - float minor_collection_slope() { return _minor_collection_estimator->slope();} - float major_collection_slope() { return _major_collection_estimator->slope();} + double minor_collection_slope() { return _minor_collection_estimator->slope();} + double major_collection_slope() { return _major_collection_estimator->slope();} - float minor_pause_old_slope() { + double minor_pause_old_slope() { return _minor_pause_old_estimator->slope(); } diff --git a/src/hotspot/share/gc/shared/gcUtil.cpp b/src/hotspot/share/gc/shared/gcUtil.cpp index 8dfdde542e7..2c4010e7598 100644 --- a/src/hotspot/share/gc/shared/gcUtil.cpp +++ b/src/hotspot/share/gc/shared/gcUtil.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,10 +86,10 @@ void AdaptivePaddedAverage::sample(float new_sample) { // Now update the deviation and the padded average. float new_avg = average(); - float new_dev = compute_adaptive_average(fabsd(new_sample - new_avg), + float new_dev = compute_adaptive_average(fabs(new_sample - new_avg), deviation()); set_deviation(new_dev); - set_padded_average(new_avg + padding() * new_dev); + set_padded_average(new_avg + (float)padding() * new_dev); _last_sample = new_sample; } @@ -100,12 +100,12 @@ void AdaptivePaddedNoZeroDevAverage::sample(float new_sample) { float new_avg = average(); if (new_sample != 0) { // We only create a new deviation if the sample is non-zero - float new_dev = compute_adaptive_average(fabsd(new_sample - new_avg), + float new_dev = compute_adaptive_average(fabs(new_sample - new_avg), deviation()); set_deviation(new_dev); } - set_padded_average(new_avg + padding() * deviation()); + set_padded_average(new_avg + (float)padding() * deviation()); _last_sample = new_sample; } @@ -118,8 +118,8 @@ void LinearLeastSquareFit::update(double x, double y) { _sum_x_squared = _sum_x_squared + x * x; _sum_y = _sum_y + y; _sum_xy = _sum_xy + x * y; - _mean_x.sample(x); - _mean_y.sample(y); + _mean_x.sample((float)x); // Used to track generation sizes so casting to float should + _mean_y.sample((float)y); // not lose precision for valid samples. assert(_mean_x.count() == _mean_y.count(), "Incorrect count"); if ( _mean_x.count() > 1 ) { double slope_denominator; diff --git a/src/hotspot/share/gc/shared/gcUtil.hpp b/src/hotspot/share/gc/shared/gcUtil.hpp index ea7773b655b..8da6b31af21 100644 --- a/src/hotspot/share/gc/shared/gcUtil.hpp +++ b/src/hotspot/share/gc/shared/gcUtil.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,7 +104,7 @@ class AdaptiveWeightedAverage : public CHeapObj { static inline float exp_avg(float avg, float sample, unsigned int weight) { assert(weight <= 100, "weight must be a percent"); - return (100.0F - weight) * avg / 100.0F + weight * sample / 100.0F; + return (100.0F - (float)weight) * avg / 100.0F + (float)weight * sample / 100.0F; } static inline size_t exp_avg(size_t avg, size_t sample, unsigned int weight) { diff --git a/src/hotspot/share/gc/shared/workerDataArray.inline.hpp b/src/hotspot/share/gc/shared/workerDataArray.inline.hpp index 5fcb1424db1..34549bc079e 100644 --- a/src/hotspot/share/gc/shared/workerDataArray.inline.hpp +++ b/src/hotspot/share/gc/shared/workerDataArray.inline.hpp @@ -133,7 +133,7 @@ double WorkerDataArray::average() const { if (contributing_threads == 0) { return 0.0; } - return sum() / (double) contributing_threads; + return (double) sum() / (double) contributing_threads; } template @@ -178,7 +178,7 @@ void WorkerDataArray::print_summary_on(outputStream* out, bool print_sum) con } T diff = max - min; assert(contributing_threads != 0, "Must be since we found a used value for the start index"); - double avg = sum / (double) contributing_threads; + double avg = (double) sum / (double) contributing_threads; WDAPrinter::summary(out, min, avg, max, diff, sum, print_sum); out->print_cr(", Workers: %d", contributing_threads); } else {