summaryrefslogtreecommitdiff
path: root/mark.c
Commit message (Collapse)AuthorAgeFilesLines
* Make comparisons to the lowest heap boundary strictIvan Maidanski2023-05-131-8/+8
| | | | | | | | | | | | | | | | | | | | | | * alloc.c (GC_expand_hp_inner): Subtract sizeof(word) from new_limit (for the case when comparing to GC_least_plausible_heap_addr). * backgraph.c [MAKE_BACK_GRAPH] (add_back_edges): Compare current to GC_least_real_heap_addr and GC_greatest_real_heap_addr (instead of GC_least_plausible_heap_addr and GC_greatest_plausible_heap_addr). * malloc.c [GC_ASSERTIONS] (GC_malloc_kind_global): Likewise. * include/gc/gc_mark.h (GC_MARK_AND_PUSH): Replace greater-or-equal to strictly greater when comparing to GC_least_plausible_heap_addr. * include/private/gc_pmark.h (GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP): Likewise. * include/private/gc_priv.h [MAKE_BACK_GRAPH] (SET_REAL_HEAP_BOUNDS, GC_least_real_heap_addr, GC_greatest_real_heap_addr): Define. * mark.c (GC_mark_from, GC_push_all): Add dummy "| GC_DS_LENGTH" when storing length to mse_descr.w. * mark.c (GC_mark_from): Replace greater-or-equal to strictly greater when comparing to least_ha variable. * typd_mlc.c (GC_typed_mark_proc): Likewise. * mark.c [GC_DS_TAGS>ALIGNMENT-1] (GC_push_all): Simplify code to round up length.
* Fix comparisons to heap boundary in GC_get_back_ptr_info and GC_mark_fromIvan Maidanski2023-05-131-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The region delimited by GC_least_plausible_heap_addr and GC_greatest_plausible_heap_addr might contain part of static data roots or stacks (in addition to potential heap expansion areas). Certain comparisons in GC_get_back_ptr_info (when ALIGNMENT is 1) and in GC_mark_from (in assertions) expect the real heap boundaries. * alloc.c [SET_REAL_HEAP_BOUNDS] (GC_add_to_heap): Update GC_least_real_heap_addr and GC_greatest_real_heap_addr variables. * dbg_mlc.c [KEEP_BACK_PTRS && ALIGNMENT == 1] (GC_get_back_ptr_info): Compare alternate_target and target to GC_least_real_heap_addr and GC_greatest_real_heap_addr (instead of GC_least_plausible_heap_addr and GC_greatest_plausible_heap_addr). * include/gc/gc_mark.h (GC_greatest_plausible_heap_addr): Refine comment. * include/private/gc_priv.h [GC_ASSERTIONS || KEEP_BACK_PTRS && ALIGNMENT == 1] (SET_REAL_HEAP_BOUNDS): Define macro. * include/private/gc_priv.h [GC_ASSERTIONS || KEEP_BACK_PTRS && ALIGNMENT == 1] (GC_least_real_heap_addr, GC_greatest_real_heap_addr): Define (as macro). * include/private/gc_priv.h [GC_ASSERTIONS || KEEP_BACK_PTRS && ALIGNMENT == 1] (_GC_arrays._least_real_heap_addr, _GC_arrays._greatest_real_heap_addr): New field; add comment. * mark.c (GC_mark_from): Use GC_greatest_real_heap_addr and GC_least_real_heap_addr instead of GC_least_plausible_heap_addr and GC_greatest_plausible_heap_addr, respectively, in assertions.
* Fix assertion in GC_mark_from regarding GC_least_plausible_heap_addrIvan Maidanski2023-05-121-5/+6
| | | | | | | (fix of commit b21b53a35) * mark.c (GC_mark_from): Allow current_p (p->mse_start) plus descr to be equal to GC_least_plausible_heap_addr in assertion; add comment.
* Remove misleading comment in GC_obj_kinds for AUNCOLLECTABLE kindIvan Maidanski2023-04-101-1/+1
| | | | | | * mark.c [GC_ATOMIC_UNCOLLECTABLE] (GC_obj_kinds): Remove misleading comment ("add length to descr") for FALSE value (for ok_relocate_descr field).
* Minimize code difference between GC_push_marked/unconditionallyIvan Maidanski2023-04-101-29/+24
| | | | | | | | | | | | (refactoring) * mark.c (GC_push_marked): Rename GC_mark_stack_top_reg local variable to mark_stack_top; use conditional expression to set lim variable. * mark.c [ENABLE_DISCLAIM] (GC_push_unconditionally): Likewise. * mark.c (GC_push_marked): Move lim variable assignment to the place of its use. * mark.c [ENABLE_DISCLAIM] (GC_push_unconditionally): Reformat code to match that of GC_push_marked.
* Refine comparisons to GC_greatest_plausible_heap_addrIvan Maidanski2023-04-091-10/+9
| | | | | | | | | | | | | | | | | | GC_greatest_plausible_heap_addr should always be greater (strictly) than any address of a heap object. * backgraph.c (add_back_edges): Check that pointer is strictly less than GC_greatest_plausible_heap_addr (instead of less or equal). * dbg_mlc.c [KEEP_BACK_PTRS && ALIGNMENT==1] (GC_get_back_ptr_info): Likewise. * include/gc/gc_mark.h (GC_MARK_AND_PUSH): Likewise. * malloc.c (GC_malloc_kind_global): Likewise. * typd_mlc.c (GC_typed_mark_proc): Likewise. * include/gc/gc_mark.h (GC_greatest_plausible_heap_addr): Refine comment (that any object address is strictly less). * mark.c (GC_mark_from): Allow descr in assertions to be equal to GC_greatest_plausible_heap_addr-GC_least_plausible_heap_addr; reformat comment.
* Add callback API to support ephemeron markingJonathan Chambers2023-02-141-1/+35
| | | | | | | | | | | | | | | | | | | | | | (cherry-pick of 1a65adc, bb5ba42, 6f41d8d from Unity-Technologies/bdwgc) When ephemerons marking results in pushing a large number of objects, the mark stack may overflow. While the processing could be batched, the simplest approach is to allow the callback to return false to indicate a failure and increasing the mark stack size. * include/gc/gc_mark.h (GC_on_mark_stack_empty_proc): New public type. * include/gc/gc_mark.h (GC_set_on_mark_stack_empty, GC_get_on_mark_stack_empty): New public function declaration. * mark.c (GC_on_mark_stack_empty): New static variable. * mark.c (GC_set_on_mark_stack_empty, GC_get_on_mark_stack_empty): New function implementation. * mark.c (GC_mark_some_inner): If GC_on_mark_stack_empty is non-zero then call it and break if pushed new items or overflowed. * tests/gctest.c [GC_PTHREADS] (main): Call GC_set_on_mark_stack_empty and GC_get_on_mark_stack_empty. Co-authored-by: Ivan Maidanski <ivmai@mail.ru>
* Remove unused DCL_LOCK_STATEIvan Maidanski2023-01-301-2/+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.
* Check highest bit of word using SIGNB instead of cast to signed_wordIvan Maidanski2023-01-241-1/+1
| | | | | | | | | | | (refactoring) * allchblk.c (GC_merge_unmapped): Replace overflow check (signed_word)(sz1+sz2)>0 to !((sz1+sz2)&SIGNB). * allchblk.c (GC_freehblk): Likewise. * mark.c (GC_mark_from): Replace (signed_word)descr>=0 expression to !(descr&SIGNB). * ptr_chck.c (GC_is_visible): Likewise.
* Fix negative heap size values reported in WARNIvan Maidanski2022-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Replace WARN in GC_mark_some wrapper back to GC_COND_LOG_PRINTFIvan Maidanski2022-10-031-3/+3
| | | | | | | | Issue #454 (bdwgc). * mark.c [WRAP_MARK_SOME] (GC_mark_some): Use GC_COND_LOG_PRINTF() instead of WARN() to report caught ACCESS_VIOLATION; refine comment; add the GC number to the message reported by GC_COND_LOG_PRINTF.
* Do not wrap mark_some to catch faults if libraries registration is offIvan Maidanski2022-09-271-24/+28
| | | | | | * mark.c [WRAP_MARK_SOME] (GC_mark_some): Adjust code indentation; call GC_mark_some_inner() directly (w/o a wrapper) and do not WARN() if GC_no_dls.
* Define internal macro NO_SEH_AVAILABLE where SEH is absentIvan Maidanski2022-09-271-10/+10
| | | | | | | | | | | | | | | (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-118/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Avoid potential race between realloc and GC_block_was_dirtyIvan Maidanski2022-09-161-1/+7
| | | | | | | | | | | | | | GC_realloc might be changing the block size while GC_block_was_dirty is examining it. The change to the size field is benign, in that GC_block_was_dirty would work correctly with either value, since we are not changing the number of objects in the block. But seeing a half-updated value (though unlikely to occur in practice) could be probably bad. Using unordered atomic accesses on the size field should solve the issue. * mark.c [!GC_DISABLE_INCREMENTAL && AO_HAVE_load] (GC_block_was_dirty): Use AO_load() to get hhdr->hb_sz value; add comment.
* Use cast to void instead of the attribute to indicate unused argumentsIvan Maidanski2022-09-151-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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 redundant GC_ATTR_UNUSED for GC_mark_and_pushIvan Maidanski2022-09-151-3/+1
| | | | | | | (fix of commit 8d64dbd10) * mark.c (GC_mark_and_push): Remove unneeded GC_ATTR_UNUSED for src argument.
* Eliminate 'redundant redeclaration of GC_noop1' gcc warningIvan Maidanski2022-08-221-1/+1
| | | | | | | (fix of commit 2a52263b8) * include/private/gc_priv.h (GC_noop1): Remove declaration. * mark.c (GC_noop1): Change argument type from word to GC_word.
* Fix 'passing arg 1 of GC_apply_to_all_blocks from incompatible type' errorIvan Maidanski2022-08-051-1/+2
| | | | | | | | | | | | | | | | | | (fix of commit e717f1191) Issue #460 (bdwgc). * backgraph.c [MAKE_BACK_GRAPH] (per_object_helper): Add GC_CALLBACK modifier; change 2nd argument type from word to GC_word. * checksums.c [CHECKSUMS] (GC_add_block): Likewise. * dbg_mlc.c [!SHORT_DBG_HDRS] (GC_check_heap_block): Likewise. * mark.c (clear_marks_for_block): Likewise. * misc.c (block_add_size): Likewise. * reclaim.c (GC_reclaim_block, GC_print_block_descr, GC_do_enumerate_reachable_objects): Likewise. * checksums.c [CHECKSUMS] (GC_check_blocks): Remove unnecessary cast of zero to word. * include/gc/gc_mark.h (GC_apply_to_all_blocks): Add GC_ATTR_NONNULL(1).
* Eliminate ASan stack-buffer-underflow FP in GC_mark_and_push_stack (E2K)Ivan Maidanski2022-07-151-2/+4
| | | | | | | | | According to the contract, the object p (the argument of GC_mark_and_push_stack) has passed a preliminary pointer validity check, but we do not definitely know whether it is valid. * mark.c (GC_mark_and_push_stack): Add GC_ATTR_NO_SANITIZE_ADDR attribute.
* 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.
* Ensure GC is initialized when GC_push_all_stacks() is calledIvan Maidanski2022-05-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) Also, remove an unnecessary lock in GC pthread_create (of pthread_support.c), and ensure that GC_thr_init() is called only once. * alloc.c (GC_try_to_collect_inner, GC_collect_a_little_inner, GC_stopped_mark, GC_collect_or_expand, GC_allocobj): Add assertion that GC is initialized. * finalize.c (GC_register_disappearing_link_inner, GC_register_finalizer_inner): Likewise. * mark.c (GC_clear_marks, GC_initiate_gc): Likewise. * mark_rts.c (GC_push_roots): Likewise. * alloc.c (GC_collect_a_little): Call GC_init if GC is not initialized. * alloc.c (GC_expand_hp): Move part of comment to gc.h. * include/gc/gc.h (GC_expand_hp): Reformat comment. * darwin_stop_world.c (GC_push_all_stacks): Replace GC_init() call with the assertion that GC_thr_initialized. * pthread_stop_world.c (GC_push_all_stacks): Likewise. * pthread_support.c (pthread_create): Likewise. * darwin_stop_world.c (GC_stop_world): Add assertion that GC_thr_initialized. * pthread_stop_world.c (GC_stop_world): Likewise. * win32_threads.c (GC_push_all_stacks): Likewise. * finalize.c (GC_register_finalizer_inner): Add assertion (after LOCK) that obj points to the base address of the object. * include/private/pthread_support.h (GC_thr_initialized): Declare only if GC_ASSERTIONS. * pthread_support.c (GC_thr_initialized): Define only if GC_ASSERTIONS. * win32_threads.c (GC_thr_initialized): Likewise. * pthread_support.c (GC_thr_init): Add assertion that GC_thr_initialized is not set on entry; set GC_thr_initialized only if GC_ASSERTIONS. * win32_threads.c (GC_thr_init): Likewise. * pthread_support.c (pthread_create): Remove LOCK/UNLOCK around setup of si. * win32_threads.c (GC_stop_world): Replace ABORT (about GC_thr_initialized) with the assertion. * win32_threads.c (GC_CreateThread): Add assertion that GC_thr_initialized after GC_init_parallel() call. * win32_threads.c [!CYGWIN32 && !MSWINCE && !MSWIN_XBOX1 && !NO_CRT] (GC_beginthreadex): Likewise. * win32_threads.c [GC_PTHREADS] (GC_pthread_create): Likewise. * win32_threads.c [!CYGWIN32 && !MSWINCE && !MSWIN_XBOX1 && !NO_CRT] (GC_beginthreadex): Remove comment duplicating that in GC_CreateThread. * win32_threads.c [GC_PTHREADS] (GC_pthread_create): Likewise.
* Fix potential race if start_mark_threads called from threads in childIvan Maidanski2022-05-191-4/+1
| | | | | | | | | | | | | | | | | | | | | | There should be no race in setting GC_markers_m1 value even in case of a client calls GC_start_mark_threads() from multiple threads in a child process. * include/gc/gc.h (GC_start_mark_threads): Add comment that the allocation lock is acquired internally. * mark.c [PARALLEL_MARK] (GC_wait_for_markers_init): Change assertion from I_DONT_HOLD_LOCK to I_HOLD_LOCK. * pthread_support.c [PARALLEL_MARK] (GC_start_mark_threads_inner): Likewise. * win32_threads.c [PARALLEL_MARK] (GC_start_mark_threads_inner): Likewise. * mark.c [PARALLEL_MARK] (GC_wait_for_markers_init): Remove LOCK/UNLOCK around GC_add_to_our_memory() call. * misc.c [PARALLEL_MARK && GC_ASSERTIONS && GC_ALWAYS_MULTITHREADED] (GC_init): Remove UNLOCK/LOCK around GC_start_mark_threads_inner call. * misc.c [THREADS && PARALLEL_MARK && CAN_HANDLE_FORK && !THREAD_SANITIZER] (GC_start_mark_threads): Wrap GC_start_mark_threads_inner() call into LOCK/UNLOCK.
* Ensure GC_our_memory is updated while holding GC lockIvan Maidanski2022-05-191-1/+5
| | | | | | | | | | | | | | | | | | (refactoring) * alloc.c [USE_PROC_FOR_LIBRARIES] (GC_add_to_our_memory): Add assertion that the GC lock is held. * backgraph.c (new_back_edges): Likewise. * misc.c [GC_READ_ENV_FILE] (GC_envfile_init): Likewise. * mark.c [PARALLEL_MARK] (GC_wait_for_markers_init): Add assertion that the GC lock is not hold on entrance; wrap GC_add_to_our_memory() call into LOCK/UNLOCK. * mark.c [PARALLEL_MARK] (GC_do_parallel_mark): Move assertion about the GC lock to be the first statement. * misc.c [GC_ASSERTIONS && GC_ALWAYS_MULTITHREADED] (GC_init): Move the first call of LOCK() upper to be before GC_envfile_init(). * misc.c [LINT2] (GC_init): Set GC_dont_gc directly (instead of GC_disable() call) if GC_ASSERTIONS and GC_ALWAYS_MULTITHREADED.
* Replace comments about GC is held or not with relevant assertionsIvan Maidanski2022-05-111-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
* Add assertions about GC_mark_state to alloc.c and mark.cIvan Maidanski2022-05-061-6/+19
| | | | | | | | | | | | * alloc.c (GC_collect_a_little_inner): Add assertion the collection is not in progress; refine comment. * alloc.c (GC_stopped_mark): Add assertion about allowed GC_mark_state values on entry. * mark.c (GC_initiate_gc): Replace conditional abort with an assertion (about GC_mark_state value). * mark.c (GC_mark_some_inner): Add assertion about possible GC_mark_state values before every break in switch (i.e. on returning FALSE).
* Avoid code duplication regarding GC_push_roots in GC_mark_some_innerIvan Maidanski2022-05-051-25/+20
| | | | | | | | | | (refactoring) * mark.c (push_roots_and_advance): New static function (code copied from GC_mark_some). * mark.c (GC_mark_some_inner): Return TRUE if GC_mark_state is MS_NONE on entry; replace GC_push_roots() calls (and the related code) with push_roots_and_advance() ones.
* 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-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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-81/+80
| | | | | | | | | | | | | | | | | | | | | | | (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.
* Workaround TSan false positive in push_marked2/4Ivan Maidanski2022-04-011-0/+2
| | | | | | | * mark.c [!UNALIGNED_PTRS] (GC_push_marked2): Add GC_ATTR_NO_SANITIZE_THREAD attribute. * mark.c [!UNALIGNED_PTRS && GC_GRANULE_WORDS<4] (GC_push_marked4): Likewise.
* Workaround TSan FP in GC_finalized_malloc and GC_push_unconditionallyIvan Maidanski2022-03-311-0/+1
| | | | | * mark.c [ENABLE_DISCLAIM] (GC_push_unconditionally): Add GC_ATTR_NO_SANITIZE_THREAD attribute.
* Use AO primitive in GC_noop1 instead of no_sanitize attributeIvan Maidanski2022-03-231-3/+12
| | | | | | | | | This eliminates GCC TSan report about data race in GC_noop1. * mark.c [AO_HAVE_store && THREAD_SANITIZER] (GC_noop_sink): Use AO_t type instead of word. * mark.c (GC_noop1): Remove GC_ATTR_NO_SANITIZE_THREAD; refine comment. * mark.c [AO_HAVE_store && THREAD_SANITIZER] (GC_noop1): Use AO_store.
* Workaround TSan false positive in push_marked1 and ptr_store_and_dirtyIvan Maidanski2022-03-221-0/+1
| | | | | * mark.c [USE_PUSH_MARKED_ACCELERATORS] (GC_push_marked1): Add GC_ATTR_NO_SANITIZE_THREAD attribute.
* Always set only one bit past end in GC_set_hdr_marksIvan Maidanski2022-03-061-1/+6
| | | | | | | * mark.c [!USE_MARK_BYTES] (GC_set_hdr_marks): Add comments; do not put bits beyond a single one past FINAL_MARK_BIT(sz). * reclaim.c [!USE_MARK_BYTES && MARK_BIT_PER_OBJ] (GC_n_set_marks): Do not ignore part of last hb_marks[] element passed to count_ones().
* Eliminate '-pedantic is not option that controls warnings' GCC-6.3 messageIvan Maidanski2022-02-271-1/+1
| | | | | | | | | (fix of commit e0a3739fa) * mark.c [WRAP_MARK_SOME && (MSWIN32 || MSWINCE) && __GNUC__ && !__clang__ && GC_GNUC_PREREQ(6,0)] (GC_mark_some): Use pragma GCC diagnostic ignored "-Wpedantic" (instead of "-pedantic") starting from gcc-6.0 (not from gcc-6.4).
* Enable prefetch loop in GC_mark_from on E2KIvan Maidanski2022-01-191-3/+2
| | | | | | | Issue #411 (bdwgc). * mark.c [!SMALL_CONFIG && !USE_PTR_HWTAG] (GC_mark_from): Perform prefetching loop (even for E2K); remove TODO item.
* Fix assertions in alloc_mark_stack and gww_dirty_init for GWW_VDBIvan Maidanski2022-01-181-7/+10
| | | | | | | | | | | | | | (fix of commit f2a2e55e4) * include/private/gc_priv.h [MPROTECT_VDB && GWW_VDB] (GC_gww_dirty_init): Explicitly note that the caller may or may not hold the lock. * mark.c [GWW_VDB] (alloc_mark_stack): Move recycle_old and GC_incremental_at_stack_alloc local variable declarations to precede GC_ASSERT(). * mark.c [!GWW_VDB] (alloc_mark_stack): Do not define recycle_old. * os_dep.c [GWW_VDB] (GC_gww_dirty_init): Remove assertion about the lock; add comment.
* Add I_HOLD_LOCK assertion to scratch_alloc/recycle and their callersIvan Maidanski2022-01-171-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * allchblk.c (setup_header, GC_get_first_part, GC_allochblk_nth): Add assertion that the GC lock is held (I_HOLD_LOCK). * alloc.c (GC_add_to_heap, GC_scratch_recycle_inner): Likewise. * backgraph.c (push_in_progress, backwards_height): Likewise. * blacklst.c (GC_bl_init_no_interiors, GC_bl_init): Likewise. * dyn_load.c (GC_register_dynamic_libraries): Likewise. * finalize.c (push_and_mark_object): Likewise. * finalize.c [!GC_TOGGLE_REFS_NOT_NEEDED] (GC_mark_togglerefs): Likewise. * headers.c (GC_scratch_alloc, alloc_hdr, GC_init_headers, GC_install_header): Likewise. * include/private/gc_pmark.h (GC_MARK_FO): Likewise. * malloc.c (GC_alloc_reclaim_list): Likewise. * mark.c (GC_mark_some_inner, alloc_mark_stack): Likewise. * mark_rts.c [DYNAMIC_LOADING || MSWIN32 || MSWINCE || PCR || CYGWIN32] (GC_remove_tmp_roots): Likewise. * mark_rts.c (GC_cond_register_dynamic_libraries, GC_push_roots): Likewise. * obj_map.c [MARK_BIT_PER_GRANULE] (GC_add_map_entry): Likewise. * os_dep.c [NEED_PROC_MAPS && IA64] (backing_store_base_from_proc): Likewise. * os_dep.c [LINUX_STACKBOTTOM && IA64] (GC_get_register_stack_base): Likewise. * os_dep.c [MSWIN32] (GC_register_root_section): Likewise. * os_dep.c [!OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32] (GC_register_data_segments): Likewise. * os_dep.c [GWW_VDB] (GC_gww_dirty_init, GC_gww_read_dirty): Likewise. * os_dep.c (GC_dirty_init): Likewise. * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Likewise. * os_dep.c [SOFT_VDB] (soft_dirty_init, GC_soft_read_dirty): Likewise. * os_dep.c [!GC_DISABLE_INCREMENTAL] (GC_read_dirty): Likewise. * dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX] (GC_register_dynamic_libraries): Round up size of buf local variable to multiple of 8 bytes. * headers.c (GC_install_header): Use EXPECT(). * malloc.c (GC_alloc_reclaim_list): Likewise. * obj_map.c [MARK_BIT_PER_GRANULE] (GC_add_map_entry): Likewise. * mark_rts.c [DYNAMIC_LOADING || MSWIN32 || MSWINCE || PCR || CYGWIN32] (GC_remove_tmp_roots, GC_push_roots): Remove redundant comment. * misc.c [GC_ASSERTIONS && GC_ALWAYS_MULTITHREADED] (GC_init): Wrap calls of GC_get_main_stack_base(), GC_get_register_stack_base(), GC_init_headers(), GC_dirty_init(), GC_register_data_segments(), GC_bl_init(), GC_mark_init() into LOCK/UNLOCK. * os_dep.c [OPENBSD] (GC_skip_hole_openbsd): Move sysconf() call to be after the assertion that the GC lock is held. * os_dep.c [HPUX_STACKBOTTOM] (GC_get_register_stack_base): Add assertion that GC_stackbottom is set.
* Check pointer tag in all mark procedures (E2K)Ivan Maidanski2022-01-121-1/+2
| | | | | | | | | | | | | | | | | | | | | Issue #411 (bdwgc). Do not mark objects if its pointer tag is non-zero, not only in GC_mark_from and GC_push_all_eager, but also in add_back_edges, GC_ignore_self_finalize_mark_proc, GC_typed_mark_proc and GC_push_conditional_eager. * backgraph.c [MAKE_BACK_GRAPH] (add_back_edges): Change type of current_p local variable from word* to ptr_t. * typd_mlc.c (GC_typed_mark_proc): Likewise. * backgraph.c [MAKE_BACK_GRAPH] (add_back_edges): Use LOAD_WORD_OR_CONTINUE() instead of direct dereference of current_p. * finalize.c (GC_ignore_self_finalize_mark_proc): Likewise. * mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager): Likewise. * typd_mlc.c (GC_typed_mark_proc): Likewise. * finalize.c (GC_ignore_self_finalize_mark_proc): Rename q and r local variables to current_p and q, respectively.
* Support Elbrus 2000 (Linux/e2k)Ilya Kurdyukov2022-01-121-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (a port of altlinux libgc-e2k.patch (8ed786c)) Issue #411 (bdwgc). * include/gc/gc.h [__GNUC__ && !__INTEL_COMPILER && __e2k__] (GC_reachable_here): Specify "r" contraint for ptr. * include/gc/gc.h [__e2k__] (GC_stack_base): Declare reg_base field. * include/private/gc_priv.h [E2K] (GC_push_all_register_sections, GC_save_regs_in_stack, GC_get_procedure_stack): Declare. * include/private/gc_priv.h [E2K && __ptr64__] (LOAD_TAGGED_VALUE): Define macro. * include/private/gc_priv.h (LOAD_WORD_OR_CONTINUE): Likewise. * include/private/gcconfig.h [LINUX && __e2k__] (E2K, mach_type_known): Likewise. * include/private/gcconfig.h [E2K] (MACH_TYPE, CPP_WORDSZ, ALIGNMENT, HBLKSIZE): Likewise. * include/private/gcconfig.h [E2K && LINUX] (DATASTART): Likewise. * mach_dep.c [E2K] (VA_SIZE, E2K_PSHTP_SIZE, get_stack_index): Likewise. * include/private/gcconfig.h [GC_GNUC_PREREQ(2,8)] (HAVE_BUILTIN_UNWIND_INIT): Do not define if E2K. * include/private/gcconfig.h [E2K && LINUX] (__dso_handle): Declare extern variable. * include/private/pthread_support.h [E2K] (GC_Thread_Rep): Declare backing_store_end and backing_store_ptr fields. * mach_dep.c [E2K]: Include errno.h, sys/syscall.h, asm/e2k_syswork.h. * mach_dep.c [E2K] (e2k_rwap_lo_fields, e2k_rwap_hi_fields): Declare struct. * mach_dep.c [E2K] (e2k_rwap_lo_u, e2k_rwap_hi_u): Declare union. * mach_dep.c [E2K] (GC_get_procedure_stack, GC_save_regs_in_stack): Implement. * mach_dep.c [E2K] (GC_with_callee_saves_pushed): Call GC_save_regs_in_stack() (not saving the result). * mark.c (GC_mark_from, GC_push_all_eager): Use LOAD_WORD_OR_CONTINUE() instead of direct dereference of current_p. * mark.c [!SMALL_CONFIG] (GC_mark_from): Do not prefetch if E2K. * mark_rts.c [E2K] (GC_push_all_register_sections): Implement but ignore traced_stack_sect (add TODO item). * mark_rts.c [!THREADS && E2K] (GC_push_current_stack): Call GC_get_procedure_stack() and GC_push_all_register_sections(). * misc.c [E2K] (GC_call_with_stack_base): Initialize reg_base to 0. * misc.c [!THREADS && E2K] (GC_do_blocking_inner, GC_get_my_stackbottom): Likewise. * os_dep.c [((HAVE_PTHREAD_ATTR_GET_NP || HAVE_PTHREAD_GETATTR_NP) && THREADS || !HAVE_GET_STACK_BASE) && E2K] (GC_get_stack_base): Likewise. * pthread_support.c [E2K] (GC_get_my_stackbottom): Likewise. * pthread_stop_world.c [E2K] (GC_suspend_handler): Call GC_with_callee_saves_pushed(). * pthread_stop_world.c [E2K] (GC_store_stack_ptr): Call GC_save_regs_in_stack() and GC_get_procedure_stack(). * pthread_stop_world.c [E2K] (GC_suspend_handler_inner): Call free(me->backing_store_end) before return. * pthread_stop_world.c [E2K] (GC_push_all_stacks): Declare bs_lo, bs_hi, stack_size local variables; call GC_save_regs_in_stack() and GC_get_procedure_stack() (and free() at the end) for self thread; call GC_push_all_register_sections(). * pthread_support.c [E2K] (GC_do_blocking_inner): Call GC_save_regs_in_stack(); add FIXME.
* Change p local variable to current_p in push_all/conditional_eagerIvan Maidanski2021-10-151-16/+13
| | | | | | | | | (refactoring) * mark.c (GC_push_all_eager): Remove b, t local variables; change type of p local variable from word* to ptr_t; rename p to current_p. * mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager): Likewise.
* Print GC_gc_no always as unsigned long valueIvan Maidanski2021-09-221-16/+16
| | | | | | | | (refactoring) * include/private/gc_pmark.h [ENABLE_TRACE] (GC_push_contents_hdr): Print GC_gc_no as unsigned long (instead of unsigned int). * mark.c [ENABLE_TRACE] (GC_mark_from): Likewise.
* Adjust spaces around '=' in printed messagesIvan Maidanski2021-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * checksums.c (GC_check_blocks): Remove space before '=' and add a space (if missing) after '=' in printed message. * darwin_stop_world.c [DEBUG_THREADS_EXTRA] (GC_FindTopOfStack): Likewise. * dbg_mlc.c (GC_print_obj, GC_debug_print_heap_obj_proc): Likewise. * dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX || HPUX] (GC_register_dynamic_libraries): Likewise. [DEBUG_VIRTUALQUERY] (GC_dump_meminfo): Likewise. * os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Likewise. * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Likewise. * os_dep.c [SOFT_VDB] (soft_read_dirty): Likewise. * pthread_support.c (set_marker_thread_name, GC_start_mark_threads_inner): Likewise. * pthread_support.c [DEBUG_THREADS] (GC_delete_thread, GC_unregister_my_thread_inner, GC_unregister_my_thread, GC_thread_exit_proc, GC_start_rtn_prepare_thread): Likewise. * pthread_support.c [GC_LINUX_THREADS] (GC_get_nprocs): Likewise. * tests/disclaim_weakmap_test.c [DEBUG_DISCLAIM_WEAKMAP] (weakmap_add, weakmap_disclaim): Likewise. * tests/subthread_create.c (run_one_test): Likewise. * win32_threads.c (GC_delete_thread, GC_push_stack_for, GC_get_next_stack): Likewise. * darwin_stop_world.c [DEBUG_THREADS] (GC_stack_range_for): Remove '=' in printed message and/or improve message. * mark.c (GC_signal_mark_stack_overflow): Likewise. * mark_rts.c [!NO_DEBUGGING] (GC_print_static_roots): Likewise. * pthread_stop_world.c [DEBUG_THREADS] (GC_push_all_stacks, GC_suspend_all): Likewise. * pthread_support.c (GC_thr_init): Likewise. * tests/disclaim_test.c (pair_dct, pair_new): Likewise. * tests/disclaim_weakmap_test.c (pair_check_rec): Likewise. * tests/initsecondarythread.c (main): Likewise. * tests/subthread_create.c (entry, main): Likewise. * tests/test.c [THREADS] (fork_a_thread, main): Likewise. * tests/test.c [MSWINCE] (thr_window): Likewise. * tests/test.c [NTHREADS>0] (main): Likewise. * tests/threadkey_test.c (main): Likewise. * dyn_load.c [ALPHA && OSF1 && DL_VERBOSE] (GC_register_dynamic_libraries): Reformat printed messages. * tests/disclaim_test.c (main): Remove space after '#' in printed message.
* Move GC_scratch_recycle_inner() to alloc.c (refactoring)Ivan Maidanski2021-09-111-20/+0
| | | | | | | | | * alloc.c (GC_try_to_collect): Add blank line after comment (which relates not only to this function). * alloc.c (GC_add_to_heap): Declare as STATIC function; change definition from GC_INNER to STATIC; reformat comments. * alloc.c (GC_scratch_recycle_inner): Move function from mark.c. * include/private/gc_priv.h (GC_add_to_heap): Remove declaration.
* Update copyright information in alloc.c and other modified files (2021)Ivan Maidanski2021-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | | * README.QUICK (Copyright): Update year (2019 to 2020). * README.md (Copyright): Likewise. * alloc.c (Copyright, GC_copyright): Likewise. * configure.ac (Copyright): Likewise. * include/private/gc_priv.h (Copyright): Likewise. * mark.c (Copyright): Likewise. * misc.c (Copyright): Likewise. * os_dep.c (Copyright): Likewise. * pthread_support.c (Copyright): Likewise. * win32_threads.c (Copyright): Likewise. * CMakeLists.txt: Update (add Ivan Maidanski). * dyn_load.c (Copyright): Likewise. * include/private/gc_alloc_ptrs.h (Copyright): Likewise. * include/private/gcconfig.h (Copyright): Likewise. * mallocx.c (Copyright): Likewise. * mark_rts.c (Copyright): Likewise. * reclaim.c (Copyright): Likewise. * tests/test.c (Copyright): Likewise.
* Do not report 'Incremental GC incompatible' warning more than onceIvan Maidanski2021-09-041-1/+6
| | | | | | * mark.c [!MSWIN32 && !MSWINCE && !DEFAULT_VDB] (GC_mark_some): Define is_warned static variable; issue WARN about incremental GC incompatibility just once.
* Fall back to mprotect-based VDB at runtime if no soft-dirty bit in kernelIvan Maidanski2021-09-041-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #265 (bdwgc). * doc/README.environment (GC_USE_GETWRITEWATCH): Update documentation. * doc/README.macros (GC_PREFER_MPROTECT_VDB): Likewise. * include/private/gc_priv.h [!NO_VDB_FOR_STATIC_ROOTS && !PROC_VDB] (GC_is_vdb_for_static_roots): Declare GC_INNER function. * include/private/gcconfig.h [(I386 || POWERPC || X86_64) && LINUX && __GLIBC__ && !__UCLIBC__ && !SOFT_VDB && !DEFAULT_VDB]: Do not include linux/version.h if NO_SOFT_VDB. * include/private/gcconfig.h [(I386 || POWERPC || X86_64) && LINUX && __GLIBC__ && !__UCLIBC__ && !SOFT_VDB && !DEFAULT_VDB] (SOFT_VDB): Do not define if NO_SOFT_VDB; do not depend on GC_PREFER_MPROTECT_VDB. * include/private/gcconfig.h [MPROTECT_VDB && GC_PREFER_MPROTECT_VDB] (SOFT_VDB): Do not undefine. * include/private/gcconfig.h (MPROTECT_VDB): Do not undefine if SOFT_VDB; update comment. * mark.c [!GC_DISABLE_INCREMENTAL && !NO_VDB_FOR_STATIC_ROOTS && !PROC_VDB] (GC_static_page_was_dirty): Do not examine GC_manual_vdb value; update comment * mark.c [!GC_DISABLE_INCREMENTAL && !NO_VDB_FOR_STATIC_ROOTS && !PROC_VDB] (GC_push_conditional_static): Call GC_push_all() unless GC_is_vdb_for_static_roots(). * os_dep.c: Update comment about SOFT_VDB implementation. * os_dep.c [!OS2 && !GWW_VDB && SOFT_VDB] (GC_GWW_AVAILABLE): Implement to check clear_refs_fd value. * os_dep.c [MPROTECT_VDB && !DARWIN && SOFT_VDB] (soft_dirty_init): Declare static function. * os_dep.c [MPROTECT_VDB && !DARWIN && (GWW_VDB || MSWIN32 || MSWINCE)] (GC_dirty_init): Move code upper (to be right after checking of GC_page_size). * os_dep.c [MPROTECT_VDB && !DARWIN && SOFT_VDB] (GC_dirty_init): Return true if soft_dirty_init(). * os_dep.c [SOFT_VDB] (GC_dirty_init): Rename to soft_dirty_init (and make it static) if MPROTECT_VDB; do not set soft_vdb_buf if already non-null; remove TODO about MPROTECT_VDB. * os_dep.c [SOFT_VDB && MPROTECT_VDB] (soft_dirty_init): Check GC_USE_GETWRITEWATCH environment variable (and return false if the client requested to prefer mprotect-based VDB). * os_dep.c [!GC_DISABLE_INCREMENTAL && !NO_VDB_FOR_STATIC_ROOTS && !PROC_VDB] (GC_is_vdb_for_static_roots): Implement. * tests/test.c [!GC_DISABLE_INCREMENTAL && (TEST_DEFAULT_VDB || !DEFAULT_VDB) && MPROTECT_VDB && SOFT_VDB] (enable_incremental_mode): Print message similar to the case of GWW_VDB and MPROTECT_VDB.