8143215: gcc 4.1.2: fix three issues breaking the build.
authorgoetz
Wed, 18 Nov 2015 11:31:59 +0100
changeset 35196 c83940b346b2
parent 35192 76f4de26388d
child 35197 dbc88f36cfd3
8143215: gcc 4.1.2: fix three issues breaking the build. Summary: Also fix some more recent introduced missing casts. Reviewed-by: stuefe, simonis, kbarrett, tschatzl
hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp
hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp
hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp
hotspot/src/share/vm/gc/shared/gcTraceSend.cpp
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Fri Dec 18 13:38:49 2015 +0000
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Wed Nov 18 11:31:59 2015 +0100
@@ -2730,7 +2730,7 @@
  public:
   // Not MT-safe; so do not pass around these StackObj's
   // where they may be accessed by other threads.
-  jlong wallclock_millis() {
+  double wallclock_millis() {
     return TimeHelper::counter_to_millis(os::elapsed_counter() - _trace_time.start_time());
   }
 };
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Fri Dec 18 13:38:49 2015 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Wed Nov 18 11:31:59 2015 +0100
@@ -291,6 +291,10 @@
   return _predictor.get_new_prediction(seq);
 }
 
+size_t G1CollectorPolicy::get_new_size_prediction(TruncatedSeq const* seq) const {
+  return (size_t)get_new_prediction(seq);
+}
+
 void G1CollectorPolicy::initialize_alignments() {
   _space_alignment = HeapRegion::GrainBytes;
   size_t card_table_alignment = CardTableRS::ct_max_alignment_constraint();
@@ -477,7 +481,7 @@
   // (100 + TargetPLABWastePct) represents the increase in expected bytes during
   // copying due to anticipated waste in the PLABs.
   double safety_factor = (100.0 / G1ConfidencePercent) * (100 + TargetPLABWastePct) / 100.0;
-  size_t expected_bytes_to_copy = safety_factor * bytes_to_copy;
+  size_t expected_bytes_to_copy = (size_t)(safety_factor * bytes_to_copy);
 
   if (expected_bytes_to_copy > free_bytes) {
     // end condition 3: out-of-space
@@ -524,7 +528,7 @@
 }
 
 uint G1CollectorPolicy::update_young_list_max_and_target_length() {
-  return update_young_list_max_and_target_length(get_new_prediction(_rs_lengths_seq));
+  return update_young_list_max_and_target_length(get_new_size_prediction(_rs_lengths_seq));
 }
 
 uint G1CollectorPolicy::update_young_list_max_and_target_length(size_t rs_lengths) {
@@ -629,7 +633,7 @@
 
   double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0;
   double survivor_regions_evac_time = predict_survivor_regions_evac_time();
-  size_t pending_cards = (size_t) get_new_prediction(_pending_cards_seq);
+  size_t pending_cards = get_new_size_prediction(_pending_cards_seq);
   size_t adj_rs_lengths = rs_lengths + predict_rs_length_diff();
   size_t scanned_cards = predict_young_card_num(adj_rs_lengths);
   double base_time_ms =
@@ -732,7 +736,7 @@
 }
 
 void G1CollectorPolicy::update_rs_lengths_prediction() {
-  update_rs_lengths_prediction(get_new_prediction(_rs_lengths_seq));
+  update_rs_lengths_prediction(get_new_size_prediction(_rs_lengths_seq));
 }
 
 void G1CollectorPolicy::update_rs_lengths_prediction(size_t prediction) {
@@ -1345,7 +1349,7 @@
 }
 
 size_t G1CollectorPolicy::predict_rs_length_diff() const {
-  return (size_t) get_new_prediction(_rs_length_diff_seq);
+  return get_new_size_prediction(_rs_length_diff_seq);
 }
 
 double G1CollectorPolicy::predict_alloc_rate_ms() const {
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Fri Dec 18 13:38:49 2015 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Wed Nov 18 11:31:59 2015 +0100
@@ -179,6 +179,7 @@
   G1Predictions _predictor;
 
   double get_new_prediction(TruncatedSeq const* seq) const;
+  size_t get_new_size_prediction(TruncatedSeq const* seq) const;
 
   // either equal to the number of parallel threads, if ParallelGCThreads
   // has been set, or 1 otherwise
--- a/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Fri Dec 18 13:38:49 2015 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1IHOPControl.cpp	Wed Nov 18 11:31:59 2015 +0100
@@ -138,7 +138,7 @@
 
   double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0);
 
-  return MIN2(
+  return (size_t)MIN2(
     G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
     _target_occupancy * (100.0 - _heap_waste_percent) / 100.0
     );
@@ -153,10 +153,13 @@
   if (have_enough_data_for_prediction()) {
     double pred_marking_time = _predictor->get_new_prediction(&_marking_times_s);
     double pred_promotion_rate = _predictor->get_new_prediction(&_allocation_rate_s);
+    size_t pred_promotion_size = (size_t)(pred_marking_time * pred_promotion_rate);
 
     size_t predicted_needed_bytes_during_marking =
-      (pred_marking_time * pred_promotion_rate +
-      _last_unrestrained_young_size); // In reality we would need the maximum size of the young gen during marking. This is a conservative estimate.
+      pred_promotion_size +
+      // In reality we would need the maximum size of the young gen during
+      // marking. This is a conservative estimate.
+      _last_unrestrained_young_size;
 
     size_t internal_threshold = actual_target_threshold();
     size_t predicted_initiating_threshold = predicted_needed_bytes_during_marking < internal_threshold ?
@@ -165,11 +168,13 @@
     return predicted_initiating_threshold;
   } else {
     // Use the initial value.
-    return _initial_ihop_percent * _target_occupancy / 100.0;
+    return (size_t)(_initial_ihop_percent * _target_occupancy / 100.0);
   }
 }
 
-void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
+void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s,
+                                                   size_t allocated_bytes,
+                                                   size_t additional_buffer_size) {
   G1IHOPControl::update_allocation_info(allocation_time_s, allocated_bytes, additional_buffer_size);
 
   double allocation_rate = (double) allocated_bytes / allocation_time_s;
--- a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp	Fri Dec 18 13:38:49 2015 +0000
+++ b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp	Wed Nov 18 11:31:59 2015 +0100
@@ -278,7 +278,7 @@
     evt.set_gcId(GCId::current());
     evt.set_threshold(threshold);
     evt.set_targetOccupancy(target_occupancy);
-    evt.set_thresholdPercentage(target_occupancy > 0 ? threshold * 100.0 / target_occupancy : 0.0);
+    evt.set_thresholdPercentage(target_occupancy > 0 ? (threshold * 100 / target_occupancy) : 0);
     evt.set_currentOccupancy(current_occupancy);
     evt.set_lastAllocationSize(last_allocation_size);
     evt.set_lastAllocationDuration(last_allocation_duration);
@@ -299,7 +299,7 @@
   if (evt.should_commit()) {
     evt.set_gcId(GCId::current());
     evt.set_threshold(threshold);
-    evt.set_thresholdPercentage(internal_target_occupancy > 0 ? threshold * 100.0 / internal_target_occupancy : 0.0);
+    evt.set_thresholdPercentage(internal_target_occupancy > 0 ? (threshold * 100 / internal_target_occupancy) : 0);
     evt.set_internalTargetOccupancy(internal_target_occupancy);
     evt.set_currentOccupancy(current_occupancy);
     evt.set_additionalBufferSize(additional_buffer_size);