From 8c9507aaad220eda91bfacbae850531905f707da Mon Sep 17 00:00:00 2001 From: davek Date: Sun, 21 Mar 2010 19:34:19 +0000 Subject: PR target/42811 (prerequisite) * include/private/gc_priv.h (struct roots) [CYGWIN32]: Don't declare r_next member on Cygwin as on other windows hosts. (LOG_RT_SIZE) [CYGWIN32]: Don't define likewise. (RT_SIZE) [CYGWIN32]: Likewise. (struct _GC_arrays) [CYGWIN32]: Do declare _heap_bases[] member likewise. (GC_heap_bases) [CYGWIN32]: Do define likewise. (struct _SYSTEM_INFO) [CYGWIN32]: Do forward-declare likewise. (GC_sysinfo) [CYGWIN32]: Do declare extern likewise. (GC_n_heap_bases) [CYGWIN32]: Likewise. (GC_is_tmp_root) [CYGWIN32]: Do prototype likewise. * include/private/gcconfig.h (GC_win32_get_mem) [CYGWIN32]: Likewise. (GET_MEM) [CYGWIN32]: Do define likewise. * boehm-gc/ptr_chck.c (GC_is_visible) [CYGWIN32]: Do handle dynamic registration likewise. * boehm-gc/os_dep.c (GC_setpagesize) [CYGWIN32]: Do define likewise. (GC_no_win32_dlls) [CYGWIN32]: Define as constant false, unlike other windows hosts. (GC_sysinfo) [CYGWIN32]: Define as on other windows hosts. (GC_n_heap_bases) [CYGWIN32]: Likewise. (GLOBAL_ALLOC_TEST) [CYGWIN32]: Likewise. (GC_win32_get_mem) [CYGWIN32]: Likewise, but wrapping GC_unix_get_mem rather than GlobalAlloc/VirtualAlloc. (GC_win32_free_heap) [CYGWIN32]: Likewise, but wrapping free instead of GlobalFree (even though the function body is optimised away). * boehm-gc/mark_rts.c (add_roots_to_index) [CYGWIN32]: Define as on other windows hosts. (GC_add_roots_inner) [CYGWIN32]: Avoid overlapping or adjacent intervals likewise. (GC_clear_roots) [CYGWIN32]: Clear GC_root_index[] likewise. (GC_rebuild_root_index) [CYGWIN32]: Define as on other windows hosts. (GC_remove_tmp_roots) [CYGWIN32]: Call it likewise. (GC_remove_roots) [CYGWIN32]: Don't define, as on other windows hosts. (GC_is_tmp_root) [CYGWIN32]: Define, as on other windows hosts. (GC_cond_register_dynamic_libraries) [CYGWIN32]: Handle temporary roots and dynamic registration likewise. * boehm-gc/dyn_load.c (GC_has_static_roots) [CYGWIN32]: Define as on other windows hosts. (GC_register_has_static_roots_callback) [CYGWIN32]: Likewise. (GC_cond_add_roots) [CYGWIN32]: Likewise. (GC_register_main_static_data) [CYGWIN32]: Define to always return false, as on MSWINCE (HAVE_REGISTER_MAIN_STATIC_DATA) [CYGWIN32]: Define as on other windows hosts. (GC_warn_fb) [CYGWIN32]: Likewise. (GC_disallow_ignore_fb) [CYGWIN32]: Likewise. (GC_ignore_fb_mb) [CYGWIN32]: Likewise. (GC_ignore_fb) [CYGWIN32]: Likewise. (is_frame_buffer) [CYGWIN32]: Likewise. (GC_dump_meminfo) [CYGWIN32]: Likewise. (GC_wnt) [CYGWIN32]: Define to constant true. (GC_register_dynamic_libraries) [CYGWIN32]: Define as on other windows hosts. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157604 138bc75d-0d04-0410-961f-82ee72b054a4 --- boehm-gc/os_dep.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'boehm-gc/os_dep.c') diff --git a/boehm-gc/os_dep.c b/boehm-gc/os_dep.c index 6f1e81abc16..ca8be1a8236 100644 --- a/boehm-gc/os_dep.c +++ b/boehm-gc/os_dep.c @@ -107,7 +107,7 @@ # undef GC_AMIGA_DEF #endif -#if defined(MSWIN32) || defined(MSWINCE) +#if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) # define WIN32_LEAN_AND_MEAN # define NOSERVICE # include @@ -584,7 +584,7 @@ void GC_enable_signals() /* Find the page size */ word GC_page_size; -# if defined(MSWIN32) || defined(MSWINCE) +# if defined(MSWIN32) || defined(MSWINCE) || defined (CYGWIN32) void GC_setpagesize() { GetSystemInfo(&GC_sysinfo); @@ -1169,7 +1169,11 @@ void GC_register_data_segments() # else /* !OS2 */ -# if defined(MSWIN32) || defined(MSWINCE) +# if defined(MSWIN32) || defined(MSWINCE) || defined (CYGWIN32) + +# ifdef CYGWIN32 +# define GC_no_win32_dlls (FALSE) +# endif # ifdef MSWIN32 /* Unfortunately, we have to handle win32s very differently from NT, */ @@ -1664,11 +1668,13 @@ void * os2_alloc(size_t bytes) # endif /* OS2 */ -# if defined(MSWIN32) || defined(MSWINCE) +# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) SYSTEM_INFO GC_sysinfo; # endif -# ifdef MSWIN32 +# if defined(MSWIN32) || defined(CYGWIN32) + +word GC_n_heap_bases = 0; # ifdef USE_GLOBAL_ALLOC # define GLOBAL_ALLOC_TEST 1 @@ -1676,13 +1682,14 @@ SYSTEM_INFO GC_sysinfo; # define GLOBAL_ALLOC_TEST GC_no_win32_dlls # endif -word GC_n_heap_bases = 0; - ptr_t GC_win32_get_mem(bytes) word bytes; { ptr_t result; +# ifdef CYGWIN32 + result = GC_unix_get_mem (bytes); +# else if (GLOBAL_ALLOC_TEST) { /* VirtualAlloc doesn't like PAGE_EXECUTE_READWRITE. */ /* There are also unconfirmed rumors of other */ @@ -1702,6 +1709,7 @@ word bytes; MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); } +#endif if (HBLKDISPL(result) != 0) ABORT("Bad VirtualAlloc result"); /* If I read the documentation correctly, this can */ /* only happen if HBLKSIZE > 64k or not a power of 2. */ @@ -1714,7 +1722,11 @@ void GC_win32_free_heap () { if (GC_no_win32_dlls) { while (GC_n_heap_bases > 0) { +# ifdef CYGWIN32 + free (GC_heap_bases[--GC_n_heap_bases]); +# else GlobalFree (GC_heap_bases[--GC_n_heap_bases]); +# endif GC_heap_bases[GC_n_heap_bases] = 0; } } -- cgit v1.2.1