harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r532311 - /harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp
Date Wed, 25 Apr 2007 10:56:08 GMT
Author: xli
Date: Wed Apr 25 03:56:07 2007
New Revision: 532311

URL: http://svn.apache.org/viewvc?view=rev&rev=532311
Log:
HARMONY-3700 : a LOS (Large object space) adaptation bug is fixed (subtraction downflow to
negative)

Modified:
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp?view=diff&rev=532311&r1=532310&r2=532311
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/space_tuner.cpp Wed Apr 25 03:56:07
2007
@@ -123,6 +123,9 @@
 {
   if(gc_match_kind(gc, MINOR_COLLECTION)) return;
   Space_Tuner* tuner = gc->tuner;
+  if((tuner->speed_los == 0) && ( tuner->speed_mos == 0)) return;
+  if(tuner->speed_los == 0) tuner->speed_los = 16;
+  if(tuner->speed_mos == 0) tuner->speed_mos = 16;
 
   /*Needn't tune if dw does not reach threshold.*/  
   if(tuner->current_dw > tuner->threshold)  tuner->need_tune = 1;
@@ -135,12 +138,17 @@
   Space* lspace = (Space*)gc_get_los((GC_Gen*)gc);
 
   POINTER_SIZE_INT los_expect_survive_sz = (POINTER_SIZE_INT)((float)(lspace->surviving_size
+ lspace->alloced_size) * lspace->survive_ratio);
-  POINTER_SIZE_INT los_expect_free_sz = lspace->committed_heap_size - los_expect_survive_sz;
+  POINTER_SIZE_INT los_expect_free_sz = ((lspace->committed_heap_size > los_expect_survive_sz)
? 
+                                                            (lspace->committed_heap_size
- los_expect_survive_sz) : 0);
   POINTER_SIZE_INT mos_expect_survive_sz = (POINTER_SIZE_INT)((float)(mspace->surviving_size
+ mspace->alloced_size) * mspace->survive_ratio);
-  POINTER_SIZE_INT mos_expect_free_sz = mspace_get_expected_threshold((Mspace*)mspace) -
mos_expect_survive_sz;
+  POINTER_SIZE_INT mos_expect_threshold = mspace_get_expected_threshold((Mspace*)mspace);
+  POINTER_SIZE_INT mos_expect_free_sz = ((mos_expect_threshold > mos_expect_survive_sz)?
+                                                            (mos_expect_threshold - mos_expect_survive_sz)
: 0);
   POINTER_SIZE_INT total_free = los_expect_free_sz + mos_expect_free_sz;
+  assert(total_free <= gc->committed_heap_size);
   float new_los_ratio = (float)tuner->speed_los / (float)(tuner->speed_los  + tuner->speed_mos);
   POINTER_SIZE_INT new_free_los_sz = (POINTER_SIZE_INT)((float)total_free * new_los_ratio);
+  assert(new_free_los_sz <= gc->committed_heap_size);  
   POINTER_SIZE_INT max_tuning_size = 0;
   /*LOS_Extend:*/
   if((new_free_los_sz > los_expect_free_sz) )



Mime
View raw message