summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Fix oldProc initialization in gc_cleanup and eliminate related warningsIvan Maidanski2021-12-261-2/+2
| | | | | | | | | | | | | | Issue #406 (bdwgc). GC_register_finalizer and similar functions do not guarantee to set *ofn an *ocd values, thus the client should do it. * dbg_mlc.c [!GC_NO_FINALIZATION] (GC_debug_register_finalizer_no_order, GC_debug_register_finalizer, GC_debug_register_finalizer_unreachable, GC_debug_register_finalizer_ignore_self): Initialize my_old_cd to 0; add comment. * include/gc/gc_cpp.h (gc_cleanup::gc_cleanup): Initialize oldProc and oldData to 0; add comment.
* Fix undefined __stack_base__ on UWP/arm64 (llvm-mingw)Bruce A Henderson2021-12-221-1/+1
| | | | | | | | | (fix of commit 1471f940e) Issue #405 (bdwgc). * include/private/gcconfig.h [__aarch64__] (NOSYS): Do not define if _WIN32.
* Assert SET_HDR does not write to GC_all_nilsIvan Maidanski2021-12-021-4/+5
| | | | | | | | Issue #237 (bdwgc). * include/private/gc_hdrs.h (HDR_FROM_BI): Delete outer parentheses. * include/private/gc_hdrs.h [HASH_TL] (SET_HDR): Expand GET_HDR_ADDR(); add assertion that bi is not GC_all_nils.
* Revert "Force BASE_ATOMIC_OPS_EMULATED definition if AO_USE_PTHREAD_DEFS"Ivan Maidanski2021-11-291-7/+5
| | | | | | | | This reverts commit d87fe3febafa61af26c3c4a9469205bdd1780782. The reason: BASE_ATOMIC_OPS_EMULATED should be defined by configure.ac; passing -D AO_USE_PTHREAD_DEFS to CFLAGS_EXTRA should test the algorithm which defines BASE_ATOMIC_OPS_EMULATED.
* Force BASE_ATOMIC_OPS_EMULATED definition if AO_USE_PTHREAD_DEFSIvan Maidanski2021-11-281-5/+7
| | | | | | | | | | | This is for testing purpose only, in case of -D AO_USE_PTHREAD_DEFS is specified in CFLAGS to Makefile.direct. * include/private/gcconfig.h [AO_USE_PTHREAD_DEFS && !BASE_ATOMIC_OPS_EMULATED] (BASE_ATOMIC_OPS_EMULATED): Define. * include/private/gcconfig.h [BASE_ATOMIC_OPS_EMULATED || USE_PROC_FOR_LIBRARIES && GC_LINUX_THREADS] (MPROTECT_VDB): Merge two ifdef+define into a single one.
* Rename BoehmGC to libgc in comment of leak_detector.hIvan Maidanski2021-11-251-1/+1
| | | | * include/gc/leak_detector.h: Rename BoehmGC to libgc in comment.
* Remove redundant 'private' prefix in include directives in include/privateIvan Maidanski2021-11-252-5/+5
| | | | | | | | | | | | | (refactoring) * include/private/pthread_support.h: Remove "private/" prefix in include gc_priv.h. * include/private/thread_local_alloc.h: Likewise. * include/private/pthread_support.h [GC_PTHREADS && !GC_WIN32_THREADS]: Remove "private/" prefix in include darwin_stop_world.h and pthread_stop_world.h. * include/private/thread_local_alloc.h [THREAD_LOCAL_ALLOC && USE_CUSTOM_SPECIFIC]: Remove "private/" prefix in include specific.h.
* Move public header files to include/gc in source treeIvan Maidanski2021-11-2527-2767/+2767
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, include/extra public header files (for the redirection) are moved to include directory. This is have the same directories structure of public headers in the source tree as that of the installed "include" directory. * doc/finalization.md: Remove "include/" prefix for cord.h. * LICENSE: Rename include/gc_allocator.h to gc/gc_allocator.h. * Makefile.direct (CORD_SRCS, CORD_INCLUDE_FILES): Add "gc/" prefix for cord.h, ec.h, cord_pos.h. * CMakeLists.txt [install_headers]: Likewise. * cord/cord.am (pkginclude_HEADERS): Likewise. * Makefile.direct (SRCS, tests/test.o, dyn_load.o, dyn_load_sunos53.o, mark.o, typd_mlc.o, finalize.o, ptr_chck.o, specific.o, alloc.o, pthread_support.o, thread_local_alloc.o, win32_threads.o): Add "gc/" prefix for gc_typed.h, gc_tiny_fl.h, gc_version.h, gc_inline.h, gc_mark.h, gc_disclaim.h, gc_allocator.h, javaxfc.h, gc_backptr.h, gc_gcj.h, leak_detector.h, gc_pthread_redirects.h, gc_config_macros.h. * NT_MAKEFILE (test.obj): Add gc\ prefix for gc_mark.h, gc_disclaim.h. * NT_MAKEFILE (cord\tests\de.obj, cord\tests\de_win.obj): Add gc\ prefix for cord.h, cord_pos.h. * OS2_MAKEFILE (cord\cordbscs.obj, cord\cordxtra.obj, cord\cordprnt.obj, cordtest.exe): Likewise. * cord/cordbscs.c: Add "gc/" prefix in include for cord.h, ec.h; reorder includes. * cord/cordprnt.c: Likewise. * cord/cordxtra.c: Likewise. * cord/tests/cordtest.c: Likewise. * cord/tests/de.c: Likewise. * cord/tests/de_win.c: Likewise. * extra/gc.c: Add "gc/" prefix in include for gc_inline.h, gc_pthread_redirects.h, javaxfc.h, gc_disclaim.h, gc_gcj.h, gc_backptr.h, gc_mark.h, gc_tiny_fl.h, leak_detector.h., gc_typed.h. * finalize.c: Likewise. * fnlz_mlc.c: Likewise. * gcj_mlc.c: Likewise. * include/private/dbg_mlc.h: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/thread_local_alloc.h: Likewise. * malloc.c: Likewise. * mallocx.c: Likewise. * pthread_stop_world.c: Likewise. * pthread_support.c: Likewise. * reclaim.c: Likewise. * tests/disclaim_bench.c: Likewise. * tests/disclaim_test.c: Likewise. * tests/disclaim_weakmap_test.c: Likewise. * tests/leak_test.c: Likewise. * tests/staticrootstest.c: Likewise. * tests/test.c: Likewise. * tests/thread_leak_test.c: Likewise. * tests/trace_test.c: Likewise. * thread_local_alloc.c: Likewise. * typd_mlc.c: Likewise. * tests/test_cpp.cc: Add "gc/" prefix in include for gc_allocator.h. * include/extra/gc.h: Move to include folder; replace include<> to include "". * include/extra/gc_cpp.h: Likewise. * include/cord.h: Move to include/gc folder. * include/cord_pos.h: Likewise. * include/ec.h: Likewise. * include/gc.h: Likewise. * include/gc_allocator.h: Likewise. * include/gc_backptr.h: Likewise. * include/gc_config_macros.h: Likewise. * include/gc_cpp.h: Likewise. * include/gc_disclaim.h: Likewise. * include/gc_gcj.h: Likewise. * include/gc_inline.h: Likewise. * include/gc_mark.h: Likewise. * include/gc_pthread_redirects.h: Likewise. * include/gc_tiny_fl.h: Likewise. * include/gc_typed.h: Likewise. * include/gc_version.h: Likewise. * include/javaxfc.h: Likewise. * include/leak_detector.h: Likewise. * include/include.am (pkginclude_HEADERS): Add "gc/" prefix for gc.h, gc_backptr.h, gc_config_macros.h, gc_inline.h, gc_mark.h, gc_tiny_fl.h, gc_typed.h, gc_version.h, javaxfc.h, leak_detector.h, gc_disclaim.h, gc_gcj.h, gc_pthread_redirects.h, gc_allocator.h, gc_cpp.h. * CMakeLists.txt [install_headers]: Likewise. * include/include.am (include_HEADERS): Remove "extra/" prefix for gc_cpp.h, gc.h. * CMakeLists.txt [install_headers]: Likewise.
* Remove duplicate include gc_tiny_fl.h in gc_priv.hIvan Maidanski2021-11-251-2/+0
| | | | * include/private/gc_priv.h: Remove 2nd include "../gc_tiny_fl.h".
* Remove msvc_dbg.h fileIvan Maidanski2021-11-232-45/+0
| | | | | | | | | | | | | | | | | | (refactoring) * NT_MAKEFILE (tests\test.obj): Remove msvc_dbg.h from dependencies. * README.md (Copyright & Warranty): Do not mention msvc_dbg.h. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER]: Do not include msvc_dbg.h; include stdlib.h. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (backtrace, backtrace_symbols): Declare (as extern C). * os_dep.c [GC_HAVE_BUILTIN_BACKTRACE && _MSC_VER] (backtrace, backtrace_symbols): Likewise. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (backtrace_symbols): Match argument types in the definition to those in the declaration. * include/include.am (EXTRA_DIST): Do not add msvc_dbg.h. * include/private/msvc_dbg.h: Remove.
* Synchronize copyright years between README filesIvan Maidanski2021-11-221-4/+4
| | | | | | | | | | | | | | | * README.QUICK: Copy copyright years from README.md. * README.md (Copyright & Warranty): Adjust copyrights (synchronize with that of the source files). * alloc.c: Adjust copyrights in the file head comment and GC_copyright (synchronize with that of updated README.QUICK). * include/gc.h: Likewise. * alloc.c (GC_copyright): Reformat. * dbg_mlc.c: Add trailing dot to a copyright in the file head comment. * finalize.c: Likewise. * include/gc.h: Likewise. * tests/initsecondarythread.c: Reformat copyright in the file head comment (change C to lower case).
* Move non-cord [pkg]include_HEADERS assignments to include.amIvan Maidanski2021-11-131-0/+23
| | | | | | | | | | | (refactoring) * Makefile.am [PTHREADS || ENABLE_GCJ_SUPPORT || ENABLE_DISCLAIM] (pkginclude_HEADERS): Move item addition to include/include.am. * Makefile.am [CPLUSPLUS] (pkginclude_HEADERS, include_HEADERS): Likewise. * Makefile.am (EXTRA_DIST): Move msvc_dbg.h item to include/include.am; remove TODO about the use of Makefile.am with MS VC.
* Revert "Fix missing msvc_dbg.h in dist_noinst_HEADERS (Automake)"Ivan Maidanski2021-11-131-1/+0
| | | | | | This reverts commit 479b187e62e3634d755b671b7e8f8229ea3c3d1e. The reason: msvc_dbg.h is listed in EXTRA_DIST.
* Do not name GCC intrinsics as C11 onesIvan Maidanski2021-10-301-1/+1
| | | | | | | | | | * CMakeLists.txt (GC_BUILTIN_ATOMIC): Do not mention C11 in comment (or documentation) when referring to GCC intrinsics. * configure.ac (GC_BUILTIN_ATOMIC): Likewise. * include/private/gc_atomic_ops.h: Likewise. * ChangeLog (8.0.0): Do not mention C11 when referring to GCC intrinsics. * doc/README.macros (GC_BUILTIN_ATOMIC): Likewise.
* Eliminate 'skipping config since MAX_HEAP_SECTS is unknown' cppcheck FPIvan Maidanski2021-10-211-2/+3
| | | | | | * include/private/gc_priv.h [MAX_HEAP_SECTS && CPPCHECK && (CYGWIN32 || MSWIN32 || MSWINCE || USE_PROC_FOR_LIBRARIES)] (MAX_HEAP_SECTS): Redefine.
* Fix 'GC_reset_fault_handler defined but not used' mingw32-gcc warningIvan Maidanski2021-10-211-1/+2
| | | | | | | | | | | (fix of commit 50f8739e0) * include/private/gc_priv.h [WRAP_MARK_SOME] (GC_jmp_buf, GC_setup_temporary_fault_handler, GC_reset_fault_handler): Do not declare if MSWIN32 or MSWINCE. * os_dep.c [WRAP_MARK_SOME] (MIN_PAGE_SIZE, GC_jmp_buf, GC_fault_handler, GC_setup_temporary_fault_handler, GC_reset_fault_handler): Do not define if MSWIN32 or MSWINCE.
* Allow to build with forced WRAP_MARK_SOMEIvan Maidanski2021-10-151-1/+1
| | | | | | | | | * include/private/gc_priv.h [WRAP_MARK_SOME] (GC_jmp_buf, GC_setup_temporary_fault_handler, GC_reset_fault_handler): Declare. * os_dep.c [WRAP_MARK_SOME] (old_segv_handler, old_bus_handler, GC_set_and_save_fault_handler, MIN_PAGE_SIZE, GC_jmp_buf, GC_fault_handler, GC_setup_temporary_fault_handler, GC_reset_fault_handler): Define.
* Fix 'GC_greatest_stack_base_below is defined but not used' warning (IA64)Ivan Maidanski2021-10-141-1/+2
| | | | | | | | | | | Define GC_greatest_stack_base_below only if needed by GC_get_stack_base. * include/private/gc_priv.h [THREADS && IA64] (GC_greatest_stack_base_below): Do not declare unless HAVE_PTHREAD_ATTR_GET_NP or HAVE_PTHREAD_GETATTR_NP. * pthread_support.c [GC_PTHREADS && !GC_WIN32_THREADS && IA64] (GC_greatest_stack_base_below): Do not define unless HAVE_PTHREAD_ATTR_GET_NP or HAVE_PTHREAD_GETATTR_NP.
* Remove comment belonging to deleted GC_push_procIvan Maidanski2021-10-131-1/+0
| | | | | | | (fix of commit d1d1fc8d9) * include/private/gc_priv.h (GC_push_one): Remove comment belonging to deleted GC_push_proc ("Push register contents onto mark stack").
* Eliminate 'potentially uninitialized local variable tc' warning (MSVC)Ivan Maidanski2021-10-121-3/+7
| | | | | | | | | | | ABORT() is not marked as no-return function when compiling by MS VC, thus a warning about tc variable is produced because QueryPerformanceCounter(&tc) is not called if QueryPerformanceFrequency returned false. * include/private/gc_priv.h [!NO_CLOCK && !BSD_TIME && ((MSWIN32 || MSWINCE) && MSWINRT_FLAVOR || WINXP_USE_PERF_COUNTER)] (GET_TIME): Replace "if(a||b) ABORT" with "if(a) ABORT; if(b) ABORT"; add comment.
* Make all functions static in msvc_dbg.c except for backtrace[_symbols]Ivan Maidanski2021-10-121-30/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (MAX_SYM_NAME): Move from msvc_dbg.h. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GetStackFramesFromContext): Declare before use. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GetStackFrames, GetStackFramesFromContext, GetModuleNameFromAddress, GetSymbolNameFromAddress, GetFileLineFromAddress, GetDescriptionFromAddress, GetDescriptionFromStack): Define as static. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GetModuleNameFromAddress, GetFileLineFromAddress): Declare local variables at top level. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GetModuleNameFromStack, GetSymbolNameFromStack, GetFileLineFromStack): Remove. * include/private/msvc_dbg.h (MSVC_DBG_EXPORT): Always define as empty. * include/private/msvc_dbg.h (HANDLE, CONTEXT, GetStackFrames, GetStackFramesFromContext, GetModuleNameFromAddress, GetModuleNameFromStack, GetSymbolNameFromAddress, GetSymbolNameFromStack, GetFileLineFromAddress, GetFileLineFromStack, GetDescriptionFromAddress, GetDescriptionFromStack): Do not declare. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && _MSC_VER && !_M_ARM && !_M_ARM64 && !_M_X64]: Remove include of msvc_dbg.h. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && !_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (WinMain): Do not pass GetFileLineFromStack, GetModuleNameFromStack and GetSymbolNameFromStack to UNTESTED().
* Workaround msvc_dbg.c build failure on arm[64] (MSVC)Ivan Maidanski2021-10-121-0/+1
| | | | | | | | | | | | | | | | | | As of now, backtrace() and backtrace_symbols() on Windows are implemented only for x86 (and only if MS VC compiler). * extra/msvc_dbg.c [!_M_X64 && _MSC_VER]: Skip entire file also if _M_ARM or _M_ARM64; add TODO item. * include/gc_config_macros.h [_MSC_VER && _MSC_VER>=1200 && !_AMD64_ && !_M_X64 && !_WIN32_WCE && !GC_HAVE_NO_BUILTIN_BACKTRACE && !GC_HAVE_BUILTIN_BACKTRACE] (GC_HAVE_BUILTIN_BACKTRACE): Do not define if _M_ARM or _M_ARM64. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && _MSC_VER && !_M_ARM && !_M_ARM64 && !_M_X64]: Include msvc_dbg.h. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && !_M_X64 && _MSC_VER] (WinMain): Do not pass GetFileLineFromStack, GetModuleNameFromStack and GetSymbolNameFromStack to UNTESTED() if _M_ARM or _M_ARM64.
* Support OpenBSD/riscv64Matthieu Herrb2021-10-041-1/+5
| | | | | * include/private/gcconfig.h [__riscv && OPENBSD] (RISCV, mach_type_known): Define macro.
* Bump libgc version (for the development of 8.4 release)Ivan Maidanski2021-09-291-2/+2
| | | | | | | | | | * README.md: Restore build status badges (Travis, AppVeyor, Codecov, Coveralls, Coverity, LGTM, Hits-of-Code, Lines of code, GitHub code size, Github All Releases). * CMakeLists.txt (PACKAGE_VERSION): Bump package version to 8.3.0. * README.md: Likewise. * configure.ac (AC_INIT): Likewise. * include/gc_version.h (GC_TMP_VERSION_MINOR): Likewise.
* [8.2.0]v8.2.0Ivan Maidanski2021-09-291-2/+2
| | | | | | | | | | | | | | | | | | | Bump gc version to 8.2.0 (experimental release) * ChangeLog (8.2.0): Set release date. * CMakeLists.txt (PACKAGE_VERSION): Bump minor version and set micro to 0 (change package version to 8.2.0). * README.md: Likewise. * configure.ac (AC_INIT): Likewise. * include/gc_version.h (GC_TMP_VERSION_MINOR, GC_TMP_VERSION_MICRO): Likewise. * CMakeLists.txt (LIBGCCPP_VER_INFO): Increment current and age (change version info of libgccpp.so to 6:0:5). * Makefile.am (LIBGCCPP_VER_INFO): Likewise. * README.md: Remove build status badges (Travis, AppVeyor, Codecov, Coveralls, Coverity, LGTM). * doc/README.cmake (HOW TO IMPORT BDWGC): Update BDWgc version in the sample.
* Remove unused GC_prev_heap_addrIvan Maidanski2021-09-261-2/+0
| | | | | | | (refactoring) * alloc.c (GC_add_to_heap): Do not store to GC_prev_heap_addr. * include/private/gc_priv.h (_GC_arrays._prev_heap_addr): Remove field.
* Print GC_gc_no always as unsigned long valueIvan Maidanski2021-09-221-6/+6
| | | | | | | | (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.
* Declare API function and print amount of memory obtained from OSIvan Maidanski2021-09-222-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Public GC_get_obtained_from_os_bytes() is introduced. * alloc.c [USE_MUNMAP] (GC_stopped_mark): Add assertion that GC_heapsize is not less than GC_unmapped_bytes. * alloc.c (GC_stopped_mark): Add assertion that GC_our_mem_bytes is not less than GC_heapsize; print GC_our_mem_bytes-GC_heapsize value (using GC_DBGLOG_PRINTF). * alloc.c [USE_PROC_FOR_LIBRARIES] (GC_add_to_our_memory): Update comment; increment GC_our_mem_bytes value (by bytes). * include/private/gc_priv.h (GC_add_to_our_memory): Likewise. * include/gc.h (GC_get_obtained_from_os_bytes): New API function declaration. * include/gc.h (GC_prof_stats_s.obtained_from_os_bytes): Declare new field. * include/private/gc_priv.h (_GC_arrays._our_mem_bytes): Likewise. * misc.c (GC_get_obtained_from_os_bytes): Implement. * misc.c [!GC_GET_HEAP_USAGE_NOT_NEEDED] (fill_prof_stats): Set obtained_from_os_bytes field. * tests/test.c (check_heap_stats): Print value returned by GC_get_obtained_from_os_bytes(). * tests/test.c [USE_MUNMAP] (check_heap_stats): Print value returned by GC_get_unmapped_bytes().
* Do not call add_to_our_memory with null pointerIvan Maidanski2021-09-221-2/+1
| | | | | | | | | | | | | | | (refactoring) * alloc.c [USE_PROC_FOR_LIBRARIES] (GC_add_to_our_memory): Do not accept p == NULL (add assertion about it). * alloc.c (GC_expand_hp_inner): Call GC_add_to_our_memory() only if the pointer is non-NULL; Use EXPECT() to check the pointer. * backgraph.c [MAKE_BACK_GRAPH] (push_in_progress): Likewise. * headers.c (GC_scratch_alloc): Likewise. * include/private/gc_priv.h [USE_PROC_FOR_LIBRARIES] (GC_add_to_our_memory): Remove comment that p could be NULL. * include/private/gc_priv.h [!USE_PROC_FOR_LIBRARIES] (GC_add_to_our_memory): Cast p and bytes to void.
* Workaround 'push_regs configured incorrectly' error (GCC-11)Ivan Maidanski2021-09-221-0/+1
| | | | | | | | | __builtin_unwind_init() does not push the registers correctly if compiled by gcc-11 (11.2.0) on cygwin/x86_64, at least. The workaround is to fall back to [_]setjmp() in GC_with_callee_saves_pushed. * include/private/gcconfig.h [GC_GNUC_PREREQ(2,8)] (HAVE_BUILTIN_UNWIND_INIT): Do not define if GC_GNUC_PREREQ(11,0).
* Fix comment after moving mark_state_t to gc_priv.hIvan Maidanski2021-09-222-1/+3
| | | | | | | | (fix of commit 6ec159286) * include/private/gc_pmark.h (MS_NONE): Add comment. * include/private/gc_priv.h (mark_state_t): Remove "as follows" in comment.
* Enable use of __builtin_unwind_init() if clang-8 or laterIvan Maidanski2021-09-191-1/+2
| | | | | | | | | Note: this fixes builds for Android/aarch64. * include/private/gcconfig.h [GC_GNUC_PREREQ(2,8) && !__INTEL_COMPILER && !__PATHCC__ && !__FUJITSU && !(POWERPC && DARWIN) && !RTEMS && !__ARMCC_VERSION && GC_CLANG_PREREQ(8,0)] (HAVE_BUILTIN_UNWIND_INIT): Define macro; update comment.
* Enable SOFT_VDB for linux/s390Ivan Maidanski2021-09-171-0/+3
| | | | | | | Issue #265 (bdwgc). * include/private/gcconfig.h [S390 && LINUX && !SOFT_VDB] (SOFT_VDB): Define macro.
* Fix 'incomplete type struct HeapSect in sizeof' compiler errorIvan Maidanski2021-09-171-4/+6
| | | | | | | (fix of commit 8e01d31bf) * include/private/gc_priv.h (HeapSect): Move struct declaration out of struct _GC_arrays.
* Remove limit on number of heap sectionsIvan Maidanski2021-09-171-2/+5
| | | | | | | | | | | | | | | | GC_heap_sects[] is a dynamic array now with the initial size of 32 elements. * alloc.c (add_to_heap_inner): Declare old_capacity, old_heap_sects, new_capacity, new_heap_sects local variables; define INITIAL_HEAP_SECTS macro; resize GC_heap_sects if it is full instead of abort; recycle old GC_heap_sects array on resize. * include/private/gc_priv.h [!MAX_HEAP_SECTS] (MAX_HEAP_SECTS): Do not define unless Windows or USE_PROC_FOR_LIBRARIES. * include/private/gc_priv.h (GC_arrays._capacity_heap_sects): Add field. * include/private/gc_priv.h (GC_arrays._heap_sects): Change type from fixed-size array to pointer.
* Reflect result of VDB selection at runtime in incremental_protection_needsIvan Maidanski2021-09-161-3/+8
| | | | | | | | | | | | | | | | | Now, GC_incremental_protection_needs returns GC_PROTECTS_NONE if GWW_VDB- or SOFT_VDB-based implementation is chosen (over MPROTECT_VDB-based one) during GC_dirty_init. * include/gc.h (GC_incremental_protection_needs): Update comment. * os_dep.c [SOFT_VDB] (clear_refs_fd): Move upper to be close to GC_GWW_AVAILABLE definition. * os_dep.c [MPROTECT_VDB && (GWW_VDB || SOFT_VDB)] (GC_incremental_protection_needs): Return GC_PROTECTS_NONE if GC_GWW_AVAILABLE(); add comment. * tests/test.c [!GC_DISABLE_INCREMENTAL && (TEST_DEFAULT_VDB || !DEFAULT_VDB)] (enable_incremental_mode): Call GC_incremental_protection_needs() and print VDB-related message depending on the result.
* Log abort message details even if not print_stats (unless SMALL_CONFIG)Ivan Maidanski2021-09-161-3/+9
| | | | | | | | * include/private/gc_priv.h (ABORT_ARG1, ABORT_ARG2, ABORT_ARG3): Use GC_ERRINFO_PRINTF() instead of GC_INFOLOG_PRINTF(). * include/private/gc_priv.h (GC_ERRINFO_PRINTF): New internal macro (define to GC_INFOLOG_PRINTF on Android or if SMALL_CONFIG, and to GC_log_printf in other configurations).
* Move GC_scratch_recycle_inner() to alloc.c (refactoring)Ivan Maidanski2021-09-111-3/+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.
* Do not update scratch_last_end_ptr unless used by reg dynamic librariesIvan Maidanski2021-09-111-4/+6
| | | | | | | | | | | | (refactoring) * headers.c (GC_scratch_alloc): Do not update GC_scratch_last_end_ptr unless USE_SCRATCH_LAST_END_PTR; add TODO item. * include/private/gc_priv.h [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX] (USE_SCRATCH_LAST_END_PTR): Define macro. * include/private/gc_priv.h (_GC_arrays._scratch_last_end_ptr, GC_scratch_last_end_ptr): Do define unless USE_SCRATCH_LAST_END_PTR; refine comment.
* Update copyright information in alloc.c and other modified files (2021)Ivan Maidanski2021-09-093-1/+3
| | | | | | | | | | | | | | | | | | | | | * 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 define HAVE_NO_FORK for all Unix-like systemsIvan Maidanski2021-09-071-2/+1
| | | | | | * include/private/gcconfig.h [!CAN_HANDLE_FORK && !HAVE_NO_FORK] (HAVE_NO_FORK): Test absence of CYGWIN32, SOLARIS, UNIX_LIKE instead of testing presence of MSWIN32, MSWINCE, DOS4GW, OS2, SYMBIAN.
* Ensure required Linux version at runtime for SOFT_VDBIvan Maidanski2021-09-052-28/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #265 (bdwgc). Now, compile-time checking of the minimum Linux kernel version (supporting soft dirty bit correctly) is off by default unless SOFT_VDB_LINUX_VER_STATIC_CHECK is defined by client. On the opposite hand, the runtime checking is on by default unless NO_SOFT_VDB_LINUX_VER_RUNTIME_CHECK is defined by client. * include/private/gc_priv.h [GLIBC_2_19_TSX_BUG && THREADS] (GC_parse_version): Declare GC_INNER function. * include/private/gcconfig.h [(POWERPC || I386 || X86_64) && LINUX && !SOFT_VDB] (SOFT_VDB): Define uncoditionally (i.e. regardless of __GLIBC__, __UCLIBC__, DEFAULT_VDB, NO_SOFT_VDB). * include/private/gcconfig.h [NO_SOFT_VDB || SOFT_VDB && SOFT_VDB_LINUX_VER_STATIC_CHECK && LINUX_VERSION_CODE<KERNEL_VERSION(3,18,0)] (SOFT_VDB): Undefine. * include/private/gcconfig.h [SOFT_VDB && SOFT_VDB_LINUX_VER_STATIC_CHECK]: Include linux/version.h. * include/private/gcconfig.h [PROC_VDB]: Remove ifdef duplication. * os_dep.c [SOFT_VDB && !NO_SOFT_VDB_LINUX_VER_RUNTIME_CHECK || GLIBC_2_19_TSX_BUG && THREADS] (GC_parse_version): Move from pthread_support.c and rename from parse_version; make it GC_INNER. * os_dep.c [SOFT_VDB && !NO_SOFT_VDB_LINUX_VER_RUNTIME_CHECK]: Include sys/utsname.h and string.h. * os_dep.c [SOFT_VDB && !NO_SOFT_VDB_LINUX_VER_RUNTIME_CHECK] (ensure_min_linux_ver): New static function. * os_dep.c [SOFT_VDB && !NO_SOFT_VDB_LINUX_VER_RUNTIME_CHECK] (soft_dirty_init): Call ensure_min_linux_ver(); return false if the linux version is lower than required (v3.18). * pthread_support.c [GLIBC_2_19_TSX_BUG] (setup_mark_lock): Call GC_parse_version instead of parse_version.
* Use mprotect-based VDB on PowerPC and S390 (Linux)Ivan Maidanski2021-09-041-0/+6
| | | | | * include/private/gcconfig.h [(POWERPC || S390) && LINUX && !REDIRECT_MALLOC] (MPROTECT_VDB): Define macro.
* Allow to disable GWW or mprotect-based VDB at buildIvan Maidanski2021-09-041-0/+8
| | | | | | * include/private/gcconfig.h [NO_GWW_VDB] (GWW_VDB): Undefine. * include/private/gcconfig.h [NO_MPROTECT_VDB] (MPROTECT_VDB): Likewise.
* Fall back to mprotect-based VDB at runtime if no soft-dirty bit in kernelIvan Maidanski2021-09-042-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Enable SOFT_VDB for PowerPC, x86 and x64 (Linux)Ivan Maidanski2021-09-031-0/+30
| | | | | | | | | | | | Issue #265 (bdwgc). * include/private/gcconfig.h [(I386 || POWERPC || X86_64) && LINUX && __GLIBC__ && !__UCLIBC__ && !DEFAULT_VDB && !SOFT_VDB && !GC_PREFER_MPROTECT_VDB]: Include linux/version.h. * include/private/gcconfig.h [(I386 || POWERPC || X86_64) && LINUX && __GLIBC__ && !__UCLIBC__ && !DEFAULT_VDB && !SOFT_VDB && !GC_PREFER_MPROTECT_VDB && LINUX_VERSION_CODE>=KERNEL_VERSION(3,18,0)] (SOFT_VDB): Define.
* Fix 'redefinition of GC_dirty_init' compiler error if PROC_VDB is givenIvan Maidanski2021-09-021-0/+5
| | | | | | | | (fix of commit de8e2e986) Issue #265 (bdwgc). * include/private/gcconfig.h [PROC_VDB] (SOFT_VDB): Undefine explicitly.
* Allow to specify custom value of LOG_PHT_ENTRIESIvan Maidanski2021-09-021-0/+3
| | | | | * include/private/gc_priv.h (LOG_PHT_ENTRIES): Do not define if already defined.
* Fix pagemap and clear_refs files access in child processIvan Maidanski2021-09-011-1/+1
| | | | | | | | | | | | | | | | | (fix of commit de8e2e986) Issue #265 (bdwgc). * include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL && CAN_HANDLE_FORK && SOFT_VDB] (GC_dirty_update_child): Declare as a function (not as a dummy macro). * os_dep.c [SOFT_VDB] (clear_refs_fd, pagemap_fd): Initialize to -1 (instead of 0). * os_dep.c [SOFT_VDB] (soft_dirty_open_files): New static function (part of code is moved from GC_dirty_init). * os_dep.c [SOFT_VDB && CAN_HANDLE_FORK] (GC_dirty_update_child): Implement. * os_dep.c [SOFT_VDB] (GC_dirty_init): Call soft_dirty_open_files().
* Fix GC_proc_fd value in child process at fork (Solaris)Ivan Maidanski2021-09-011-0/+11
| | | | | | | | | | | | | | | | | | | | In case of PROC_VDB mode is initialized, GC_proc_fd contains a file descriptor to "/proc/<pid>/pagedata". After forking, the child process has a different pid value, thus the old file descriptor should be closed and the one with the updated file name should be opened in turn. * include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL && CAN_HANDLE_FORK] (GC_dirty_update_child): Declare (as a function or as a macro). * os_dep.c [PROC_VDB] (GC_proc_fd): Initialize to -1 (instead of 0). * os_dep.c [PROC_VDB] (proc_dirty_open_files): New static function (part of code is moved from GC_dirty_init). * os_dep.c [PROC_VDB && CAN_HANDLE_FORK] (GC_dirty_update_child): New GC_INNER function. * os_dep.c [PROC_VDB] (GC_dirty_init): Call proc_dirty_open_files(). * pthread_support.c [CAN_HANDLE_FORK && !GC_DISABLE_INCREMENTAL] (fork_child_proc): Call GC_dirty_update_child().