summaryrefslogtreecommitdiff
path: root/os_dep.c
Commit message (Collapse)AuthorAgeFilesLines
* Improve ABORT message in GC_darwin_sigbusIvan Maidanski2023-05-101-8/+6
| | | | | | | * os_dep.c [MPROTECT_VDB && DARWIN && BROKEN_EXCEPTION_HANDLING] (GC_darwin_sigbus): Refine ABORT message. * os_dep.c [MPROTECT_VDB && DARWIN && BROKEN_EXCEPTION_HANDLING] (GC_dirty_init): Refine comment ("SIGBUS signals").
* Workaround a malfunction of soft-dirty bits clearing on Power9Ivan Maidanski2023-05-041-16/+30
| | | | | | | | | | | | | | | | | | (fix of commit c1bf1b973) Issue #479 (bdwgc). Make a page dirty twice in detect_soft_dirty_supported() clearing all the soft-dirty bits in the middle. If the 2nd write to a page is not noticeable, then fallback to mprotect-based VDB. This a workaround for a bug observed, at least, in Fedora 36 kernel on Power9 CPU. * os_dep.c [SOFT_VDB] (clear_soft_dirty_bits): New static function (move part of code from GC_soft_read_dirty). * os_dep.c [SOFT_VDB] (detect_soft_dirty_supported): Call clear_soft_dirty_bits() and retry changing *vaddr to check whether the latter is reflected in pagemap file; add comment. * os_dep.c [SOFT_VDB] (GC_soft_read_dirty): Call clear_soft_dirty_bits.
* Workaround 'condition is always false' cppcheck FP in GC_setpagesizeIvan Maidanski2023-05-031-2/+4
| | | | | | | (fix of commit 3af192338) * os_dep.c [SOFT_VDB] (GC_setpagesize): Do not check that GC_page_size value is a power of two if CPPCHECK.
* Do not use integer division in GC_soft_read_dirtyIvan Maidanski2023-05-021-61/+78
| | | | | | | | | | | | | | | | | | An integer division operation might be slow on some CPU architectures. It should be replaced with a shift operation where possible. The SOFT_VDB algorithm used division and multiplication by the page size. * os_dep.c [SOFT_VDB] (GC_log_pagesize): Define STATIC variable. * os_dep.c (GC_setpagesize): Define in a single place (for Win32 and non-Win32 cases). * os_dep.c [SOFT_VDB] (os2_getpagesize): Define pgsize and log_pgsize local variables; compute GC_log_pagesize value. * os_dep.c [SOFT_VDB] (detect_soft_dirty_supported, soft_set_grungy_pages): Check GC_log_pagesize instead of GC_page_size in assertion; use shift by GC_log_pagesize instead of division (and multiplication) by GC_page_size. * os_dep.c [SOFT_VDB] (pagemap_buffered_read): Add assertion that GC_page_size is non-zero.
* Fix missing extern C for __asan_default_optionsIvan Maidanski2023-04-271-0/+4
| | | | | | | | | | (fix of commit 84b695d01) Issue #206 (bdwgc). * os_dep.c [ADDRESS_SANITIZER && (UNIX_LIKE || NEED_FIND_LIMIT || MPROTECT_VDB) && !CUSTOM_ASAN_DEF_OPTIONS] (__asan_default_options): Add the declaration wrapped into EXTERN_C_BEGIN.
* Eliminate data race FP between remove_protection and write_fault_handlerIvan Maidanski2023-04-271-1/+17
| | | | | | | | | * os_dep.c [MPROTECT_VDB] (get_pht_entry_from_index_async): Define (as a static function with GC_ATTR_NO_SANITIZE_THREAD or as a macro); add comment. * os_dep.c [!GC_DISABLE_INCREMENTAL && MPROTECT_VDB] (GC_remove_protection): Call get_pht_entry_from_index_async() instead of get_pht_entry_from_index().
* Fix unused GC_parse_version if no SOFT_VDB and no parallel mark on LinuxIvan Maidanski2023-04-261-1/+1
| | | | | | | | | | (fix of commit 6e1b82b0a) * include/private/gc_priv.h [GLIBC_2_19_TSX_BUG && THREADS] (GC_parse_version): Do not declare unless GC_PTHREADS_PARAMARK. * os_dep.c [(!SOFT_VDB || NO_SOFT_VDB_LINUX_VER_RUNTIME_CHECK) && GLIBC_2_19_TSX_BUG && THREADS] (GC_parse_version): Do not define unless GC_PTHREADS_PARAMARK.
* Remove use of emscripten_scan_stackBruce Mitchener2023-03-021-22/+2
| | | | | | | | | | | | | | | | | | (refactoring) Issue #530 (bdwgc). The code was only enabled by a define (USE_EMSCRIPTEN_SCAN_STACK) and not needed as the alternative is to just use emscripten_stack_get_base which is more straight forward. * os_dep.c [EMSCRIPTEN && USE_EMSCRIPTEN_SCAN_STACK && EMSCRIPTEN_ASYNCIFY]: Do not include emscripten.h. * os_dep.c [EMSCRIPTEN && USE_EMSCRIPTEN_SCAN_STACK && EMSCRIPTEN_ASYNCIFY] (emscripten_stack_base, scan_stack_cb): Do not define. * os_dep.c [EMSCRIPTEN] (GC_get_main_stack_base): Always use emscripten_stack_get_base().
* Simplify MacOS-related code in GC_register_data_segmentsIvan Maidanski2023-02-031-38/+31
| | | | | | | | | | | | | | | | | | | (refactoring) * os_dep.c [!OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32 && !AMIGA && !OPENBSD && !DYNAMIC_LOADING && GC_DONT_REGISTER_MAIN_STATIC_DATA && !PCR && MACOS] (GC_register_data_segments): Move code for handling MACOS upper (to be before GC_SOLARIS_THREADS case); reformat code and comments. * os_dep.c [!OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32 && !AMIGA && !OPENBSD && !DYNAMIC_LOADING && GC_DONT_REGISTER_MAIN_STATIC_DATA && !PCR && MACOS && !THINK_C && __MWERKS__ && M68K] (GC_register_data_segments): Merge GC_add_roots_inner() calls for adjacent data regions. * os_dep.c [!OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32 && !AMIGA && !OPENBSD && !DYNAMIC_LOADING && GC_DONT_REGISTER_MAIN_STATIC_DATA && !PCR && MACOS && !THINK_C && __MWERKS__] (GC_register_data_segments): Check POWERPC instead of __POWERPC__.
* Fix a typo in GC_register_data_segments comment (MacOS)Ivan Maidanski2023-02-031-1/+1
| | | | | | | * os_dep.c [!OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32 && !AMIGA && !OPENBSD && !PCR && MACOS && !THINK_C && __MWERKS__ && !__POWERPC__ && __option(far_data)] (GC_register_data_segments): Fix typo in comment ("the").
* Fix 'unresolved _end' linker error when targeting Android bitcodeJonathan Chambers2023-02-031-1/+5
| | | | | | | | | | | | | | | (cherry-pick of 0a5a808 from Unity-Technologies/bdwgc) If GC_DONT_REGISTER_MAIN_STATIC_DATA is defined but DYNAMIC_LOADING is not, GC_register_data_segments will never be called. However, the function was still present and referenced symbols not present when targeting bitcode. If the linker did not remove the dead function, linker errors occurred. Stub an empty function in this case. * os_dep.c [!OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32 && !AMIGA && !OPENBSD && !DYNAMIC_LOADING && GC_DONT_REGISTER_MAIN_STATIC_DATA] (GC_register_data_segments): Change to no-op (do not use DATASTART and DATAEND symbols).
* Use __builtin_frame_address(0) to find main stack base on QNXMario Topf2023-02-021-0/+11
| | | | | | | | | | | | | | | | | (cherry-pick of 544ba4d, ef9684c from Unity-Technologies/bdwgc) The proposed alternate approach (QNX_STACKBOTTOM) to find stack bottom (base) of the primordial thread is not very exact but it works for the tests, at least, unlike other available heuristics (e.g., HEURISTIC1). * include/private/gcconfig.h [QNX] (HEURISTIC1): Do not define if QNX_STACKBOTTOM; add TODO item. * os_dep.c [QNX_STACKBOTTOM] (GC_qnx_main_stack_base): New function (calls __builtin_frame_address(0)); add TODO item. * os_dep.c [!STACKBOTTOM && !HEURISTIC1 && QNX_STACKBOTTOM] (GC_get_main_stack_base): Call GC_qnx_main_stack_base(). Co-authored-by: Mario Hoepfner <mario.hopfner@unity3d.com>
* Remove unused DCL_LOCK_STATEIvan Maidanski2023-01-301-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * alloc.c (GC_set_disable_automatic_collection, GC_set_stop_func, GC_get_disable_automatic_collection, GC_get_stop_func, GC_set_start_callback, GC_get_start_callback, GC_set_on_collection_event, GC_get_on_collection_event, GC_collect_a_little, GC_try_to_collect_general, GC_expand_hp): Remove DCL_LOCK_STATE. * alloc.c [!GC_DISABLE_INCREMENTAL] (GC_start_incremental_collection): Likewise. * dbg_mlc.c (GC_generate_random_backtrace, store_debug_info, GC_debug_register_displacement): Likewise. * dyn_load.c [DARWIN_DEBUG && !NO_DEBUGGING] (GC_dyld_image_add, GC_dyld_image_remove): Likewise. * finalize.c (GC_register_disappearing_link_inner, GC_unregister_disappearing_link, GC_complete_ongoing_collection, GC_set_toggleref_func, GC_get_toggleref_func, GC_toggleref_add, GC_set_await_finalize_proc, GC_get_await_finalize_proc, GC_unregister_long_link, GC_move_disappearing_link, GC_move_long_link, GC_register_finalizer_inner, GC_finalize, GC_invoke_finalizers, GC_notify_or_invoke_finalizers): Likewise. * fnlz_mlc.c (GC_init_finalized_malloc): Likewise. * gc_dlopen.c [!USE_PROC_FOR_LIBRARIES] (disable_gc_for_dlopen): Likewise. * gcj_mlc.c (GC_init_gcj_malloc, maybe_finalize, GC_core_gcj_malloc, GC_debug_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise. * malloc.c (GC_alloc_large, GC_generic_malloc_inner, GC_generic_malloc_aligned, GC_malloc_kind_global, GC_generic_malloc_uncollectable, GC_free): Likewise. * mallocx.c (GC_realloc, GC_generic_malloc_ignore_off_page, GC_generic_malloc_many): Likewise. * mark.c (GC_print_trace): Likewise. * mark_rts.c (GC_add_roots, GC_clear_roots, GC_remove_roots): Likewise. * misc.c (GC_get_heap_usage_safe, GC_get_heap_usage_safe, GC_is_init_called, GC_init, GC_enable_incremental, GC_start_mark_threads, GC_set_warn_proc, GC_get_warn_proc, GC_set_abort_func, GC_get_abort_func, GC_enable, GC_disable, GC_new_free_list, GC_new_kind, GC_new_proc, GC_call_with_alloc_lock, GC_dump, GC_get_memory_use, GC_alloc_lock, GC_set_on_thread_event, GC_get_on_thread_event, GC_set_oom_fn, GC_get_oom_fn, GC_set_on_heap_resize, GC_get_on_heap_resize, GC_set_finalizer_notifier, GC_get_finalizer_notifier, GC_set_all_interior_pointers): Likewise. * obj_map.c (GC_register_displacement): Likewise. * os_dep.c (GC_get_stack_base, GC_print_callers): Likewise. * pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD] (GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended): Likewise. * pthread_support.c (GC_is_thread_tsd_valid, GC_thread_is_registered, GC_register_altstack, GC_wait_for_gc_completion, GC_init_parallel, GC_do_blocking_inner, GC_suspend_self_blocked, GC_get_my_stackbottom, GC_call_with_gc_active, GC_unregister_my_thread, GC_pthread_cancel, GC_pthread_exit, GC_allow_register_threads, GC_register_my_thread, GC_thread_exit_proc, GC_pthread_join, GC_pthread_detach, GC_start_rtn_prepare_thread): Likewise. * ptr_chck.c (GC_set_same_obj_print_proc, GC_get_same_obj_print_proc, GC_set_is_valid_displacement_print_proc, GC_set_is_visible_print_proc, GC_get_is_valid_displacement_print_proc, GC_get_is_visible_print_proc): Likewise. * reclaim.c (GC_print_all_errors): Likewise. * typd_mlc.c (GC_add_ext_descriptor, GC_make_descriptor, GC_malloc_explicitly_typed_ignore_off_page, GC_calloc_explicitly_typed): Likewise. * alloc.c (GC_max_retries): Change type from GC_word to word. * include/private/gc_locks.h: Remove DCL_LOCK_STATE from comment, * include/private/gc_locks.h (DCL_LOCK_STATE): Do not define.
* Fix typos in comments and documentation (regarding 'it is')Ivan Maidanski2023-01-171-1/+1
| | | | | | | | | | | | * ChangeLog (4.3): Fix typo ("it's"). * doc/platforms/README.amiga (GC_AMIGA_GC): Likewise. * extra/AmigaOS.c (GC_amiga_allocwrapper_any): Fix typo in comment ("it's"). * malloc.c (GC_free): Likewise. * new_hblk.c (GC_build_fl): Likewise. * os_dep.c [DATASTART_USES_BSDGETDATASTART] (GC_FreeBSDGetDataStart): Likewise. * reclaim.c (GC_start_reclaim): Likewise.
* Fix 'ISO C90 forbids mixed decl and code' warning in SOFT_VDB dirty_initIvan Maidanski2023-01-011-2/+2
| | | | | | | | | (fix of commits dc98162d7) Issue #265 (bdwgc). * os_dep.c [SOFT_VDB && MPROTECT_VDB] (GC_dirty_init): Move assertions about GC lock and soft_vdb_buf down (to be after char *str).
* Remove OpenBSD uthreads (GC_OPENBSD_UTHREADS) supportGreg Steuck2022-11-251-60/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #512 (bdwgc). Userland threads were replaced by rthreads on OpenBSD about a decade ago. Prior to OpenBSD 5.2 release (2012), the OS had user threads and required special handling. * include/private/gc_priv.h [GC_OPENBSD_THREADS && !GC_USESIGRT_SIGNALS] (SIG_SUSPEND): Do not check GC_OPENBSD_UTHREADS (assume not defined). * include/private/gcconfig.h [OPENBSD] (NEED_FIND_LIMIT): Likewise. * include/private/gcconfig.h [PTHREAD_STOP_WORLD_IMPL && !NACL] (SIGNAL_BASED_STOP_WORLD): Likewise. * os_dep.c [OPENBSD] (GC_register_data_segments): Likewise. * pthread_stop_world.c (GC_usleep, GC_suspend_all, GC_stop_world, GC_start_world, GC_stop_init): Likewise. * tests/initfromthread.c (main): Likewise. * include/private/gcconfig.h [GC_OPENBSD_THREADS && OpenBSD<201211] (GC_OPENBSD_UTHREADS): Do not define. * os_dep.c [OPENBSD && GC_OPENBSD_UTHREADS]: Do not include sys/syscall.h. * os_dep.c [OPENBSD && GC_OPENBSD_UTHREADS] (__syscall): Do not declare. * os_dep.c [OPENBSD && GC_OPENBSD_UTHREADS] (GC_find_limit_openbsd): Remove. * os_dep.c [NEED_FIND_LIMIT || USE_PROC_FOR_LIBRARIES && THREADS] (GC_find_limit_with_bound): Move comment from GC_find_limit_openbsd. * pthread_stop_world.c [!NACL && GC_OPENBSD_UTHREADS]: Do not include pthread_np.h. Co-authored-by: Kurt Miller <bsdkurt@gmail.com>
* Make Emscripten Asyncify feature optionalJukka Jylanki2022-11-241-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #506 (bdwgc). "-sASYNCIFY" is a relatively rarely used feature of Emscripten, most developers do not use it, and it does not scale well to moderate-to-large codebases. It incurs a heavy impact to code size and performance, and carries other correctness problems that developers must then adhere to regarding event loop message ordering. This commit provides new option in cmake (-Denable_emscripten_asyncify) and configure (--enable-emscripten-asyncify) scripts to turn on Emscripten Asyncify feature on demand. * CMakeLists.txt (enable_emscripten_asyncify): New option (off by default). * CMakeLists.txt (EMSCRIPTEN): Define using check_c_source_compiles. * CMakeLists.txt [EMSCRIPTEN && enable_emscripten_asyncify] (EMSCRIPTEN_ASYNCIFY): Define C macro. * CMakeLists.txt [EMSCRIPTEN && enable_emscripten_asyncify] (CMAKE_EXE_LINKER_FLAGS): Append "-sASYNCIFY" and "-sASYNCIFY_STACK_SIZE=128000". * configure.ac (emscripten): Remove quotes for the error directive message. * configure.ac [emscripten] (gc_cflags): Move comment and assignment down (to be after reporting result for emscripten). * configure.ac (emscripten-asyncify): New AC_ARG_ENABLE option; add comment. * configure.ac [enable_emscripten_asyncify && emscripten] (gc_cflags): Add -D EMSCRIPTEN_ASYNCIFY; remove space after "-s". * configure.ac [emscripten] (gc_cflags): Append "-sASYNCIFY" and "-sASYNCIFY_STACK_SIZE=128000" only if enable_emscripten_asyncify. * doc/README.macros (EMSCRIPTEN_ASYNCIFY): Document. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN]: Make USE_EMSCRIPTEN_SCAN_STACK has effect only if EMSCRIPTEN_ASYNCIFY. * os_dep.c [THREADS && EMSCRIPTEN]: Include emscripten.h only if EMSCRIPTEN_ASYNCIFY. * os_dep.c [THREADS && EMSCRIPTEN] (scan_regs_cb, GC_default_push_other_roots): Define as a function only if EMSCRIPTEN_ASYNCIFY; update comment. Co-authored-by: Ivan Maidanski <ivmai@mail.ru>
* Fix call to undeclared function emscripten_scan_registersIvan Maidanski2022-11-231-0/+2
| | | | | | | | | | (fix of commit e4247e8e3) Issue #504 (bdwgc). * os_dep.c [!THREADS && EMSCRIPTEN]: Include emscripten.h. Co-authored-by: Jukka Jylanki <jujjyl@gmail.com>
* Use emscripten_stack_get_base instead of emscripten_scan_stackJukka Jylanki2022-11-221-9/+20
| | | | | | | | | | | | | | | | | | | | | | | | Issue #504 (bdwgc). Simplify obtaining the stack base for Emscripten by using the direct emscripten_stack_get_base(), instead of the ASYNCIFY-only emscripten_scan_stack(). The previous variant of getting the stack base (using emscripten_scan_stack function) is still available, it could be chosen by passing -D USE_EMSCRIPTEN_SCAN_STACK to CFLAGS. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN]: Include emscripten.h only if USE_EMSCRIPTEN_SCAN_STACK; add comment. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN] (emscripten_stack_base, scan_stack_cb): Define only if USE_EMSCRIPTEN_SCAN_STACK. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN && !USE_EMSCRIPTEN_SCAN_STACK]: Include emscripten/stack.h. * os_dep.c [!ECOS && !NOSYS && !SYMBIAN && EMSCRIPTEN] (GC_get_main_stack_base): Call emscripten_stack_get_base() instead of emscripten_scan_stack(scan_stack_cb) unless USE_EMSCRIPTEN_SCAN_STACK is defined.
* Fix missing getpagesize() definition on OS/2 for usage by valloc()Ivan Maidanski2022-11-011-3/+20
| | | | | | | | | | | | | | | | | | | | | (fix of commit d4c81638d) Issue #495 (bdwgc). * include/private/gcconfig.h [I386 && OS2] (GETPAGESIZE): Define to os2_getpagesize. * os_dep.c [OS2] (INCL_DOSERRORS): Reorder among INCL_x defines lexicographically. * tools/setjmp_t.c [OS2] (INCL_DOSERRORS): Likewise. * os_dep.c [OS2] (INCL_DOSFILEMGR, INCL_DOSMISC): Define (before include os2.h). * os_dep.c [!MSWIN32 && !MSWINCE && !CYGWIN32 && OS2] (os2_getpagesize): New static function (code copied mostly from getpagesize() in setjmp_t.c). * tools/setjmp_t.c [OS2]: Update comment and move close to os2_getpagesize(). * tools/setjmp_t.c [OS2] (getpagesize): Make static and rename to os2_getpagesize.
* Remove trailing dot in WARN messagesIvan Maidanski2022-11-011-4/+4
| | | | | | | | | | | | | | | | | (refactoring) Also, polish some WARN messages in GC_init. * allchblk.c (GC_allochblk_nth): Place space at the beginning of the 2nd half of the WARN message string literal (instead of the end of the 1st half). * misc.c (GC_init): Likewise. * os_dep.c [GWW_VDB] (GC_gww_read_dirty): Likewise. * misc.c (GC_init): Remove trailing dot in WARN message; adjust (make uniform) WARN message about ignoring the value. * os_dep.c [MPROTECT_VDB && DARWIN && BROKEN_EXCEPTION_HANDLING] (GC_dirty_init): No not break WARN message string literal into two parts unnecessarily.
* Refine WARN message in GC_proc_read_dirty regarding buffer sizeIvan Maidanski2022-11-011-1/+1
| | | | | | | (refactoring) * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Refine message of WARN(GC_proc_buf_size).
* Fix negative heap size values reported in WARNIvan Maidanski2022-11-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #496 (bdwgc). WARN_PRIuPTR is now used to print unsigned values in WARN() calls. Also, byte values are replaced with KiB ones in some WARN() calls. * allchblk.c (GC_allochblk_nth): Use WARN_PRIuPTR specifier instead of WARN_PRIdPTR. * alloc.c (GC_expand_hp_inner, GC_collect_or_expand): Likewise. * headers.c (GC_scratch_alloc): Likewise. * mark.c (alloc_mark_stack): Likewise. * misc.c (GC_enable): Likewise. * os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Likewise. * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Likewise. * win32_threads.c (GC_delete_thread): Likewise. * allchblk.c (GC_allochblk_nth): Print KiB value instead of in bytes in WARN message. * alloc.c (GC_expand_hp_inner): Likewise. * misc.c (GC_enable): Likewise. * alloc.c (GC_expand_hp_inner): Remove unneeded cast of bytes to word. * headers.c (GC_scratch_alloc): Likewise. * alloc.c [(!AMIGA || !GC_AMIGA_FASTALLOC) && USE_MUNMAP] (GC_collect_or_expand): Add assertion to indicate that there is no underflow in GC_heapsize-GC_unmapped_bytes. * include/private/gc_priv.h (WARN): Update comment. * include/private/gc_priv.h [!WARN_PRIdPTR] (WARN_PRIuPTR): Define.
* Define public GC_[p]valloc() and redirect to them in leak_detector.hIvan Maidanski2022-10-281-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #495 (bdwgc). * doc/README.macros (GC_NO_VALLOC): Document. * doc/leak.md: Mention GNU valloc and pvalloc functions. * include/gc/gc.h (GC_memalign): Remove comment that it is not tested; add comment describing the functionality and a note. * include/gc/gc.h [!GC_NO_VALLOC] (GC_valloc, GC_pvalloc): Declare new API function. * include/gc/leak_detector.h [!GC_NO_VALLOC] (valloc, pvalloc): Redefine to the corresponding GC_ function. * include/private/gc_priv.h (GC_page_size): Add comment. * include/private/gc_priv.h (GC_real_page_size): Declare new variable (or as a macro). * include/private/gcconfig.h [NACL] (GETPAGESIZE): Add TODO item. * mallocx.c (GC_memalign): Likewise. * tests/gctest.c (run_one_test): Likewise. * include/private/gcconfig.h [CYGWIN32 && (MPROTECT_VDB || USE_MUNMAP) || !MSWIN32 && !MSWINCE && !CYGWIN32 && (GC_DISABLE_INCREMENTAL || DEFAULT_VDB) && !USE_MMAP] (ALT_PAGESIZE_USED): Define macro. * include/private/gcconfig.h [CYGWIN32 && (MPROTECT_VDB || USE_MUNMAP) || !MSWIN32 && !MSWINCE && !CYGWIN32 && (GC_DISABLE_INCREMENTAL || DEFAULT_VDB) && !USE_MMAP && !GC_NO_VALLOC] (REAL_PAGESIZE_NEEDED): Likewise. * mallocx.c (GC_strdup): Reformat comment. * mallocx.c [!GC_NO_VALLOC] (GC_valloc, GC_pvalloc): Implement. * os_dep.c [REAL_PAGESIZE_NEEDED] (GC_real_page_size): Define variable. * os_dep.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_setpagesize): Replace CYGWIN32&&(MPROTECT_VDB||USE_MUNMAP) to ALT_PAGESIZE_USED; remove comment that a separate variable could be added; reformat comment; assert about GC_pagesize only if REAL_PAGESIZE_NEEDED. * os_dep.c [ALT_PAGESIZE_USED && REAL_PAGESIZE_NEEDED] (GC_setpagesize): Set GC_real_page_size. * os_dep.c [!MSWIN32 && !MSWINCE && !CYGWIN32] (GC_setpagesize): Replace MPROTECT_VDB||PROC_VDB||SOFT_VDB||USE_MMAP to !ALT_PAGESIZE_USED. * tests/gctest.c [!GC_NO_VALLOC] (run_one_test): Call GC_valloc() and GC_pvalloc().
* Prevent use of redirected posix_memalign in GC_haiku_get_memIvan Maidanski2022-10-251-0/+3
| | | | | | | (fix of commit 847927f0e) * os_dep.c [HAIKU && GC_LEAK_DETECTOR_H] (posix_memalign): Undefine it (just in case leak_detector.h was accidentally included before).
* Define GC_GLIBC_PREREQ internal macroIvan Maidanski2022-10-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * dyn_load.c [(SCO_ELF || DGUX || HURD || NACL || __ELF__ && (LINUX || FREEBSD || NETBSD || OPENBSD)) && !USE_PROC_FOR_LIBRARIES && !HAVE_DL_ITERATE_PHDR] (HAVE_DL_ITERATE_PHDR): Replace __GLIBC__>2||__GLIBC__==2&&__GLIBC_MINOR__>2 to GC_GLIBC_PREREQ(2,3). * dyn_load.c [(SCO_ELF || DGUX || HURD || NACL || __ELF__ && (LINUX || FREEBSD || NETBSD || OPENBSD)) && !USE_PROC_FOR_LIBRARIES && __GLIBC__==2 && __GLIBC_MINOR__==2 && DT_CONFIG && !HAVE_DL_ITERATE_PHDR] (HAVE_DL_ITERATE_PHDR): Do not define. * include/private/gcconfig.h [LINUX]: Move include features.h upper (to be before GC_GLIBC_PREREQ); add TODO item; refine comment. * include/private/gcconfig.h (GC_GLIBC_PREREQ): Define macro. * include/private/gcconfig.h [(M68K || I386 || ARM32) && LINUX && __ELF__]: Replace defined(__GLIBC__)&&__GLIBC__>=2 to GC_GLIBC_PREREQ(2,0). * include/private/gcconfig.h [MIPS && LINUX]: Replace __GLIBC__>2||__GLIBC__==2&&__GLIBC_MINOR__>=2 to GC_GLIBC_PREREQ(2,2). * include/private/gcconfig.h [MPROTECT_VDB && __GLIBC__]: Replace __GLIBC__<2||__GLIBC__==2&&__GLIBC_MINOR__<2 to !GC_GLIBC_PREREQ(2,2). * malloc.c [REDIRECT_MALLOC && GC_LINUX_THREADS && __GLIBC__] (GC_init_lib_bounds): Replace __GLIBC__<2||__GLIBC__==2&&__GLIBC_MINOR__<34 to !GC_GLIBC_PREREQ(2,34). * os_dep.c [(I386 && SAVE_CALL_CHAIN || SPARC) && LINUX]: Do not include features.h.
* Eliminate 'parameter can be declared as const pointer' cppcheck warningsIvan Maidanski2022-10-201-6/+5
| | | | | | | | | | | | | | | | | | (refactoring) * allchblk.c (free_list_index_of): Add const to pointer argument. * backgraph.c (is_in_progress): Likewise. * include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32] (GC_is_heap_base): Likewise. * os_dep.c [USE_WINALLOC && !REDIRECT_MALLOC] (GC_is_malloc_heap_base): Likewise. * os_dep.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_is_heap_base): Likewise. * os_dep.c [CHECKSUMS && (GWW_VDB || SOFT_VDB) || PROC_VDB] (GC_or_pages): Likewise. * finalize.c (GC_grow_table): Add const to entries_ptr argument. * os_dep.c [USE_WINALLOC && !REDIRECT_MALLOC] (GC_is_malloc_heap_base): Change while loop to for.
* Abort with appropriate message if first call of mmap fails with EPERMIvan Maidanski2022-10-191-1/+2
| | | | | | | | | | | | | (fix of commit 1c62b365b) This is observed on Linux, at least. * os_dep.c [!OS2 && !PCR && !AMIGA && !USE_WINALLOC && !MACOS && !DOS4GW && !NINTENDO_SWITCH && !NONSTOP && !SN_TARGET_ORBIS && !SN_TARGET_PS3 && !SN_TARGET_PSP2 && !RTEMS && !__CC_ARM && MMAP_SUPPORTED && !MSWIN_XBOX1] (GC_unix_mmap_get_mem): Call ABORT() if allocation failed and GC_pages_executable and last_addr==HEAP_START and errno is EPERM.
* Adjust comments referring glibc versionIvan Maidanski2022-10-191-2/+2
| | | | | | | | | | | | | | | | | (documentation) * include/private/gcconfig.h [X86_64 && LINUX && __GLIBC__ && !__UCLIBC__ && !GETCONTEXT_FPU_BUG_FIXED]: Lower case "glibc" word in comment. * os_dep.c [LINUX_STACKBOTTOM && IA64 && USE_LIBC_PRIVATES] (GC_get_register_stack_base): Likewise. * include/private/gcconfig.h [X86_64 && LINUX && __GLIBC__ && !__UCLIBC__ && !GETCONTEXT_FPU_BUG_FIXED]: Remove "v" belonging to glibc version in comment. * os_dep.c [LINUX_STACKBOTTOM && IA64] (GC_linux_main_stack_base): Add a trailing dot after glibc version in comment. * pthread_support.c [GLIBC_2_1_MUTEX_HACK] (mark_mutex): Add a space before glibc version in comment.
* Remove private pthread_stop_world.h and darwin_stop_world.hIvan Maidanski2022-10-031-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * Makefile.direct (SRCS): Remove pthread_stop_world.h and darwin_stop_world.h items. * include/include.am (dist_noinst_HEADERS): Likewise. * darwin_stop_world.c [!GC_NO_THREADS_DISCOVERY && MPROTECT_VDB] (GC_darwin_register_mach_handler_thread): Change to no-argument GC_darwin_register_self_mach_handler(). * include/private/darwin_stop_world.h: Remove. * include/private/pthread_stop_world.h: Likewise. * include/private/gc_priv.h [GC_DARWIN_THREADS && MPROTECT_VDB] (GC_mprotect_stop, GC_mprotect_resume): Move declaration from darwin_stop_world.h. * include/private/gc_priv.h [GC_DARWIN_THREADS && MPROTECT_VDB && !GC_NO_THREADS_DISCOVERY] (GC_darwin_register_mach_handler_thread): Move declaration from darwin_stop_world.h and change to GC_darwin_register_self_mach_handler(). * include/private/pthread_support.h [GC_DARWIN_THREADS]: Move include of mach.h and thread_act.h from darwin_stop_world.h. * include/private/pthread_support.h [GC_DARWIN_THREADS]: Do not include darwin_stop_world.h. * os_dep.c [GC_DARWIN_THREADS && MPROTECT_VDB]: Likewise. * include/private/pthread_support.h [GC_DARWIN_THREADS] (thread_stop_info, GC_FindTopOfStack, GC_is_mach_marker): Move from darwin_stop_world.h. * include/private/pthread_support.h [!GC_DARWIN_THREADS && PTHREAD_STOP_WORLD_IMPL]: Do not include pthread_stop_world.h. * include/private/pthread_support.h [!GC_DARWIN_THREADS && PTHREAD_STOP_WORLD_IMPL] (thread_stop_info, GC_stop_init): Move from pthread_stop_world.h. * os_dep.c [MPROTECT_VDB && DARWIN && THREADS && !GC_NO_THREADS_DISCOVERY] (GC_mprotect_thread): Call GC_darwin_register_self_mach_handler() instead of GC_darwin_register_mach_handler_thread(mach_thread_self()).
* Define internal macro NO_SEH_AVAILABLE where SEH is absentIvan Maidanski2022-09-271-8/+5
| | | | | | | | | | | | | | | (refactoring) * include/private/gc_priv.h [WRAP_MARK_SOME]: Replace !MSWIN32&&!MSWINCE||__GNUC__ to NO_SEH_AVAILABLE in ifdef. * mark.c [WRAP_MARK_SOME] (GC_mark_some): Likewise. * os_dep.c [WRAP_MARK_SOME] (GC_fault_handler_t, GC_jmp_buf): Likewise. * include/private/gcconfig.h [!MSWIN32 && !MSWINCE || __GNUC__ || NO_CRT] (NO_SEH_AVAILABLE): Define. * mark.c [WRAP_MARK_SOME] (GC_mark_some): Refine comments. * os_dep.c (MIN_PAGE_SIZE): Define regardless of WRAP_MARK_SOME. * win32_threads.c (GC_win32_start_inner): Replace !__GNUC__&&!NO_CRT to !NO_SEH_AVAILABLE in ifdef.
* Fix missing recovery from faults in GC_mark_some on Win64 if MinGWIvan Maidanski2022-09-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #454 (bdwgc). This fixes rare SIGSEGV events in GC_mark_some on Windows (and Wine) when Windows asynchronously removes some temporary data roots if the collector is built e.g. with a MinGW-w64 compiler. Now, on Windows, the faults are caught by setjmp/longjmp if SEH is not supported by the compiler. Also, the asm-based implementation of SEH faults handling for x86 is deleted (thus, no specific handling of x86 any more) because it relied on a certain compilation mode (that the standard function prologue is generated and frame pointer is not omitted). * include/private/gc_priv.h [WRAP_MARK_SOME && __GNUC__] (GC_jmp_buf, GC_setup_temporary_fault_handler, GC_reset_fault_handler): Declare. * include/private/gcconfig.h [(MSWIN32 || MSWINCE) && !NO_CRT && !NO_WRAP_MARK_SOME] (WRAP_MARK_SOME): Define regardless of __GNUC__ and I386; remove FIXME item; update TODO item. * mark.c [__MINGW32__ && !__MINGW_EXCPT_DEFINE_PSDK && __i386__] (__MINGW_EXCPT_DEFINE_PSDK): Do not define; remove comment. * mark.c [MSWIN32 && __GNUC__]: Do not include excpt.h. * mark.c [WRAP_MARK_SOME] (GC_mark_some_inner): Update comment. * mark.c [WRAP_MARK_SOME && (MSWIN32 || MSWINCE) && __GNUC__] (ext_ex_regn): Remove type declaration. * mark.c [WRAP_MARK_SOME && (MSWIN32 || MSWINCE) && __GNUC__] (mark_ex_handler): Remove static function. * mark.c [WRAP_MARK_SOME] (GC_mark_some): Update comment (remove exact versions of Windows). * mark.c [WRAP_MARK_SOME && (MSWIN32 || MSWINCE) && __GNUC__] (GC_mark_some): Use GC_setup_temporary_fault_handler, SETJMP() and GC_reset_fault_handler instead of asm-based emulation of __try/except. * mark.c [WRAP_MARK_SOME && (!MSWIN32 && !MSWINCE || __GNUC__) && !DEFAULT_VDB] (GC_mark_some): WARN() only if USE_PROC_FOR_LIBRARIES. * mark.c [WRAP_MARK_SOME && !MSWIN32 && !MSWINCE] (GC_mark_some): Remove rm_handler label (call GC_reset_fault_handler on handle_ex instead). * mark.c [WRAP_MARK_SOME && !MSWIN32 && !MSWINCE && __GNUC__ && GC_WIN32_THREADS && !GC_PTHREADS] (GC_mark_some): Call GC_started_thread_while_stopped() (after GC_reset_fault_handler). * mark.c [WRAP_MARK_SOME && GC_WIN32_THREADS && !GC_PTHREADS] (GC_mark_some): Define handle_thr_start label regardless of MSWIN32 and MSWINCE. * mark.c [WRAP_MARK_SOME] (GC_mark_some): Return FALSE instead of setting ret_val to FALSE and going to rm_handler (because GC_reset_fault_handler is already called). * os_dep.c [WRAP_MARK_SOME && __GNUC__] (GC_fault_handler_t): Define type. * os_dep.c [WRAP_MARK_SOME && __GNUC__] (GC_set_and_save_fault_handler, GC_jmp_buf, GC_fault_handler, GC_setup_temporary_fault_handler, GC_reset_fault_handler): Define.
* Include stdio.h and stdlib.h only from gc_priv.hIvan Maidanski2022-09-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * allchblk.c: Do not include stdio.h directly. * alloc.c: Likewise. * dyn_load.c [(DYNAMIC_LOADING || MSWIN32 || MSWINCE || CYGWIN32) && !PCR]: Likewise. * mach_dep.c [!PLATFORM_MACH_DEP && !SN_TARGET_PSP2]: Likewise. * malloc.c: Likewise. * mallocx.c: Likewise. * mark.c: Likewise. * mark_rts.c: Likewise. * misc.c: Likewise. * new_hblk.c: Likewise. * os_dep.c: Likewise. * reclaim.c: Likewise. * tests/disclaim_bench.c: Likewise. * tests/gctest.c: Likewise. * dbg_mlc.c [KEEP_BACK_PTRS && !LINT2]: Do not include stdlib.h directly. * dyn_load.c [MSWIN32 || MSWINCE || CYGWIN32]: Likewise. * os_dep.c [HAIKU]: Likewise. * pthread_support.c [GC_PTHREADS && !GC_WIN32_THREADS]: Likewise. * tests/disclaim_bench.c: Likewise. * tests/gctest.c [!mips || !SYSTYPE_BSD43]: Likewise. * thread_local_alloc.c: Likewise. * include/private/gc_priv.h: Include stdio.h.
* Adjust naming of Win32/64 and x86/64 words in comments and documentationIvan Maidanski2022-09-261-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ChangeLog: Replace i386 and X86 to x86; replace x86_64 and amd64 to x64; replace "Win32 pthreads" to pthreads-win32; lower case win32s, x86, x64; replace win32 to Win32; replace "MS Windows" to Windows (in documentation and comments). * NT_MAKEFILE: Likewise. * README.md: Likewise. * configure.ac: Likewise. * cord/tests/de_win.c: Likewise. * doc/README.macros: Likewise. * doc/README.solaris2: Likewise. * doc/README.win32: Likewise. * doc/README.win64: Likewise. * doc/debugging.md: Likewise. * doc/leak.md: Likewise. * doc/overview.md: Likewise. * doc/porting.md: Likewise. * extra/msvc_dbg.c: Likewise. * finalize.c: Likewise. * include/gc/cord.h: Likewise. * include/gc/gc.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * include/private/pthread_stop_world.h: Likewise. * mach_dep.c: Likewise. * mark.c: Likewise. * mark_rts.c: Likewise. * misc.c: Likewise. * os_dep.c: Likewise. * tools/threadlibs.c: Likewise. * win32_threads.c: Likewise. * cord/tests/de.c (WIN32): Remove misleading comment. * misc.c (GC_enable_incremental): Change comment about win32s to TODO item.
* Use cast to void instead of the attribute to indicate unused argumentsIvan Maidanski2022-09-151-21/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * CMakeLists.txt [BORLAND] (add_compile_options): Remove "/w-par"; reorder options. * CMakeLists.txt [!BORLAND && MSVC] (add_compile_options): Remove "/wd4100"; update comment. * NT_MAKEFILE (.c.obj): Likewise. * allchblk.c [!NO_DEBUGGING || GC_ASSERTIONS] (add_hb_sz): Use UNUSED_ARG() instead of GC_ATTR_UNUSED. * allchblk.c [USE_MUNMAP] (GC_adjust_num_unmapped): Likewise. * backgraph.c [MAKE_BACK_GRAPH] (pop_in_progress, reset_back_edge, update_max_height): Likewise. * checksums.c [CHECKSUMS] (GC_add_block): Likewise. * darwin_stop_world.c (GC_stack_range_for): Likewise. * dbg_mlc.c (GC_store_debug_info_inner, GC_debug_change_stubborn, GC_check_heap_block): Likewise. * finalize.c [!GC_NO_FINALIZATION] (GC_null_finalize_mark_proc): Likewise. * gcj_mlc.c [GC_GCJ_SUPPORT] (GC_gcj_fake_mark_proc): Likewise. * mallocx.c [!CPPCHECK] (GC_change_stubborn): Likewise. * mark.c (GC_noop6, clear_marks_for_block): Likewise. * mark.c [WRAP_MARK_SOME && (MSWIN32 || MSWINCE) && __GNUC__] (mark_ex_handler): Likewise. * mark.c [GC_DISABLE_INCREMENTAL] (GC_push_conditional): Likewise. * mark_rts.c (GC_push_current_stack, GC_push_roots): Likewise. * misc.c (GC_default_oom_fn, GC_set_handle_fork): Likewise. * misc.c [THREADS && !SIGNAL_BASED_STOP_WORLD] (GC_set_suspend_signal, GC_set_thr_restart_signal): Likewise. * misc.c [THREADS && UNIX_LIKE && !NO_GETCONTEXT] (callee_saves_pushed_dummy_fn): Likewise. * misc.c [!THREADS] (GC_do_blocking_inner): Likewise. * misc.c [!PARALLEL_MARK] (GC_set_markers_count): Likewise. * os_dep.c [OPENBSD] (GC_fault_handler_openbsd): Likewise. * os_dep.c [NEED_FIND_LIMIT || WRAP_MARK_SOME && !MSWIN32 && !MSWINCE || USE_PROC_FOR_LIBRARIES && THREADS] (GC_fault_handler): Likewise. * os_dep.c [!HAVE_GET_STACK_BASE && !NEED_FIND_LIMIT] (GC_get_stack_base): Likewise. * os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise_state, catch_exception_raise_state_identity, catch_exception_raise): Likewise. * pthread_stop_world.c [!NACL && !GC_OPENBSD_UTHREADS && !SUSPEND_HANDLER_NO_CONTEXT] (GC_suspend_sigaction): Likewise. * pthread_stop_world.c [!NACL && !GC_OPENBSD_UTHREADS] (GC_suspend_handler_inner): Likewise. * pthread_support.c (GC_do_blocking_inner): Likewise. * pthread_support.c [GC_ENABLE_SUSPEND_THREAD && SIGNAL_BASED_STOP_WORLD] (GC_suspend_self_blocked): Likewise. * tests/gctest.c [!DBG_HDRS_ALL] (fail_proc1): Likewise. * tests/gctest.c [(MSWIN32 && !__MINGW32__ || MSWINCE) && !NO_WINMAIN_ENTRY] (WinMain): Likewise. * tests/gctest.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && RTEMS] (Init): Likewise. * tests/gctest.c [GC_WIN32_THREADS && !GC_PTHREADS] (thr_run_one_test): Likewise. * tests/gctest.c [MSWINCE] (thr_window): Likewise. * tests/gctest.c [GC_PTHREADS] (thr_run_one_test): Likewise. * typd_mlc.c (GC_array_mark_proc): Likewise. * win32_threads.c (GC_register_altstack, GC_do_blocking_inner): Likewise. * win32_threads.c [!GC_PTHREADS && !GC_NO_THREADS_DISCOVERY] (GC_DllMain): Likewise. * cord/cordxtra.c (CORD_ATTR_UNUSED): Remove. * include/private/gc_priv.h [!GC_ATTR_UNUSED] (GC_ATTR_UNUSED): Likewise. * cord/cordxtra.c (CORD_nul_func): Cast unused argument to void instead of using CORD_ATTR_UNUSED. * cord/cordxtra.c [!GC_NO_FINALIZATION] (CORD_lf_close_proc): Likewise. * include/private/gc_priv.h [!UNUSED_ARG] (UNUSED_ARG): Define macro.
* Remove duplicate check of MSWIN_XBOX1 in os_dep.cIvan Maidanski2022-08-031-1/+1
| | | | | | | | | (fix of commit ad3409469) Issue #173 (bdwgc). * os_dep.c [!MSWIN_XBOX1 && !MSWINCE && USE_WINALLOC]: Do not check whether MSWIN_XBOX1 is defined.
* Use modHBLKSZ where possibleIvan Maidanski2022-08-031-2/+2
| | | | | | | | | | | | | | | | | | | | | (refactoring) * allchblk.c (GC_remove_from_fl_at, GC_add_to_fl, GC_get_first_part): Replace v&(HBLKSIZE-1) to modHBLKSZ(v). * allchblk.c [!GC_DISABLE_INCREMENTAL] (GC_allochblk_nth): Likewise. * include/private/gc_priv.h (HBLKDISPL): Likewise. * include/private/gc_hdrs.h (MAX_JUMP): Remove spaces in HBLKSIZE-1 (to match similar expressions). * include/private/gc_priv.h (OBJ_SZ_TO_BLOCKS_CHECKED): Likewise. * misc.c (block_add_size): Likewise. * os_dep.c [!MSWIN_XBOX1 && !MSWINCE && (USE_WINALLOC || CYGWIN32)] (GC_win32_get_mem): Likewise. * include/private/gc_priv.h (HBLKMASK): Remove. * include/private/gc_priv.h (obj_link): Remove extra space in the expression. * malloc.c (GC_generic_malloc_uncollectable): Replace (word)op&(HBLKSIZE-1) to HBLKDISPL(op). * mallocx.c (GC_realloc): Replace HBLKMASK to (HBLKSIZE-1).
* Define macros in gcconfig.h to use sigaction for SIGSEGV and SIGBUSIvan Maidanski2022-07-061-54/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * include/private/gcconfig.h [FREEBSD || HAIKU || HURD || IRIX5 || NETBSD || OPENBSD || OSF1 || SUNOS5SIGS] (USE_SEGV_SIGACT): New macro. * include/private/gcconfig.h [IRIX5 && _sigargs || FREEBSD && SUNOS5SIGS || HPUX || HURD || NETBSD] (USE_BUS_SIGACT): Likewise. * os_dep.c [NEED_FIND_LIMIT || UNIX_LIKE || WRAP_MARK_SOME && !MSWIN32 && !MSWINCE]: Replace SUNOS5SIGS || IRIX5 || OSF1 || HAIKU || HURD || FREEBSD || NETBSD to USE_SEGV_SIGACT. * os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE || WRAP_MARK_SOME && !MSWIN32 && !MSWINCE) && USE_SEGV_SIGACT] (old_segv_act): Do not define if OPENBSD. * os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE || WRAP_MARK_SOME && !MSWIN32 && !MSWINCE) && USE_SEGV_SIGACT]: Replace _sigargs || HPUX || HURD || NETBSD || FREEBSD to USE_BUS_SIGACT. * os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE || WRAP_MARK_SOME && !MSWIN32 && !MSWINCE) && !USE_SEGV_SIGACT] (old_segv_handler): Rename to old_segv_hand. * os_dep.c [(NEED_FIND_LIMIT || UNIX_LIKE || WRAP_MARK_SOME && !MSWIN32 && !MSWINCE) && !USE_SEGV_SIGACT && HAVE_SIGBUS] (old_bus_handler): Rename to old_bus_hand. * os_dep.c [MPROTECT_VDB && !DARWIN]: Replace FREEBSD || HPUX || HURD to USE_BUS_SIGACT.
* Define SUNOS5SIGS macro for kFreeBSDIvan Maidanski2022-07-061-7/+1
| | | | | | | | | | | | | | (fix of commit 8bb9205df) Issue #184 (bdwgc). * include/private/gcconfig.h [MPROTECT_VDB && (__GLIBC__<2 || __GLIBC__==2 && __GLIBC_MINOR__<2)]: Move error directive from os_dep.c. * include/private/gcconfig.h [FREEBSD && __GLIBC__] (SUNOS5SIGS): Define. * os_dep.c [MPROTECT_VDB && !DARWIN && FREEBSD] (GC_dirty_init): Do not check __GLIBC__.
* Do not set SIGBUS handler to catch write faults on LinuxIvan Maidanski2022-07-051-14/+6
| | | | | | | | | | GC_write_fault_handler() does not handle SIGBUS on Linux as SIG_OK is false for the signal. Thus, no need to setup the handler. * os_dep.c [MPROTECT_VDB && !DARWIN] (GC_old_bus_handler): Do not define if LINUX. * os_dep.c [MPROTECT_VDB && !DARWIN] (GC_dirty_init): Do not call sigaction(SIGBUS) and do not set GC_old_bus_handler if LINUX.
* Revert "Remove nested always-false ifdef for HPUX and FREEBSD"Ivan Maidanski2022-07-051-3/+5
| | | | | | | This reverts commit 2a420e272d9f036130fbf95a359fb4140ff11da3. The reason: SUNOS5SIGS is defined for HP/UX and some flavors of FreeBSD.
* Refine comments in code regarding DllMain-based threads registrationIvan Maidanski2022-05-301-0/+1
| | | | | | | | | | | * include/gc/gc.h (GC_use_threads_discovery): Refine comment (mention GC_register_my_thread and GC_init). * os_dep.c [MSWIN32 || MSWINCE] (GC_get_stack_base): Add comment about the GC lock. * win32_threads.c (GC_CreateThread): Add comment about GC_init_parallel if GC_win32_dll_threads set by GC_use_threads_discovery(). * win32_threads.c [!GC_PTHREADS && !GC_NO_THREADS_DISCOVERY] (GC_DllMain): Add more comments for DLL_THREAD_ATTACH case.
* Update copyright information in alloc.c and other modified files (2022)Ivan Maidanski2022-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * CMakeLists.txt: Update year in copyright comment (2021 to 2022). * alloc.c: Likewise. * configure.ac: Likewise. * dyn_load.c: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * mallocx.c: Likewise. * mark.c: Likewise. * mark_rts.c: Likewise. * misc.c: Likewise. * os_dep.c: Likewise. * pthread_support.c: Likewise. * reclaim.c: Likewise. * tests/gctest.c: Likewise. * win32_threads.c: Likewise. * LICENSE: Update year (2021 to 2022). * allchblk.c: Add copyright line in header comment. * darwin_stop_world.c: Likewise. * dbg_mlc.c: Likewise. * gcj_mlc.c: Likewise. * headers.c: Likewise. * include/gc/gc_inline.h: Likewise. * include/gc/gc_mark.h: Likewise. * include/private/gc_locks.h: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/pthread_stop_world.h: Likewise. * include/private/pthread_support.h: Likewise. * mach_dep.c: Likewise. * malloc.c: Likewise. * thread_local_alloc.c: Likewise. * typd_mlc.c: Likewise. * finalize.c: Update year in copyright comment (2020 to 2022). * include/gc/gc.h: Likewise. * pthread_stop_world.c: Likewise.
* Replace comments about GC is held or not with relevant assertionsIvan Maidanski2022-05-111-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * alloc.c (GC_default_stop_func): Refine comment about the allocation lock. * alloc.c (GC_finish_collection): Remove comment that the allocation lock is held because the assertion about it already exists. * finalize.c (GC_grow_table, GC_mark_fo, GC_finalize): Likewise. * finalize.c [!GC_MOVE_DISAPPEARING_LINK_NOT_NEEDED] (GC_move_disappearing_link_inner): Likewise. * mark.c (GC_mark_some_inner): Likewise. * mark.c [PARALLEL_MARK] (GC_do_parallel_mark): Likewise. * os_dep.c [OPENBSD && GC_OPENBSD_UTHREADS] (GC_find_limit_openbsd, GC_skip_hole_openbsd): Likewise. * os_dep.c [NEED_FIND_LIMIT || USE_PROC_FOR_LIBRARIES && THREADS] (GC_find_limit_with_bound): Likewise. * os_dep.c (GC_register_data_segments): Likewise. * os_dep.c [MPROTECT_VDB || PROC_VDB || SOFT_VDB] (GC_dirty_init): Likewise. * pthread_stop_world.c (GC_start_world): Likewise. * pthread_support.c (GC_new_thread): Likewise. * thread_local_alloc.c (return_freelists): Likewise. * win32_threads.c (GC_new_thread, GC_lookup_thread_inner, GC_delete_gc_thread_no_free): Likewise. * blacklst.c (GC_promote_black_lists): Remove comment that the allocation lock is held, and add the corresponding assertion to the beginning of the function. * blacklst.c [!PARALLEL_MARK] (GC_add_to_black_list_normal, GC_add_to_black_list_stack): Likewise. * darwin_stop_world.c (GC_stop_world, GC_start_world): Likewise. * mark_rts.c (GC_remove_root_at_pos, GC_remove_roots_inner, GC_exclude_static_roots_inner): Likewise. * pthread_stop_world.c (GC_push_all_stacks, GC_suspend_all): Likewise. * pthread_support.c (GC_check_finalizer_nested): Likewise. * thread_local_alloc.c (GC_destroy_thread_local): Likewise. * win32_threads.c (GC_check_finalizer_nested, GC_push_all_stacks): Likewise. * blacklst.c (GC_is_black_listed): Refine comment about the allocation lock. * darwin_stop_world.c (GC_push_all_stacks): Add assertion that the lock is held on entrance. * gcj_mlc.c (maybe_finalize): Likewise. * malloc.c [THREADS] (GC_free_inner): Likewise. * dyn_load.c (GC_dyld_image_add, GC_dyld_image_remove, GC_init_dyld): Remove comment the allocation lock should not be held, and add the corresponding assertion to the beginning of the function. * finalize.c (GC_invoke_finalizers): Likewise. * mark.c [PARALLEL_MARK] (GC_help_marker): Likewise. * pthread_support.c (GC_init_parallel): Likewise. * win32_threads.c (GC_lookup_pthread, GC_init_parallel): Likewise. * finalize.c (GC_finalize_all): Remove comment that the lock is not held on entrance. * gcj_mlc.c (GC_init_gcj_malloc): Likewise. * typd_mlc.c (GC_add_ext_descriptor): Likewise. * include/gc/javaxfc.h (GC_finalize_all): Add comment the function acquires the allocation lock. * mallocx.c (GC_generic_malloc_many): Adjust comment about GC lock. * new_hblk.c (GC_build_fl): Likewise. * pthread_support.c (GC_new_thread): Move the assertion about the allocation lock closer to the beginning of the function. * win32_threads.c (GC_new_thread): Likewise.
* Remove extra space after comma in license termsIvan Maidanski2022-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (reformatting) * CMakeLists.txt: Remove an extra space after comma in license header comment. * Makefile.am: Likewise. * allchblk.c: Likewise. * alloc.c: Likewise. * backgraph.c: Likewise. * blacklst.c: Likewise. * checksums.c: Likewise. * configure.ac: Likewise. * cord/cordbscs.c: Likewise. * cord/cordprnt.c: Likewise. * cord/cordxtra.c: Likewise. * cord/tests/cordtest.c: Likewise. * cord/tests/de.c: Likewise. * cord/tests/de_cmds.h: Likewise. * cord/tests/de_win.c: Likewise. * cord/tests/de_win.h: Likewise. * cord/tests/de_win.rc: Likewise. * darwin_stop_world.c: Likewise. * dbg_mlc.c: Likewise. * dyn_load.c: Likewise. * extra/gc.c: Likewise. * extra/msvc_dbg.c: Likewise. * extra/pcr_interface.c: Likewise. * extra/real_malloc.c: Likewise. * finalize.c: Likewise. * fnlz_mlc.c: Likewise. * gc_badalc.cc: Likewise. * gc_cpp.cc: Likewise. * gc_dlopen.c: Likewise. * gcj_mlc.c: Likewise. * headers.c: Likewise. * include/gc/cord.h: Likewise. * include/gc/cord_pos.h: Likewise. * include/gc/ec.h: Likewise. * include/gc/gc.h: Likewise. * include/gc/gc_backptr.h: Likewise. * include/gc/gc_config_macros.h: Likewise. * include/gc/gc_disclaim.h: Likewise. * include/gc/gc_gcj.h: Likewise. * include/gc/gc_inline.h: Likewise. * include/gc/gc_mark.h: Likewise. * include/gc/gc_pthread_redirects.h: Likewise. * include/gc/gc_tiny_fl.h: Likewise. * include/gc/gc_typed.h: Likewise. * include/gc/gc_version.h: Likewise. * include/gc/javaxfc.h: Likewise. * include/gc/leak_detector.h: Likewise. * include/include.am: Likewise. * include/private/darwin_semaphore.h: Likewise. * include/private/darwin_stop_world.h: Likewise. * include/private/dbg_mlc.h: Likewise. * include/private/gc_alloc_ptrs.h: Likewise. * include/private/gc_atomic_ops.h: Likewise. * include/private/gc_hdrs.h: Likewise. * include/private/gc_locks.h: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * include/private/pthread_stop_world.h: Likewise. * include/private/pthread_support.h: Likewise. * include/private/specific.h: Likewise. * include/private/thread_local_alloc.h: Likewise. * m4/gc_set_version.m4: Likewise. * mach_dep.c: Likewise. * malloc.c: Likewise. * mallocx.c: Likewise. * mark.c: Likewise. * mark_rts.c: Likewise. * misc.c: Likewise. * new_hblk.c: Likewise. * obj_map.c: Likewise. * os_dep.c: Likewise. * pthread_start.c: Likewise. * pthread_stop_world.c: Likewise. * pthread_support.c: Likewise. * ptr_chck.c: Likewise. * reclaim.c: Likewise. * specific.c: Likewise. * tests/atomicops.c: Likewise. * tests/cpp.cc: Likewise. * tests/disclaim.c: Likewise. * tests/disclaim_bench.c: Likewise. * tests/gctest.c: Likewise. * tests/tests.am: Likewise. * tests/weakmap.c: Likewise. * thread_local_alloc.c: Likewise. * tools/setjmp_t.c: Likewise. * tools/threadlibs.c: Likewise. * typd_mlc.c: Likewise. * win32_threads.c: Likewise. * LICENSE: Remove an extra space after comma in license terms.
* Remove extra parentheses in return statementIvan Maidanski2022-05-011-28/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) Also, replace 0 to NULL where appropriate. * allchblk.c (setup_header, GC_get_first_part, GC_allochblk_nth): Remove outermost parentheses in the expression of return statement. * alloc.c (GC_never_stop_func, GC_timeout_stop_func, GC_adj_bytes_allocd, GC_try_to_collect_inner, GC_collect_a_little, GC_stopped_mark, GC_try_to_collect_general, GC_expand_hp_inner, GC_collect_or_expand, GC_allocobj): Likewise. * blacklst.c (GC_is_black_listed, GC_number_stack_black_listed, total_stack_black_listed): Likewise. * checksums.c (GC_checksum): Likewise. * cord/cordbscs.c (CORD_cat_char_star, CORD_cat, CORD_len, CORD_index_access_fn, CORD_apply_access_fn, CORD_substr_checked, CORD_substr, CORD_iter5, CORD_iter, CORD_riter4, CORD_riter, CORD_concat_forest, CORD_balance, CORD__pos_fetch, CORD__prev, CORD_prev, CORD_pos_to_cord, CORD_pos_valid): Likewise. * cord/cordprnt.c (extract_conv_spec, CORD_vsprintf, CORD_sprintf, CORD_fprintf, CORD_vfprintf, CORD_printf, CORD_vprintf): Likewise. * cord/cordxtra.c (CORD_cat_char, CORD_catn, CORD_fill_proc, CORD_batched_fill_proc, CORD_cmp, CORD_ncmp, CORD_to_char_star, CORD_from_char_star, CORD_to_const_char_star, CORD_fetch, CORD_put_proc, CORD_batched_put_proc, CORD_put, CORD_chr_proc, CORD_rchr_proc, CORD_batched_chr_proc, CORD_chr, CORD_rchr, CORD_str, CORD_from_file_eager, CORD_lf_func, CORD_from_file_lazy_inner, CORD_from_file_lazy, CORD_from_file): Likewise. * cord/tests/cordtest.c (test_fn, id_cord_fn, test_basics): Likewise. * cord/tests/de.c (line_pos, add_hist, retrieve_line, beep): Likewise. * cord/tests/de_win.c (WinMain, plain_chars, control_chars, WndProc): Likewise. * dbg_mlc.c (store_debug_info, GC_debug_generic_malloc, GC_debug_generic_malloc, GC_debug_realloc, GC_make_closure): Likewise. * dyn_load.c (GC_FirstDLOpenedLinkMap): Likewise. * extra/real_malloc.c (real_malloc): Likewise. * finalize.c (GC_register_disappearing_link, GC_unregister_disappearing_link): Likewise. * gc_dlopen.c (dlopen): Likewise. * gcj_mlc.c (maybe_finalize, GC_debug_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise. * headers.c (GC_find_header, alloc_hdr, get_index, GC_install_header, GC_next_block, GC_prev_block): Likewise. * malloc.c (GC_generic_malloc): Likewise. * mallocx.c (GC_realloc, GC_generic_malloc_ignore_off_page): Likewise. * mark.c (GC_collection_in_progress, GC_mark_some, GC_signal_mark_stack_overflow, GC_block_was_dirty, GC_push_next_marked, GC_push_next_marked_dirty, GC_push_next_marked_uncollectable): Likewise. * mark_rts.c (GC_is_static_root, rt_hash, GC_roots_present, GC_remove_tmp_roots, GC_approx_sp): Likewise. * misc.c (GC_default_oom_fn, GC_clear_stack_inner, GC_base, GC_write, GC_get_warn_proc, GC_call_with_alloc_lock): Likewise. * new_hblk.c (GC_build_fl_clear2, GC_build_fl_clear4, GC_build_fl2, GC_build_fl4, GC_build_fl): Likewise. * obj_map.c (GC_register_displacement_inner): Likewise. * os_dep.c (GC_find_limit_openbsd, GC_skip_hole_openbsd, GC_get_writable_length, GC_get_writable_length, GC_get_main_stack_base, GC_FreeBSDGetDataStart, GC_unix_mmap_get_mem, GC_unix_sbrk_get_mem, os2_alloc, GC_wince_get_mem, GC_win32_get_mem, GC_push_thread_stack, GC_push_old_obj, GC_write_fault_handler, catch_exception_raise_state, catch_exception_raise_state_identity): Likewise. * pthread_support.c (GC_new_thread, GC_lookup_thread, GC_get_nprocs, pthread_sigmask, pthread_create): Likewise. * ptr_chck.c (GC_same_obj, GC_default_is_visible_print_proc, GC_default_is_valid_displacement_print_proc, GC_is_visible, GC_pre_incr, GC_post_incr): Likewise. * reclaim.c (GC_block_empty, GC_reclaim_uninit, GC_n_set_marks, GC_reclaim_all): Likewise. * tests/cpp.cc (main): Likewise. * tests/gctest.c (fake_gcj_mark_proc, reverse1, reverse, ints, gcj_reverse1, gcj_reverse, gcj_ints, uncollectable_ints, mktree, alloc8bytes, main, test): Likewise. * tools/if_mach.c (main): Likewise. * tools/if_not_there.c (main): Likewise. * tools/setjmp_t.c (getpagesize, main, g): Likewise. * typd_mlc.c (GC_add_ext_descriptor, GC_add_ext_descriptor, GC_double_descr, GC_make_array_descriptor, GC_make_sequence_descriptor, GC_typed_mark_proc, GC_descr_obj_size, GC_push_complex_descriptor, GC_array_mark_proc, GC_make_descriptor, GC_calloc_explicitly_typed): Likewise. * win32_threads.c (GC_new_thread, GC_lookup_thread_inner, GC_get_stack_min, GC_pthread_create, GC_pthread_start_inner): Likewise. * allchblk.c (GC_get_first_part, GC_allochblk_nth): Replace 0 to NULL where appropriate. * alloc.c (GC_allocobj): Likewise. * blacklst.c (GC_is_black_listed): Likewise. * cord/cordbscs.c (CORD_from_fn_inner, CORD_substr_checked): Likewise. * cord/cordxtra.c (CORD_cat_char, CORD_to_char_star, CORD_from_char_star, CORD_lf_func, CORD_from_file_lazy_inner): Likewise. * dbg_mlc.c (store_debug_info, GC_debug_generic_malloc, GC_debug_generic_malloc): Likewise. * dyn_load.c (GC_FirstDLOpenedLinkMap): Likewise. * gcj_mlc.c (GC_debug_gcj_malloc): Likewise. * headers.c (GC_next_block, GC_prev_block): Likewise. * malloc.c (GC_generic_malloc, strdup): Likewise. * mallocx.c (GC_realloc): Likewise. * misc.c (GC_default_oom_fn, GC_base): Likewise. * os_dep.c (GC_get_main_stack_base, os2_alloc, GC_win32_get_mem): Likewise. * pthread_support.c (GC_new_thread, GC_lookup_thread): Likewise. * ptr_chck.c (GC_same_obj, GC_is_visible, GC_default_is_valid_displacement_print_proc): Likewise. * tests/gctest.c (mktree): Likewise. * typd_mlc.c (GC_make_array_descriptor, GC_push_complex_descriptor, GC_array_mark_proc, GC_calloc_explicitly_typed): Likewise. * win32_threads.c (GC_new_thread, GC_lookup_thread_inner): Likewise. * alloc.c (GC_never_stop_func, GC_timeout_stop_func): Replace 0 and 1 (in return statement) to FALSE and TRUE, respectively. * include/private/gcconfig.h: Remove outermost parentheses in the expression of return statement in comment.
* Adjust indentation in C preprocessor directivesIvan Maidanski2022-04-181-47/+45
| | | | | | | | | | | | | | | | | | | | | | | (reformatting) * cord/tests/de.c: Adjust indentation in directives. * cord/tests/de_win.c: Likewise. * dbg_mlc.c: Likewise. * dyn_load.c: Likewise. * extra/AmigaOS.c: Likewise. * include/gc/ec.h: Likewise. * include/gc/gc_tiny_fl.h: Likewise. * include/private/gc_locks.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * include/private/thread_local_alloc.h: Likewise. * malloc.c: Likewise. * mark.c: Likewise. * os_dep.c: Likewise. * ptr_chck.c: Likewise. * reclaim.c: Likewise. * tests/gctest.c: Likewise. * tools/threadlibs.c: Likewise.
* Define and use SIGNAL_BASED_STOP_WORLD macro internallyIvan Maidanski2022-03-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * include/private/gc_priv.h [!SIG_SUSPEND]: Check SIGNAL_BASED_STOP_WORLD macro instead of GC_PTHREADS, GC_WIN32_THREADS, NACL, GC_DARWIN_THREADS, GC_OPENBSD_UTHREADS, SN_TARGET_PSP2. * include/private/gcconfig.h [E2K || HP_PA || IA64 || M68K || NO_SA_SIGACTION] (SUSPEND_HANDLER_NO_CONTEXT): Likewise. * include/private/pthread_stop_world.h (thread_stop_info.last_stop_count): Likewise. * include/private/pthread_stop_world.h [GC_ENABLE_SUSPEND_THREAD] (suspend_self_inner): Likewise. * include/private/pthread_support.h [GC_ENABLE_SUSPEND_THREAD] (GC_Thread_Rep.suspended_ext): Likewise. * misc.c [THREADS] (GC_set_suspend_signal, GC_set_thr_restart_signal, GC_get_suspend_signal, GC_get_thr_restart_signal): Likewise. * os_dep.c [MPROTECT_VDB && !DARWIN && !MSWIN32 && !MSWINCE] (GC_dirty_init): Likewise. * pthread_support.c [PARALLEL_MARK && !NO_MARKER_SPECIAL_SIGMASK] (GC_start_mark_threads_inner): Likewise. * pthread_support.c [BASE_ATOMIC_OPS_EMULATED] (GC_thr_init): Likewise. * pthread_support.c [GC_ENABLE_SUSPEND_THREAD] (GC_register_my_thread): Likewise. * tests/gctest.c [GC_PTHREADS && GC_ENABLE_SUSPEND_THREAD && !GC_OSF1_THREADS] (fork_a_thread): Likewise. * include/private/gcconfig.h [GC_PTHREADS && !GC_DARWIN_THREADS && !GC_WIN32_THREADS && !PLATFORM_STOP_WORLD && !SN_TARGET_PSP2] (PTHREAD_STOP_WORLD_IMPL): Define. * include/private/gcconfig.h [PTHREAD_STOP_WORLD_IMPL && !NACL && !GC_OPENBSD_UTHREADS] (SIGNAL_BASED_STOP_WORLD): Likewise. * include/private/pthread_support.h [!GC_DARWIN_THREADS]: Include pthread_stop_world.h only if PTHREAD_STOP_WORLD_IMPL. * pthread_stop_world.c: Check PTHREAD_STOP_WORLD_IMPL macro instead of GC_PTHREADS, GC_WIN32_THREADS, GC_DARWIN_THREADS, PLATFORM_STOP_WORLD, SN_TARGET_PSP2.
* Replace GC_init_netbsd_elf with GC_init_linux_data_start on NetBSDIvan Maidanski2022-03-101-17/+12
| | | | | | | | | | | | | | | | | | | | | (refactoring) * include/private/gc_priv.h [NETBSD && __ELF__] (GC_init_netbsd_elf, GC_find_limit): Do not declare. * include/private/gcconfig.h [NETBSD && __ELF__] (GC_data_start): Likewise. * include/private/gcconfig.h [NETBSD && __ELF__] (DATASTART): Do not define. * include/private/gcconfig.h [NETBSD && __ELF__] (SEARCH_FOR_DATA_START): Define. * misc.c [NETBSD && __ELF__] (GC_init): Do not call GC_init_netbsd_elf. * os_dep.c [NETBSD] (environ): Declare C extern variable only if SEARCH_FOR_DATA_START (regardless of __ELF__). * os_dep.c [SEARCH_FOR_DATA_START && NETBSD] (GC_init_linux_data_start): Pass &environ to GC_find_limit (as in deleted GC_init_netbsd_elf) instead of data_end. * os_dep.c [NETBSD && __ELF__] (GC_data_start, GC_init_netbsd_elf): Do not define.
* Add assertion to ensure GC_unmapped_bytes cannot underflowIvan Maidanski2022-03-011-0/+2
| | | | | * os_dep.c [USE_MUNMAP] (GC_remap): Add assertion that GC_unmapped_bytes is not less than len.