=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/gc-7.0-risa.diff,v retrieving revision 1.1 retrieving revision 1.13 diff -u -p -r1.1 -r1.13 --- OpenXM_contrib2/asir2000/gc-7.0-risa.diff 2007/11/11 15:54:02 1.1 +++ OpenXM_contrib2/asir2000/gc-7.0-risa.diff 2017/08/30 09:40:30 1.13 @@ -1,178 +1,233 @@ -%% $OpenXM$ -%% This patch is based on gc6.5-risa.diff. -diff -urN gc-7.0.orig/alloc.c gc-7.0/alloc.c ---- gc-7.0.orig/alloc.c 2007-06-22 11:40:30.000000000 +0900 -+++ gc-7.0/alloc.c 2007-11-09 17:29:38.000000000 +0900 -@@ -100,6 +100,7 @@ - GC_bool GC_dont_expand = 0; +diff -urN gc-7.4.2.orig/alloc.c gc-7.4.2/alloc.c +--- gc-7.4.2.orig/alloc.c 2014-06-03 15:08:01.000000000 +0900 ++++ gc-7.4.2/alloc.c 2015-08-25 16:00:00.000000000 +0900 +@@ -121,6 +121,7 @@ + #endif - word GC_free_space_divisor = 3; + word GC_free_space_divisor = GC_FREE_SPACE_DIVISOR; +word GC_free_space_numerator = 1; - extern GC_bool GC_collection_in_progress(); - /* Collection is in progress, or was abandoned. */ -@@ -160,9 +161,9 @@ - scan_size = 2 * GC_composite_in_use + GC_atomic_in_use - + total_root_size; - if (TRUE_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 / GC_free_space_divisor; + GC_INNER int GC_CALLBACK GC_never_stop_func(void) + { +@@ -227,8 +228,8 @@ + total_root_size = 2 * stack_size + GC_root_size; + scan_size = 2 * GC_composite_in_use + GC_atomic_in_use / 4 + + total_root_size; +- result = scan_size / GC_free_space_divisor; +- if (GC_incremental) { ++ result = scan_size * GC_free_space_numerator / GC_free_space_divisor; ++ if (1 || GC_incremental) { + result /= 2; } - } - -@@ -451,6 +452,7 @@ - # if defined(REGISTER_LIBRARIES_EARLY) - GC_cond_register_dynamic_libraries(); + return result > 0 ? result : 1; +@@ -603,6 +604,7 @@ + GET_TIME(start_time); # endif + + GC_timerstart(); STOP_WORLD(); - IF_THREADS(GC_world_stopped = TRUE); - if (GC_print_stats) { -@@ -479,6 +481,7 @@ - GC_deficit = i; /* Give the mutator a chance. */ - IF_THREADS(GC_world_stopped = FALSE); - START_WORLD(); -+ GC_timerstop(); - return(FALSE); - } - if (GC_mark_some((ptr_t)(&dummy))) break; -@@ -503,6 +506,7 @@ - - IF_THREADS(GC_world_stopped = FALSE); + # ifdef THREAD_LOCAL_ALLOC + GC_world_stopped = TRUE; +@@ -632,6 +634,7 @@ + GC_world_stopped = FALSE; + # endif + START_WORLD(); ++ GC_timerstop(); + return(FALSE); + } + if (GC_mark_some(GC_approx_sp())) break; +@@ -653,6 +656,7 @@ + GC_world_stopped = FALSE; + # endif START_WORLD(); + GC_timerstop(); - if (GC_print_stats) { - GET_TIME(current_time); - GC_log_printf("World-stopped marking took %lu msecs\n", -@@ -603,6 +607,7 @@ - /* FIXME: Add more checks. */ + # ifndef SMALL_CONFIG + if (GC_PRINT_STATS_FLAG) { + unsigned long time_diff; +@@ -836,6 +840,7 @@ + /* FIXME: Add more checks. */ GC_check_tls(); # endif + GC_timerstart(); - if (GC_print_stats) - GET_TIME(start_time); -@@ -722,6 +727,7 @@ - MS_TIME_DIFF(finalize_time,start_time), - MS_TIME_DIFF(done_time,finalize_time)); - } + # ifndef SMALL_CONFIG + if (GC_print_stats) +@@ -958,6 +963,7 @@ + MS_TIME_DIFF(done_time,finalize_time)); + } + # endif + GC_timerstop(); } - /* Externally callable routine to invoke full, stop-world collection */ -@@ -908,6 +914,9 @@ - if (GC_collect_at_heapsize < GC_heapsize /* wrapped */) - GC_collect_at_heapsize = (word)(-1); - # endif -+#if defined(VISUAL_LIB) + /* If stop_func == 0 then GC_default_stop_func is used instead. */ +@@ -1215,6 +1221,9 @@ + if (GC_on_heap_resize) + (*GC_on_heap_resize)(GC_heapsize); + ++#if defined(VISUAL) + SendHeapSize(); +#endif return(TRUE); } -@@ -991,6 +1000,22 @@ - - if (gran == 0) return(0); +@@ -1276,7 +1285,7 @@ + } + } -+#if defined(VISUAL) -+ { -+#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); -+ } -+ } -+ } +- blocks_to_get = GC_heapsize/(HBLKSIZE*GC_free_space_divisor) ++ blocks_to_get = GC_heapsize * GC_free_space_numerator /(HBLKSIZE*GC_free_space_divisor) + + needed_blocks; + if (blocks_to_get > MAXHINCR) { + word slop; +diff -urN gc-7.4.2.orig/misc.c gc-7.4.2/misc.c +--- gc-7.4.2.orig/misc.c 2014-06-03 15:08:02.000000000 +0900 ++++ gc-7.4.2/misc.c 2015-08-04 14:21:02.000000000 +0900 +@@ -161,6 +161,94 @@ + 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 + - while (*flh == 0) { - ENTER_GC(); - /* Do our share of marking work */ -diff -urN gc-7.0.orig/include/private/gc_priv.h gc-7.0/include/private/gc_priv.h ---- gc-7.0.orig/include/private/gc_priv.h 2007-06-24 11:01:15.000000000 +0900 -+++ gc-7.0/include/private/gc_priv.h 2007-11-09 17:24:21.000000000 +0900 -@@ -161,6 +161,10 @@ - # define MAX_EXTRA_BYTES 0 - #endif - -+/* Added by ohara */ -+# ifndef LARGE_CONFIG -+# define LARGE_CONFIG -+# endif - - # ifndef LARGE_CONFIG - # define MINHINCR 16 /* Minimum heap increment, in blocks of HBLKSIZE */ -diff -urN gc-7.0.orig/include/private/gcconfig.h gc-7.0/include/private/gcconfig.h ---- gc-7.0.orig/include/private/gcconfig.h 2007-06-29 09:00:09.000000000 +0900 -+++ gc-7.0/include/private/gcconfig.h 2007-11-09 17:24:21.000000000 +0900 -@@ -62,6 +62,13 @@ - # endif - - /* Determine the machine type: */ -+/* T.Saito */ -+# if defined(FREEBSD) && defined(__amd64__) -+# define X86_64 -+# define mach_type_known -+# endif ++static double gctime, gcstart; + -+/* Determine the machine type: */ - # if defined(__arm__) || defined(__thumb__) - # define ARM32 - # if !defined(LINUX) && !defined(NETBSD) -@@ -1975,6 +1982,28 @@ - # endif - # define DATAEND /* not needed */ ++void GC_timerstart() { ++ gcstart = get_clock(); ++} ++ ++void GC_timerstop() { ++ gctime += get_clock() - gcstart; ++} ++ ++double GC_get_gctime() { ++ return gctime; ++} ++ ++ + STATIC void * GC_CALLBACK GC_default_oom_fn( + size_t bytes_requested GC_ATTR_UNUSED) + { +diff -urN gc-7.4.2.orig/reclaim.c gc-7.4.2/reclaim.c +--- gc-7.4.2.orig/reclaim.c 2014-06-03 15:08:02.000000000 +0900 ++++ gc-7.4.2/reclaim.c 2015-08-04 14:12:42.000000000 +0900 +@@ -706,6 +706,7 @@ + + if (GC_print_stats == VERBOSE) + GET_TIME(start_time); ++ GC_timerstart(); # endif -+# ifdef FREEBSD /* T.Saito */ -+# define OS_TYPE "FREEBSD" -+# ifndef GC_FREEBSD_THREADS -+# define MPROTECT_VDB -+# endif -+# define SIG_SUSPEND SIGUSR1 -+# define SIG_THR_RESTART SIGUSR2 -+# define FREEBSD_STACKBOTTOM -+# ifdef __ELF__ -+# define DYNAMIC_LOADING -+# endif -+ extern int _etext[]; -+ extern char etext[]; -+ extern char edata[]; -+ extern char end[]; -+ extern char * GC_FreeBSDGetDataStart(); -+# define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff)) -+# define NEED_FIND_LIMIT -+# define DATAEND (GC_find_limit (DATASTART, TRUE)) -+# define DATASTART2 ((ptr_t)(&edata)) -+# define DATAEND2 ((ptr_t)(&end)) -+# endif /* end T.Saito */ - # endif - #if defined(LINUX) && defined(USE_MMAP) -diff -urN gc-7.0.orig/reclaim.c gc-7.0/reclaim.c ---- gc-7.0.orig/reclaim.c 2007-06-07 09:24:17.000000000 +0900 -+++ gc-7.0/reclaim.c 2007-11-09 17:32:31.000000000 +0900 -@@ -577,7 +577,7 @@ - - if (GC_print_stats == VERBOSE) - GET_TIME(start_time); -- -+ GC_timerstart(); for (kind = 0; kind < GC_n_kinds; kind++) { - ok = &(GC_obj_kinds[kind]); - rlp = ok -> ok_reclaim_list; -@@ -599,6 +599,7 @@ - } +@@ -730,6 +731,7 @@ } } -+ GC_timerstop(); - if (GC_print_stats == VERBOSE) { - GET_TIME(done_time); - GC_log_printf("Disposing of reclaim lists took %lu msecs\n", + # ifndef SMALL_CONFIG ++ GC_timerstop(); + if (GC_print_stats == VERBOSE) { + GET_TIME(done_time); + GC_verbose_log_printf("Disposing of reclaim lists took %lu msecs\n", +diff -urN gc-7.4.2.orig/NT_X64_STATIC_THREADS_MAKEFILE gc-7.4.2/NT_X64_STATIC_THREADS_MAKEFILE +--- gc-7.4.2.orig/NT_X64_STATIC_THREADS_MAKEFILE 2014-06-03 15:08:01.000000000 +0900 ++++ gc-7.4.2/NT_X64_STATIC_THREADS_MAKEFILE 2015-08-04 14:12:42.000000000 +0900 +@@ -22,13 +22,13 @@ + all: gctest.exe cord\de.exe test_cpp.exe + + .c.obj: +- $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_THREADS -DTHREAD_LOCAL_ALLOC -D_CRT_SECURE_NO_DEPRECATE $*.c /Fo$*.obj /wd4701 ++ $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_THREADS -DTHREAD_LOCAL_ALLOC -D_CRT_SECURE_NO_DEPRECATE -DLARGE_CONFIG $*.c /Fo$*.obj /wd4701 + # Disable "may not be initialized" warnings. They're too approximate. + # Disable crt security warnings, since unfortunately they warn about all sorts + # of safe uses of strncpy. It would be nice to leave the rest enabled. + + .cpp.obj: +- $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_THREADS -DTHREAD_LOCAL_ALLOC -D_CRT_SECURE_NO_DEPRECATE $*.cpp /Fo$*.obj ++ $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_THREADS -DTHREAD_LOCAL_ALLOC -D_CRT_SECURE_NO_DEPRECATE -DLARGE_CONFIG $*.cpp /Fo$*.obj + + $(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h include\gc_disclaim.h include\private\msvc_dbg.h + +diff -urN gc-7.4.2.orig/NT_STATIC_THREADS_MAKEFILE gc-7.4.2/NT_STATIC_THREADS_MAKEFILE +--- gc-7.4.2.orig/NT_STATIC_THREADS_MAKEFILE 2014-06-03 15:08:01.000000000 +0900 ++++ gc-7.4.2/NT_STATIC_THREADS_MAKEFILE 2015-08-04 14:12:42.000000000 +0900 +@@ -22,10 +22,10 @@ + all: gctest.exe cord\de.exe test_cpp.exe + + .c.obj: +- $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_THREADS -DTHREAD_LOCAL_ALLOC -DPARALLEL_MARK -D_CRT_SECURE_NO_DEPRECATE $*.c /Fo$*.obj ++ $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_THREADS -DTHREAD_LOCAL_ALLOC -DPARALLEL_MARK -D_CRT_SECURE_NO_DEPRECATE -DLARGE_CONFIG $*.c /Fo$*.obj + + .cpp.obj: +- $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_THREADS -DTHREAD_LOCAL_ALLOC -D_CRT_SECURE_NO_DEPRECATE $*.cpp /Fo$*.obj ++ $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_THREADS -DTHREAD_LOCAL_ALLOC -D_CRT_SECURE_NO_DEPRECATE -DLARGE_CONFIG $*.cpp /Fo$*.obj + + $(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h include\gc_disclaim.h include\private\msvc_dbg.h +