diff -urN gc-7.2alpha6.orig/alloc.c gc-7.2alpha6/alloc.c --- gc-7.2alpha6.orig/alloc.c 2011-06-01 00:27:11.000000000 +0900 +++ gc-7.2alpha6/alloc.c 2012-05-08 01:22:13.000000000 +0900 @@ -121,6 +121,7 @@ #endif word GC_free_space_divisor = GC_FREE_SPACE_DIVISOR; +word GC_free_space_numerator = 1; GC_INNER int GC_CALLBACK GC_never_stop_func(void) { @@ -229,9 +230,9 @@ scan_size = 2 * GC_composite_in_use + GC_atomic_in_use / 4 + total_root_size; if (GC_incremental) { - return scan_size / (2 * GC_free_space_divisor); + return scan_size * GC_free_space_numerator / (2 * GC_free_space_divisor); } else { - return scan_size / GC_free_space_divisor; + return scan_size * GC_free_space_numerator / (2 * GC_free_space_divisor); } } @@ -597,6 +598,7 @@ GET_TIME(start_time); # endif + GC_timerstart(); STOP_WORLD(); # ifdef THREAD_LOCAL_ALLOC GC_world_stopped = TRUE; @@ -629,6 +631,7 @@ GC_world_stopped = FALSE; # endif START_WORLD(); + GC_timerstop(); return(FALSE); } if (GC_mark_some((ptr_t)(&dummy))) break; @@ -651,6 +654,7 @@ GC_world_stopped = FALSE; # endif START_WORLD(); + GC_timerstop(); # ifndef SMALL_CONFIG if (GC_print_stats) { unsigned long time_diff; @@ -796,6 +800,7 @@ /* FIXME: Add more checks. */ GC_check_tls(); # endif + GC_timerstart(); # ifndef SMALL_CONFIG if (GC_print_stats) @@ -923,6 +928,7 @@ MS_TIME_DIFF(done_time,finalize_time)); } # endif + GC_timerstop(); } /* If stop_func == 0 then GC_default_stop_func is used instead. */ @@ -1172,6 +1178,9 @@ GC_heapsize + expansion_slop - 2*MAXHINCR*HBLKSIZE; if (GC_collect_at_heapsize < GC_heapsize /* wrapped */) GC_collect_at_heapsize = (word)(-1); +#if defined(VISUAL) + SendHeapSize(); +#endif return(TRUE); } @@ -1281,6 +1290,21 @@ GC_bool retry = FALSE; if (gran == 0) return(0); +#if defined(_MSC_VER) + { +#include + extern int recv_intr; + if ( recv_intr ) { + if ( recv_intr == 1 ) { + recv_intr = 0; + int_handler(); + } else { + recv_intr = 0; + ox_usr1_handler(0); + } + } + } +#endif while (*flh == 0) { ENTER_GC(); diff -urN gc-7.2alpha6.orig/misc.c gc-7.2alpha6/misc.c --- gc-7.2alpha6.orig/misc.c 2011-06-01 00:27:11.000000000 +0900 +++ gc-7.2alpha6/misc.c 2012-05-08 01:17:58.000000000 +0900 @@ -141,6 +141,93 @@ GC_INNER long GC_large_alloc_warn_interval = GC_LARGE_ALLOC_WARN_INTERVAL; /* Interval between unsuppressed warnings. */ +#include + +#if defined(_MSC_VER) +#include + +static double get_clock() +{ + static int initialized = 0; + static int is_winnt = 0; + static HANDLE curproc; + + if ( !initialized ) { + OSVERSIONINFO vinfo; + + curproc = GetCurrentProcess(); + vinfo.dwOSVersionInfoSize = sizeof(vinfo); + GetVersionEx(&vinfo); + if ( vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) + is_winnt = 1; + else + is_winnt = 0; + } + if ( is_winnt ) { + FILETIME c,e,k,u; + + GetProcessTimes(curproc,&c,&e,&k,&u); + return ((double)k.dwLowDateTime+(double)u.dwLowDateTime + +4294967296.0*((double)k.dwHighDateTime+(double)u.dwHighDateTime))/10000000.0; + } else +// return (double)clock()/(double)CLOCKS_PER_SEC; + return ((double)GetTickCount())/1000.0; +} + +#elif defined(THINK_C) || defined(__MWERKS__) || defined(MSWIN32) + +static double get_clock() +{ + clock_t c; + + c = clock(); + return (double)c/(double)CLOCKS_PER_SEC; +} + +#elif defined(_PA_RISC1_1) || defined(__svr4__) || defined(__CYGWIN__) + +#include +#include + +static double get_clock() +{ + struct tms buf; + + times(&buf); + return (double)(buf.tms_utime+buf.tms_stime)/(double)CLK_TCK; +} + +#else + +#include +#include + +static double get_clock() +{ + int tv_sec,tv_usec; + struct rusage ru; + + getrusage(RUSAGE_SELF,&ru); + tv_sec = ru.ru_utime.tv_sec + ru.ru_stime.tv_sec; + tv_usec = ru.ru_utime.tv_usec + ru.ru_stime.tv_usec; + return (double)tv_sec+(double)tv_usec/(double)1000000; +} +#endif + +static double gctime, gcstart; + +void GC_timerstart() { + gcstart = get_clock(); +} + +void GC_timerstop() { + gctime += get_clock() - gcstart; +} + +double GC_get_gctime() { + return gctime; +} + /*ARGSUSED*/ STATIC void * GC_CALLBACK GC_default_oom_fn(size_t bytes_requested) { diff -urN gc-7.2alpha6.orig/reclaim.c gc-7.2alpha6/reclaim.c --- gc-7.2alpha6.orig/reclaim.c 2011-06-01 00:27:11.000000000 +0900 +++ gc-7.2alpha6/reclaim.c 2012-05-08 01:25:00.000000000 +0900 @@ -590,6 +590,7 @@ if (GC_print_stats == VERBOSE) GET_TIME(start_time); + GC_timerstart(); # endif for (kind = 0; kind < GC_n_kinds; kind++) { @@ -614,6 +615,7 @@ } } # ifndef SMALL_CONFIG + GC_timerstop(); if (GC_print_stats == VERBOSE) { GET_TIME(done_time); GC_log_printf("Disposing of reclaim lists took %lu msecs\n",