< prev index next >

src/share/vm/gc/g1/g1IHOPControl.cpp

Print this page
rev 9595 : 8143215: gcc 4.1.2: fix three issues breaking the build.
Reviewed-by: stuefe, simonis

@@ -142,13 +142,13 @@
   // heap, so can not be used for allocation during marking and must always be
   // considered.
 
   double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0);
 
-  return MIN2(
-    G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
-    _target_occupancy * (100.0 - _heap_waste_percent) / 100.0
+  return (size_t)MIN2(
+    (G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0),
+    (_target_occupancy * (100.0 - (float)_heap_waste_percent) / 100.0)
     );
 }
 
 bool G1AdaptiveIHOPControl::have_enough_data_for_prediction() const {
   return ((size_t)_marking_times_s.num() >= G1AdaptiveIHOPNumInitialSamples) &&

@@ -159,25 +159,26 @@
   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 predicted_needed_bytes_during_marking =
-      (pred_marking_time * pred_promotion_rate +
+      ((size_t)(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.
 
     size_t internal_threshold = actual_target_threshold();
     size_t predicted_initiating_threshold = predicted_needed_bytes_during_marking < internal_threshold ?
                                             internal_threshold - predicted_needed_bytes_during_marking :
                                             0;
     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;
   _allocation_rate_s.add(allocation_rate);
 
< prev index next >