Projects
Mega:24.09
gc
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:gc.spec
Changed
@@ -1,5 +1,5 @@ Name: gc -Version: 8.2.4 +Version: 8.2.6 Release: 1 Summary: A garbage collector for C and C++ License: BSD and GPLv1+ @@ -75,6 +75,9 @@ %changelog +* Wed Jul 24 2024 dillon chen <dillon.chen@gmail.com> - 8.2.6-1 +- Updade to 8.2.6 + * Sun Oct 8 2023 huyubiao <huyubiao@huawei.com> - 8.2.4-1 - Update gc to 8.2.4
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/gc.git</param> - <param name="revision">master</param> + <param name="revision">openEuler-24.09</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:gc-8.2.4.tar.gz/AUTHORS -> _service:tar_scm:gc-8.2.6.tar.gz/AUTHORS
Changed
@@ -123,6 +123,7 @@ Dave Detlefs <detlefs@src.dec.com> Dave Korn <dave.korn.cygwin@googlemail.com> Dave Love <d.love@dl.ac.uk> +David A. Holland <dholland@netbsd.org> David Ayers <d.ayers@inode.at> David Brownlee <abs@absd.org> David Butenhof <david.butenhof@hp.com> @@ -211,6 +212,7 @@ Jean-Baptiste Nivois Jean-Claude Beaudoin <jean.claude.beaudoin@gmail.com> Jean-Daniel Fekete <fekete@cs.umd.edu> +Jeaye Wilkerson <contact@jeaye.com> Jeff Sturm <jsturm@one-point.com> Jeffrey Hsu <hsu@soda.berkeley.edu> Jeffrey Mark Siskind @@ -283,6 +285,7 @@ Marcus Herbert Marek Vasut <marex@denx.de> Margaret Fleck <mfleck@illinois.edu> +Marius Gerbershagen <marius.gerbershagen@gmail.com> Mark Boulter <mboulter@vnet.ibm.com> Mark Mitchell <mark@codesourcery.com> Mark Reichert <markr@sirs.com> @@ -376,6 +379,7 @@ Richard Zidlicky <Richard.Zidlicky@stud.informatik.uni-erlangen.de> Rob Haack <rhaack@polaris.unm.edu> Robert Brazile <brazile@diamond.bbn.com> +Robert Hensing <robert@roberthensing.nl> Rodrigo Kumpera <kumpera@gmail.com> Roger Sayle <roger@eyesopen.com> Roland McGrath <roland@redhat.com>
View file
_service:tar_scm:gc-8.2.4.tar.gz/CMakeLists.txt -> _service:tar_scm:gc-8.2.6.tar.gz/CMakeLists.txt
Changed
@@ -22,16 +22,16 @@ # this will generate gc.sln # -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) -set(PACKAGE_VERSION 8.2.4) +set(PACKAGE_VERSION 8.2.6) # Version must match that in AC_INIT of configure.ac and that in README. # Version must conform to: 0-9+.0-9+.0-9+ # Info (current:revision:age) for the Libtool versioning system. # These values should match those in cord/cord.am and Makefile.am. -set(LIBCORD_VER_INFO 6:0:5) -set(LIBGC_VER_INFO 6:2:5) +set(LIBCORD_VER_INFO 6:1:5) +set(LIBGC_VER_INFO 6:3:5) set(LIBGCCPP_VER_INFO 6:0:5) option(enable_cplusplus "C++ support" OFF) @@ -143,9 +143,6 @@ # All warnings but ignoring "unreferenced formal parameter" and # "conditional expression is constant" ones. add_compile_options(/W4 /wd4100 /wd4127) - # Disable crt security warnings, since unfortunately they warn about all - # sorts of safe uses of strncpy. - add_definitions("-D_CRT_SECURE_NO_DEPRECATE") elseif (WATCOM) add_compile_options(/wx) if (NOT enable_threads) @@ -157,6 +154,11 @@ add_compile_options(-Wall -Wextra) endif() +if (WIN32) + # Disable MS crt security warnings reported e.g. for getenv, strcpy. + add_definitions("-D_CRT_SECURE_NO_DEPRECATE") +endif() + include_directories(include) set(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c @@ -196,11 +198,14 @@ # Thread support detection. if (CMAKE_USE_PTHREADS_INIT) set(SRC ${SRC} gc_dlopen.c) - if (CYGWIN OR MSYS) + if (CYGWIN OR WIN32) set(SRC ${SRC} win32_threads.c) else() set(SRC ${SRC} pthread_start.c pthread_stop_world.c pthread_support.c) endif() + if (APPLE) + set(SRC ${SRC} darwin_stop_world.c) + endif() if (HOST MATCHES .*-.*-hpux10.*) message(FATAL_ERROR "HP/UX 10 POSIX threads are not supported.") endif() @@ -223,12 +228,8 @@ add_definitions("-D_PTHREADS") set(NEED_LIB_RT ON) endif() - if (MSYS) + if (WIN32) # AND NOT CYGWIN # Does not provide process fork functionality. - elseif (APPLE) - # The incremental mode conflicts with fork handling (for now). - # Thus, HANDLE_FORK is not defined. - set(SRC ${SRC} darwin_stop_world.c) elseif (enable_handle_fork AND NOT disable_handle_fork) add_definitions("-DHANDLE_FORK") endif() @@ -321,7 +322,11 @@ else() add_definitions("-DREDIRECT_MALLOC=GC_malloc") endif() - add_definitions("-DGC_USE_DLOPEN_WRAP") + if (WIN32) + add_definitions("-DREDIRECT_MALLOC_IN_HEADER") + else() + add_definitions("-DGC_USE_DLOPEN_WRAP") + endif() endif(enable_redirect_malloc) if (enable_munmap) @@ -384,10 +389,10 @@ if (enable_single_obj_compilation OR BUILD_SHARED_LIBS) set(SRC extra/gc.c) # override SRC - if (CMAKE_USE_PTHREADS_INIT) + if (CMAKE_USE_PTHREADS_INIT AND NOT (CYGWIN OR WIN32)) add_definitions("-DGC_PTHREAD_START_STANDALONE") set(SRC ${SRC} pthread_start.c) - endif(CMAKE_USE_PTHREADS_INIT) + endif() elseif (BORLAND) # Suppress "GC_push_contents_hdr() is declared but never used" warning. add_compile_options(/w-use) @@ -398,6 +403,18 @@ set(SRC ${SRC} extra/msvc_dbg.c) endif() +# Declare that the libraries do not refer to external symbols. +if (BUILD_SHARED_LIBS AND NOT (APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "BSD")) + # Note: performed before CMAKE_REQUIRED_FLAGS is updated with "-c". + if (${CMAKE_VERSION} VERSION_LESS "3.18.0") + set(WL_NO_UNDEFINED_OPT "-Wl,--no-undefined") + check_c_compiler_flag(${WL_NO_UNDEFINED_OPT} HAVE_FLAG_WL_NO_UNDEFINED) + else() + set(WL_NO_UNDEFINED_OPT "LINKER:--no-undefined") + check_linker_flag(C "${WL_NO_UNDEFINED_OPT}" HAVE_FLAG_WL_NO_UNDEFINED) + endif() +endif() + # Instruct check_c_source_compiles to skip linking. # Alternatively, we could set CMAKE_REQUIRED_LIBRARIES properly. SET(CMAKE_REQUIRED_FLAGS "-c") @@ -407,7 +424,14 @@ if (NOT BORLAND AND NOT MSVC AND NOT WATCOM) check_c_compiler_flag(-Werror HAVE_FLAG_WERROR) if (HAVE_FLAG_WERROR) + check_c_compiler_flag(-Wno-unused-command-line-argument + HAVE_FLAG_WNO_UNUSED_CMDLINE_ARG) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") + # Prevent "linker input unused" error in further check_c_compiler_flag. + if (HAVE_FLAG_WNO_UNUSED_CMDLINE_ARG) + SET(CMAKE_REQUIRED_FLAGS + "${CMAKE_REQUIRED_FLAGS} -Wno-unused-command-line-argument") + endif() endif(HAVE_FLAG_WERROR) endif() @@ -421,13 +445,6 @@ else() add_definitions("-DGC_NO_VISIBILITY") endif() - if (${CMAKE_VERSION} VERSION_LESS "3.18.0") - set(WL_NO_UNDEFINED_OPT "-Wl,--no-undefined") - check_c_compiler_flag(${WL_NO_UNDEFINED_OPT} HAVE_FLAG_WL_NO_UNDEFINED) - else() - set(WL_NO_UNDEFINED_OPT "LINKER:--no-undefined") - check_linker_flag(C "${WL_NO_UNDEFINED_OPT}" HAVE_FLAG_WL_NO_UNDEFINED) - endif() else() add_definitions("-DGC_NOT_DLL") if (WIN32) @@ -443,6 +460,14 @@ add_compile_options(-fno-strict-aliasing) endif() +# Prevent "__builtin_return_address with a nonzero argument is unsafe" warning. +if (NOT BORLAND AND NOT MSVC AND NOT WATCOM) + check_c_compiler_flag(-Wno-frame-address HAVE_FLAG_WNO_FRAME_ADDRESS) + if (HAVE_FLAG_WNO_FRAME_ADDRESS) + add_compile_options(-Wno-frame-address) + endif(HAVE_FLAG_WNO_FRAME_ADDRESS) +endif() + # Extra user-defined flags to pass both to C and C++ compilers. if (DEFINED CFLAGS_EXTRA) separate_arguments(CFLAGS_EXTRA_LIST UNIX_COMMAND "${CFLAGS_EXTRA}") @@ -457,6 +482,17 @@ # Check for getcontext (uClibc can be configured without it, for example). check_function_exists(getcontext HAVE_GETCONTEXT) +if (HAVE_GETCONTEXT AND NOT APPLE) + # Double check getcontext() is available (needed at least on OpenBSD 7.3). + # Note: OS X is excluded here because the header filename differs. + check_c_source_compiles(" +#include <ucontext.h>\n +int main(void) { ucontext_t ctxt; (void)getcontext(&ctxt); return 0; }" + HAVE_GETCONTEXT_FUNC) + if (NOT HAVE_GETCONTEXT_FUNC) + set(HAVE_GETCONTEXT OFF) + endif() +endif() if (NOT HAVE_GETCONTEXT) add_definitions("-DNO_GETCONTEXT") endif() @@ -504,7 +540,7 @@ add_definitions("-DHAVE_PTHREAD_SETNAME_NP_WITH_TID") endif() endif(HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG) - endif (HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) + endif(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) endif() # Check for dladdr (used for debugging). @@ -692,8 +728,12 @@ add_test(NAME cordtest COMMAND cordtest) if (WIN32 AND NOT CYGWIN) + if (NOT (CMAKE_C_COMPILER_ID STREQUAL "Clang")) + # Workaround MS Clang failure to compile a resource file. + set(DE_WIN_RC cord/tests/de_win.rc) + endif() add_executable(de cord/tests/de.c cord/tests/de_win.c - cord/tests/de_win.rc) + ${DE_WIN_RC})
View file
_service:tar_scm:gc-8.2.4.tar.gz/ChangeLog -> _service:tar_scm:gc-8.2.6.tar.gz/ChangeLog
Changed
@@ -1,4 +1,81 @@ +== 8.2.6 2024-02-04 == + +* Avoid unexpected heap growth in gctest for the case of VERY_SMALL_CONFIG +* Change gc.man to include gc/gc.h +* Check for out-of-memory on every memory allocation in tests +* Do not compile pthread_start.c on Cygwin even if build shared libs (CMake) +* Eliminate 'alloc_small declared but unused' gcc warning in gctest +* Eliminate 'make_key is defined but unused' gcc warning in threadkeytest +* Eliminate 'old_segv_handler is defined but unused' gcc warning on OpenBSD +* Eliminate 'rand() may return deterministic values' warning +* Eliminate 'unused parameter' compiler warnings reported by MS clang +* Eliminate 'unused parameter' gcc warning in free() if IGNORE_FREE +* Eliminate 'unused value' gcc warnings in init_global_static_roots (Symbian) +* Eliminate GCC warning of unsafe __builtin_return_address(1) in Cmake script +* Eliminate compiler warning of missing cast in LONG_MULT after shift +* Eliminate warning of unused expression result in GC_FreeBSDGetDataStart +* Ensure _GNU_SOURCE is defined if HAVE_DLADDR is defined by configure +* Fix 'g++ not found' error on OpenBSD (Makefile.direct) +* Fix 'implicit declaration of function pthread_atfork' gcc error on MinGW +* Fix 'implicit declaration of function sbrk' gcc error on Symbian +* Fix 'implicit declaration of iscntrl()' warning in cord/de_win (MinGW) +* Fix 'info' buffer potential overrun in GC_save_callers +* Fix 'l-value specifies const object' MSVC error in GC_push_many_regs +* Fix 'linker input unused' error inside check_c_compiler_flag (CMake) +* Fix 'missing binary operator before token' gcc error in gcconfig.h +* Fix 'missing sysconf() prototype' gcc error in setjmp_t tool (OpenBSD) +* Fix 'sigset_t undeclared' MS VC error if pthreads-w32 is used +* Fix 'undefined reference' linker errors if shared build on OpenBSD (CMake) +* Fix 'unused GC_set_and_save_fault_handler' warning on OS X +* Fix GC_push_stack_for() to push also Xmm registers on Windows/x64 +* Fix GC_set_handle_fork(1) on Darwin when MPROTECT_VDB but no threads +* Fix MACH_TYPE macro redefinition on Symbian/arm +* Fix SVR4 macro definition order +* Fix asm constraint in LONG_MULT for gcc/x86 +* Fix assertion violation in GC_get_maps on Linux if malloc redirection +* Fix back graph and checksums support in WCC_MAKEFILE +* Fix bitwise negation and rounding direction in setjmp_t tool +* Fix checksums GC_record_fault invocation on Darwin +* Fix closing bracket placement for case statement in configure +* Fix deprecation warning about support of CMake older than v3.5 +* Fix extra 'extern C' for include signal.h in gcconfig.h +* Fix getcontext() detection by CMake on OpenBSD +* Fix handling of GC_gc_no counter wrap in GC_clear_stack +* Fix handling of GC_gc_no counter wrap in GC_notify_or_invoke_finalizers +* Fix indent of a closing curly brace in GC_forward_exception +* Fix lock assertion violation in GC_try_to_collect_inner on OS X +* Fix missing GC_pthread_sigmask on FreeBSD and NetBSD +* Fix missing _setjmp() on djgpp +* Fix missing atomic barriers in CORD_from_file_lazy +* Fix missing outermost parentheses in CORD_pos_cur_char_addr and hugetest +* Fix missing redirect and implementation of pthread_sigmask() on OpenBSD +* Fix missing type widening before left shift in GC_MAKE_PROC +* Fix misspelled GC_HEADERS_H macro in gc_priv.h +* Fix null dereference in check_finalizer_nested if redirect malloc on Linux +* Fix posix_memalign() to overwrite pointer storage only on success +* Fix race in init_lib_bounds on Linux with glibc v2.34+ if redirect malloc +* Fix skipped removal of page protection in case of address hash collision +* Fix typos in comments +* Fix undefined GC_real_pthread_sigmask if redirect malloc on OS X +* Fix update of last_back_trace_gc_no if KEEP_BACK_PTRS is not defined +* Handle GC_gc_no counter overflow properly in GC_print_trace +* Include Darwin CoreFoundation.h only if 32-bit ARM +* Make gc_allocator<void> members public +* Re-enable incremental mode on OS X (arm64) +* Remove .log and cordtest .tmp files by 'make clean' (Makefile.direct) +* Remove a redundant check of HOST_ANDROID in gcconfig.h +* Remove duplication of random numbers generator formula +* Specify constexpr in GC allocators if C++20 or later +* Support NetBSD/riscv64 +* Support non-msys MinGW build by CMake +* Turn on handle fork by default on Darwin (multi-threaded only) +* Use AO primitives in GC_RAND_NEXT instead of no_sanitize attribute +* Workaround 'malloc inconsistent dll linkage' MS VC error in CMake script +* Workaround MS Clang failure to compile de_win.rc +* Workaround mark stack overflow in GC_push_finalizer_structures on MinGW + + == 8.2.4 2023-05-26 == * Abort with appropriate message if first call of mmap fails with EPERM @@ -446,6 +523,19 @@ * Workaround various cppcheck false positives +== 8.0.12 2024-02-04 == + +* Eliminate 'make_key is defined but unused' gcc warning in threadkeytest +* Ensure _GNU_SOURCE is defined if HAVE_DLADDR is defined by configure +* Fix 'implicit declaration of function pthread_atfork' gcc error on MinGW +* Fix 'missing binary operator before token' gcc error in gcconfig.h +* Fix GC_set_handle_fork(1) on Darwin when MPROTECT_VDB but no threads +* Fix checksums GC_record_fault invocation on Darwin +* Fix extra 'extern C' for include signal.h in gcconfig.h + +Also, includes 7.6.20 changes + + == 8.0.10 2023-05-26 == * Abort with appropriate message if first call of mmap fails with EPERM @@ -962,6 +1052,17 @@ * Workaround Thread Sanitizer (TSan) false positive warnings +== 7.6.20 2024-02-03 == + +* Eliminate compiler warning of missing cast in LONG_MULT after shift +* Fix 'sigset_t undeclared' MS VC error if pthreads-w32 is used +* Fix lock assertion violation in GC_try_to_collect_inner on OS X +* Fix missing outermost parentheses in macro definitions in huge test +* Fix undefined GC_real_pthread_sigmask if redirect malloc on OS X + +Also, includes 7.4.26 changes + + == 7.6.18 2023-05-26 == * Fix IRIX5 defined wrongly on FreeBSD/mips @@ -1531,6 +1632,20 @@ Also, includes 7.4.4 changes +== 7.4.26 2024-02-03 == + +* Eliminate 'unused parameter' gcc warning in free() if IGNORE_FREE +* Eliminate 'unused value' gcc warnings in init_global_static_roots (Symbian) +* Fix 'implicit declaration of function sbrk' gcc error on Symbian +* Fix 'unused GC_set_and_save_fault_handler' warning on OS X +* Fix GC_push_stack_for() to push also Xmm registers on Windows/x64 +* Fix MACH_TYPE macro redefinition on Symbian/arm +* Fix missing GC_pthread_sigmask on FreeBSD and NetBSD +* Fix missing redirect and implementation of pthread_sigmask() on OpenBSD + +Also, includes 7.2r changes. + + == 7.4.24 2023-05-25 == * Adjust CORD_ec comment placement in ec.h @@ -2091,6 +2206,28 @@ Also, includes 7.2 changes +== 7.2r 2024-02-03 == + +* Fix 'g++ not found' error on OpenBSD (Makefile.direct) +* Fix 'implicit declaration of iscntrl()' warning in cord/de_win (MinGW) +* Fix 'info' buffer potential overrun in GC_save_callers +* Fix 'missing sysconf() prototype' gcc error in setjmp_t tool (OpenBSD) +* Fix SVR4 macro definition order +* Fix asm constraint in LONG_MULT for gcc/x86 +* Fix assertion violation in GC_get_maps on Linux if malloc redirection +* Fix bitwise negation and rounding direction in setjmp_t tool +* Fix closing bracket placement for case statement in configure +* Fix indent of a closing curly brace in GC_forward_exception +* Fix missing outermost parentheses in CORD_pos_cur_char_addr +* Fix missing type widening before left shift in GC_MAKE_PROC +* Fix misspelled GC_HEADERS_H macro in gc_priv.h +* Fix null dereference in check_finalizer_nested if redirect malloc on Linux +* Fix posix_memalign() to overwrite pointer storage only on success +* Fix skipped removal of page protection in case of address hash collision +* Fix typos in comments +* Fix update of last_back_trace_gc_no if KEEP_BACK_PTRS is not defined + + == 7.2q 2023-05-25 == * Fix CORD_next() indent inside loop in test_basics() of cordtest
View file
_service:tar_scm:gc-8.2.4.tar.gz/Makefile.am -> _service:tar_scm:gc-8.2.6.tar.gz/Makefile.am
Changed
@@ -14,7 +14,7 @@ # Info (current:revision:age) for the Libtool versioning system. # These numbers should be updated at most once just before the release, # and, optionally, at most once during the development (after the release). -LIBGC_VER_INFO = 6:2:5 +LIBGC_VER_INFO = 6:3:5 LIBGCCPP_VER_INFO = 6:0:5 ## FIXME: `make distcheck' in this directory will not currently work.
View file
_service:tar_scm:gc-8.2.4.tar.gz/Makefile.direct -> _service:tar_scm:gc-8.2.6.tar.gz/Makefile.direct
Changed
@@ -24,7 +24,7 @@ CC=cc $(ABI_FLAG) # Compiler executable name. For EMX, replace to "gcc". -CXX=g++ $(ABI_FLAG) +CXX= c++ $(ABI_FLAG) # Needed only for "make c++", which builds the C++ interface. AS=as $(AS_ABI_FLAG) @@ -379,7 +379,8 @@ clean: rm -f *.a *.i *.o *.exe tests/*.o gctest gctest_dyn_link test_cpp \ setjmp_test mon.out gmon.out a.out core if_not_there if_mach \ - base_lib c++ $(CORD_OBJS) cordtest de cords dont_ar_* threadlibs + base_lib c++ $(CORD_OBJS) cordtest de cords dont_ar_* \ + threadlibs *.log cordtst*.tmp -rm -f *~ gctest$(EXEEXT): tests/test.o base_lib $(UTILS)
View file
_service:tar_scm:gc-8.2.4.tar.gz/Makefile.in -> _service:tar_scm:gc-8.2.6.tar.gz/Makefile.in
Changed
@@ -1050,7 +1050,7 @@ # Info (current:revision:age) for the Libtool versioning system. # These numbers should be updated at most once just before the release, # and, optionally, at most once during the development (after the release). -LIBGC_VER_INFO = 6:2:5 +LIBGC_VER_INFO = 6:3:5 LIBGCCPP_VER_INFO = 6:0:5 # We currently use the source files directly from libatomic_ops, if we @@ -1187,7 +1187,7 @@ # Info (current:revision:age) for the Libtool versioning system. # These numbers should be updated at most once just before the release, # and, optionally, at most once during the development (after the release). -LIBCORD_VER_INFO = 6:0:5 +LIBCORD_VER_INFO = 6:1:5 libcord_la_LIBADD = libgc.la libcord_la_LDFLAGS = -version-info $(LIBCORD_VER_INFO) -no-undefined libcord_la_CPPFLAGS = $(AM_CPPFLAGS)
View file
_service:tar_scm:gc-8.2.4.tar.gz/README.md -> _service:tar_scm:gc-8.2.6.tar.gz/README.md
Changed
@@ -1,6 +1,6 @@ # Boehm-Demers-Weiser Garbage Collector -This is version 8.2.4 of a conservative garbage +This is version 8.2.6 of a conservative garbage collector for C and C++.
View file
_service:tar_scm:gc-8.2.4.tar.gz/WCC_MAKEFILE -> _service:tar_scm:gc-8.2.6.tar.gz/WCC_MAKEFILE
Changed
@@ -87,8 +87,8 @@ !ifdef ENABLE_STATIC -OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj & - mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj & +OBJS= alloc.obj reclaim.obj allchblk.obj backgraph.obj checksums.obj & + misc.obj mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj & obj_map.obj blacklst.obj finalize.obj new_hblk.obj & dbg_mlc.obj malloc.obj dyn_load.obj & typd_mlc.obj ptr_chck.obj mallocx.obj fnlz_mlc.obj gcj_mlc.obj
View file
_service:tar_scm:gc-8.2.4.tar.gz/backgraph.c -> _service:tar_scm:gc-8.2.6.tar.gz/backgraph.c
Changed
@@ -236,7 +236,7 @@ /* Check whether it was already in the list of predecessors. */ { - back_edges *e = (back_edges *)((word)pred & ~FLAG_MANY); + back_edges *e = (back_edges *)((word)pred & ~(word)FLAG_MANY); word n_edges; word total; int local = 0; @@ -263,7 +263,7 @@ } ensure_struct(q); - be = (back_edges *)((word)GET_OH_BG_PTR(q) & ~FLAG_MANY); + be = (back_edges *)((word)GET_OH_BG_PTR(q) & ~(word)FLAG_MANY); for (i = be -> n_edges, be_cont = be; i > MAX_IN; i -= MAX_IN) be_cont = be_cont -> cont; if (i == MAX_IN) { @@ -309,7 +309,7 @@ if (GC_HAS_DEBUG_INFO(p)) { ptr_t old_back_ptr = GET_OH_BG_PTR(p); if ((word)old_back_ptr & FLAG_MANY) { - back_edges *be = (back_edges *)((word)old_back_ptr & ~FLAG_MANY); + back_edges *be = (back_edges *)((word)old_back_ptr & ~(word)FLAG_MANY); if (!(be -> flags & RETAIN)) { deallocate_back_edges(be); SET_OH_BG_PTR(p, 0); @@ -387,7 +387,7 @@ pop_in_progress(p); return result; } - be = (back_edges *)((word)pred & ~FLAG_MANY); + be = (back_edges *)((word)pred & ~(word)FLAG_MANY); if (be -> height >= 0 && be -> height_gc_no == (unsigned short)GC_gc_no) return be -> height; /* Ignore back edges in DFS */ @@ -463,13 +463,13 @@ /* to p, but it can't have decreased. */ back_ptr = GET_OH_BG_PTR(p); if (0 != back_ptr && ((word)back_ptr & FLAG_MANY)) { - be = (back_edges *)((word)back_ptr & ~FLAG_MANY); + be = (back_edges *)((word)back_ptr & ~(word)FLAG_MANY); if (be -> height != HEIGHT_UNKNOWN) p_height = be -> height; } { ptr_t pred = GET_OH_BG_PTR(p); - back_edges *e = (back_edges *)((word)pred & ~FLAG_MANY); + back_edges *e = (back_edges *)((word)pred & ~(word)FLAG_MANY); word n_edges; word total; int local = 0; @@ -508,7 +508,7 @@ if (be == 0) { ensure_struct(p); back_ptr = GET_OH_BG_PTR(p); - be = (back_edges *)((word)back_ptr & ~FLAG_MANY); + be = (back_edges *)((word)back_ptr & ~(word)FLAG_MANY); } be -> flags |= RETAIN; be -> height = p_height;
View file
_service:tar_scm:gc-8.2.4.tar.gz/checksums.c -> _service:tar_scm:gc-8.2.6.tar.gz/checksums.c
Changed
@@ -36,10 +36,10 @@ STATIC size_t GC_n_faulted = 0; -#if defined(MPROTECT_VDB) && !defined(DARWIN) +#ifdef MPROTECT_VDB void GC_record_fault(struct hblk * h) { - word page = (word)h & ~(GC_page_size - 1); + word page = (word)h & ~(word)(GC_page_size-1); GC_ASSERT(GC_page_size != 0); if (GC_n_faulted >= NSUMS) ABORT("write fault log overflowed"); @@ -50,7 +50,7 @@ STATIC GC_bool GC_was_faulted(struct hblk *h) { size_t i; - word page = (word)h & ~(GC_page_size - 1); + word page = (word)h & ~(word)(GC_page_size-1); for (i = 0; i < GC_n_faulted; ++i) { if (GC_faultedi == page) return TRUE; @@ -118,7 +118,7 @@ { hdr * hhdr = HDR(h); - GC_bytes_in_used_blocks += (hhdr->hb_sz + HBLKSIZE-1) & ~(HBLKSIZE-1); + GC_bytes_in_used_blocks += (hhdr->hb_sz + HBLKSIZE-1) & ~(word)(HBLKSIZE-1); } STATIC void GC_check_blocks(void)
View file
_service:tar_scm:gc-8.2.4.tar.gz/configure -> _service:tar_scm:gc-8.2.6.tar.gz/configure
Changed
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for gc 8.2.4. +# Generated by GNU Autoconf 2.71 for gc 8.2.6. # # Report bugs to <https://github.com/ivmai/bdwgc/issues>. # @@ -621,8 +621,8 @@ # Identity of this package. PACKAGE_NAME='gc' PACKAGE_TARNAME='gc' -PACKAGE_VERSION='8.2.4' -PACKAGE_STRING='gc 8.2.4' +PACKAGE_VERSION='8.2.6' +PACKAGE_STRING='gc 8.2.6' PACKAGE_BUGREPORT='https://github.com/ivmai/bdwgc/issues' PACKAGE_URL='' @@ -1469,7 +1469,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gc 8.2.4 to adapt to many kinds of systems. +\`configure' configures gc 8.2.6 to adapt to many kinds of systems. Usage: $0 OPTION... VAR=VALUE... @@ -1541,7 +1541,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gc 8.2.4:";; + short | recursive ) echo "Configuration of gc 8.2.6:";; esac cat <<\_ACEOF @@ -1714,7 +1714,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gc configure 8.2.4 +gc configure 8.2.6 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2099,7 +2099,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gc $as_me 8.2.4, which was +It was created by gc $as_me 8.2.6, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3733,7 +3733,7 @@ # Define the identity of the package. PACKAGE='gc' - VERSION='8.2.4' + VERSION='8.2.6' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -17301,7 +17301,6 @@ fi ;; esac - fi @@ -19242,11 +19241,8 @@ # If the option is omitted, pthread_atfork handlers are installed # by default for the targets where pthread_atfork is known to work. case "$host" in - *-*-darwin*) - # The incremental mode conflicts with fork handling on Darwin. - ;; - *-*-aix* | *-*-android* | *-*-cygwin* | *-*-freebsd* | *-*-haiku* | \ - *-*-hpux11* | *-*-irix* | *-*-kfreebsd*-gnu | \ + *-*-aix* | *-*-android* | *-*-cygwin* | *-*-darwin* | *-*-freebsd* | \ + *-*-haiku* | *-*-hpux11* | *-*-irix* | *-*-kfreebsd*-gnu | \ *-*-*linux* | *-*-netbsd* | *-*-openbsd* | *-*-osf* | *-*-solaris*) printf "%s\n" "#define HANDLE_FORK 1" >>confdefs.h @@ -19884,7 +19880,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gc $as_me 8.2.4, which was +This file was extended by gc $as_me 8.2.6, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -19952,7 +19948,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -gc config.status 8.2.4 +gc config.status 8.2.6 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\"
View file
_service:tar_scm:gc-8.2.4.tar.gz/configure.ac -> _service:tar_scm:gc-8.2.6.tar.gz/configure.ac
Changed
@@ -14,7 +14,7 @@ dnl Process this file with autoconf to produce configure. dnl Initialization. -AC_INIT(gc,8.2.4,https://github.com/ivmai/bdwgc/issues) +AC_INIT(gc,8.2.6,https://github.com/ivmai/bdwgc/issues) dnl Version must conform to: 0-9+.0-9+.0-9+ AC_CONFIG_SRCDIR(gcj_mlc.c) @@ -136,8 +136,7 @@ AC_MSG_ERROR(Parallel mark requires --enable-threads=x spec) fi ;; - esac -) + esac) AC_ARG_ENABLE(thread-local-alloc, AS_HELP_STRING(--disable-thread-local-alloc, @@ -786,8 +785,8 @@ i345686-*-dgux*) AC_DEFINE(MAKE_BACK_GRAPH) ;; - esac - fi) + esac + fi ) AM_CONDITIONAL(MAKE_BACK_GRAPH, test x"$enable_gc_debug" = xyes) AM_CONDITIONAL(KEEP_BACK_PTRS, test x"$keep_back_ptrs" = xtrue) @@ -1209,11 +1208,8 @@ # If the option is omitted, pthread_atfork handlers are installed # by default for the targets where pthread_atfork is known to work. case "$host" in - *-*-darwin*) - # The incremental mode conflicts with fork handling on Darwin. - ;; - *-*-aix* | *-*-android* | *-*-cygwin* | *-*-freebsd* | *-*-haiku* | \ - *-*-hpux11* | *-*-irix* | *-*-kfreebsd*-gnu | \ + *-*-aix* | *-*-android* | *-*-cygwin* | *-*-darwin* | *-*-freebsd* | \ + *-*-haiku* | *-*-hpux11* | *-*-irix* | *-*-kfreebsd*-gnu | \ *-*-*linux* | *-*-netbsd* | *-*-openbsd* | *-*-osf* | *-*-solaris*) AC_DEFINE(HANDLE_FORK) ;;
View file
_service:tar_scm:gc-8.2.4.tar.gz/cord/cord.am -> _service:tar_scm:gc-8.2.6.tar.gz/cord/cord.am
Changed
@@ -3,7 +3,7 @@ # Info (current:revision:age) for the Libtool versioning system. # These numbers should be updated at most once just before the release, # and, optionally, at most once during the development (after the release). -LIBCORD_VER_INFO = 6:0:5 +LIBCORD_VER_INFO = 6:1:5 lib_LTLIBRARIES += libcord.la
View file
_service:tar_scm:gc-8.2.4.tar.gz/cord/cordxtra.c -> _service:tar_scm:gc-8.2.6.tar.gz/cord/cordxtra.c
Changed
@@ -38,13 +38,17 @@ /* of the threads primitives. */ # include "gc.h" -/* For now we assume that pointer reads and writes are atomic, */ -/* i.e. another thread always sees the state before or after */ -/* a write. This might be false on a Motorola M68K with */ -/* pointers that are not 32-bit aligned. But there probably */ -/* aren't too many threads packages running on those. */ -# define ATOMIC_WRITE(x,y) (x) = (y) -# define ATOMIC_READ(x) (*(x)) +/* If available, use GCC built-in atomic load-acquire and store-release */ +/* primitives to access the cache lines safely. Otherwise, fall back */ +/* to using the GC allocation lock even during the cache lines reading. */ +/* Note: for simplicity of libcord building, do not rely on GC_THREADS */ +/* macro, libatomic_ops package presence and private/gc_atomic_ops.h. */ +#if !defined(AO_DISABLE_GCC_ATOMICS) \ + && ((defined(__clang__) && __clang_major__ >= 8) /* clang 8.0+ */ \ + || (defined(__GNUC__) /* gcc 5.4+ */ \ + && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 4)))) +# define CORD_USE_GCC_ATOMIC +#endif /* The standard says these are in stdio.h, but they aren't always: */ # ifndef SEEK_SET @@ -63,7 +67,7 @@ ABORT("Out of memory"); } # define ABORT(msg) { fprintf(stderr, "%s\n", msg); abort(); } -#if GC_GNUC_PREREQ(3, 4) +#if GC_GNUC_PREREQ(3, 4) || defined(__clang__) # define CORD_ATTR_UNUSED __attribute__((__unused__)) #else # define CORD_ATTR_UNUSED /* empty */ @@ -518,7 +522,7 @@ # define DIV_CACHE_SZ(n) ((n) >> LOG_CACHE_SZ) # define MOD_LINE_SZ(n) ((n) & (LINE_SZ - 1)) # define DIV_LINE_SZ(n) ((n) >> LOG_LINE_SZ) -# define LINE_START(n) ((n) & ~(LINE_SZ - 1)) +# define LINE_START(n) ((n) & ~(size_t)(LINE_SZ - 1)) typedef struct { lf_state * state; @@ -545,20 +549,37 @@ ABORT("fread failed"); } new_cache -> tag = DIV_LINE_SZ(file_pos); - /* Store barrier goes here. */ - ATOMIC_WRITE(state -> lf_cacheline_no, new_cache); +# ifdef CORD_USE_GCC_ATOMIC + __atomic_store_n(&(state -> lf_cacheline_no), new_cache, + __ATOMIC_RELEASE); +# else + state -> lf_cacheline_no = new_cache; +# endif GC_END_STUBBORN_CHANGE((/* no volatile */ void *)(state -> lf_cache + line_no)); state -> lf_current = line_start + LINE_SZ; return (void *)((GC_word)new_cache->dataMOD_LINE_SZ(file_pos)); } +#ifndef CORD_USE_GCC_ATOMIC + static void * GC_CALLBACK get_cache_line(void * client_data) + { + return (void *)(*(cache_line **)client_data); + } +#endif + char CORD_lf_func(size_t i, void * client_data) { lf_state * state = (lf_state *)client_data; cache_line * volatile * cl_addr = &(state -> lf_cacheDIV_LINE_SZ(MOD_CACHE_SZ(i))); - cache_line * cl = (cache_line *)ATOMIC_READ(cl_addr); +# ifdef CORD_USE_GCC_ATOMIC + cache_line * cl = (cache_line *)__atomic_load_n(cl_addr, + __ATOMIC_ACQUIRE); +# else + cache_line * cl = (cache_line *)GC_call_with_alloc_lock( + get_cache_line, (void *)cl_addr); +# endif if (cl == 0 || cl -> tag != DIV_LINE_SZ(i)) { /* Cache miss */
View file
_service:tar_scm:gc-8.2.4.tar.gz/cord/tests/de_win.c -> _service:tar_scm:gc-8.2.6.tar.gz/cord/tests/de_win.c
Changed
@@ -25,6 +25,8 @@ #define NOSERVICE #include <windows.h> +#include <ctype.h> + #include "gc.h" #include "cord.h" #include "de_cmds.h"
View file
_service:tar_scm:gc-8.2.4.tar.gz/cord/tests/de_win.h -> _service:tar_scm:gc-8.2.6.tar.gz/cord/tests/de_win.h
Changed
@@ -74,7 +74,7 @@ void do_command(int); /* Execute an editor command. */ - /* Agument is a command character or one */ + /* Argument is a command character or one */ /* of the IDM_ commands. */ void generic_init(void);
View file
_service:tar_scm:gc-8.2.4.tar.gz/darwin_stop_world.c -> _service:tar_scm:gc-8.2.6.tar.gz/darwin_stop_world.c
Changed
@@ -23,7 +23,10 @@ #include <sys/sysctl.h> #include <mach/machine.h> -#include <CoreFoundation/CoreFoundation.h> + +#if defined(ARM32) && defined(ARM_THREAD_STATE32) +# include <CoreFoundation/CoreFoundation.h> +#endif /* From "Inside Mac OS X - Mach-O Runtime Architecture" published by Apple Page 49: @@ -83,15 +86,16 @@ # ifdef DEBUG_THREADS_EXTRA GC_log_printf("FindTopOfStack start at sp= %p\n", (void *)frame); # endif - while (frame->savedSP != 0) { - /* if there are no more stack frames, stop */ + while (frame->savedSP != 0) { /* stop if no more stack frames */ + unsigned long maskedLR; frame = (StackFrame*)frame->savedSP; /* we do these next two checks after going to the next frame because the LR for the first stack frame in the loop is not set up on purpose, so we shouldn't check it. */ - if ((frame->savedLR & ~0x3) == 0 || (frame->savedLR & ~0x3) == ~0x3UL) + maskedLR = frame -> savedLR & ~0x3UL; + if (0 == maskedLR || ~0x3UL == maskedLR) break; /* if the next LR is bogus, stop */ } # ifdef DEBUG_THREADS_EXTRA @@ -560,12 +564,13 @@ GC_log_printf("Stopping the world from thread %p\n", (void *)(word)my_thread); # endif -# ifdef PARALLEL_MARK - if (GC_parallel) { /* Make sure all free list construction has stopped before we */ /* start. No new construction can start, since free list */ /* construction is required to acquire and release the GC lock */ /* before it starts, and we have the lock. */ + +# ifdef PARALLEL_MARK + if (GC_parallel) { GC_acquire_mark_lock(); GC_ASSERT(GC_fl_builder_count == 0); /* We should have previously waited for it to become zero. */
View file
_service:tar_scm:gc-8.2.4.tar.gz/dbg_mlc.c -> _service:tar_scm:gc-8.2.6.tar.gz/dbg_mlc.c
Changed
@@ -54,32 +54,19 @@ } #endif /* !SHORT_DBG_HDRS */ -#ifdef LINT2 - long GC_random(void) +#ifdef KEEP_BACK_PTRS + + /* Use a custom trivial random() implementation as the standard */ + /* one might lead to crashes (if used from a multi-threaded code) */ + /* or to a compiler warning about the deterministic result. */ + static int GC_rand(void) { - static unsigned seed = 1; /* not thread-safe */ + static GC_RAND_STATE_T seed; - /* Linear congruential pseudo-random numbers generator. */ - seed = (seed * 1103515245U + 12345) & GC_RAND_MAX; /* overflow is ok */ - return (long)seed; + return GC_RAND_NEXT(&seed); } -#endif - -#ifdef KEEP_BACK_PTRS -#ifdef LINT2 -# define RANDOM() GC_random() -#else -# include <stdlib.h> -# define GC_RAND_MAX RAND_MAX - -# if defined(__GLIBC__) || defined(SOLARIS) \ - || defined(HPUX) || defined(IRIX5) || defined(OSF1) -# define RANDOM() random() -# else -# define RANDOM() (long)rand() -# endif -#endif /* !LINT2 */ +# define RANDOM() (long)GC_rand() /* Store back pointer to source in dest, if that appears to be possible. */ /* This is not completely safe, since we may mistakenly conclude that */ @@ -108,7 +95,6 @@ /* and *offset_p. */ /* source is root ==> *base_p = address, *offset_p = 0 */ /* source is heap object ==> *base_p != 0, *offset_p = offset */ - /* Returns 1 on success, 0 if source couldn't be determined. */ /* Dest can be any address within a heap object. */ GC_API GC_ref_kind GC_CALL GC_get_back_ptr_info(void *dest, void **base_p, size_t *offset_p) @@ -163,16 +149,17 @@ GC_API void * GC_CALL GC_generate_random_heap_address(void) { size_t i; - word heap_offset = RANDOM(); + word heap_offset = (word)RANDOM(); - if (GC_heapsize > GC_RAND_MAX) { + if (GC_heapsize > (word)GC_RAND_MAX) { heap_offset *= GC_RAND_MAX; - heap_offset += RANDOM(); + heap_offset += (word)RANDOM(); } heap_offset %= GC_heapsize; /* This doesn't yield a uniform distribution, especially if */ - /* e.g. RAND_MAX = 1.5* GC_heapsize. But for typical cases, */ + /* e.g. RAND_MAX is 1.5*GC_heapsize. But for typical cases, */ /* it's not too bad. */ + for (i = 0;; ++i) { size_t size;
View file
_service:tar_scm:gc-8.2.4.tar.gz/doc/README.cmake -> _service:tar_scm:gc-8.2.6.tar.gz/doc/README.cmake
Changed
@@ -55,7 +55,7 @@ Another project could add bdwgc as one of its dependencies with something like this in their CMakeLists.txt: -find_package(BDWgc 8.2.4 REQUIRED) +find_package(BDWgc 8.2.6 REQUIRED) add_executable(Foo foo.c) target_link_libraries(Foo BDWgc::gc)
View file
_service:tar_scm:gc-8.2.4.tar.gz/doc/gc.man -> _service:tar_scm:gc-8.2.6.tar.gz/doc/gc.man
Changed
@@ -1,11 +1,11 @@ -.TH BDWGC 3 "26 Mar 2019" +.TH BDWGC 3 "23 Aug 2023" .SH NAME GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer, GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page, GC_set_warn_proc \- Garbage collecting malloc replacement .SH SYNOPSIS -#include <gc.h> +#include <gc/gc.h> .br void * GC_malloc(size_t size); .br
View file
_service:tar_scm:gc-8.2.4.tar.gz/dyn_load.c -> _service:tar_scm:gc-8.2.6.tar.gz/dyn_load.c
Changed
@@ -544,7 +544,7 @@ } else { GC_ASSERT((word)end <= (((word)load_segsj.end + GC_page_size - 1) & - ~(GC_page_size - 1))); + ~(word)(GC_page_size - 1))); /* Remove from the existing load segment */ load_segsj.end2 = load_segsj.end; load_segsj.end = start; @@ -1445,7 +1445,7 @@ /* The _dyld_* functions have an internal lock so no _dyld functions can be called while the world is stopped without the risk of a deadlock. Because of this we MUST setup callbacks BEFORE we ever stop the world. - This should be called BEFORE any thread in created and WITHOUT the + This should be called BEFORE any thread is created and WITHOUT the allocation lock held. */ GC_INNER void GC_init_dyld(void) @@ -1472,7 +1472,7 @@ (void (*)(const struct mach_header*, intptr_t))GC_dyld_image_add); _dyld_register_func_for_remove_image( (void (*)(const struct mach_header*, intptr_t))GC_dyld_image_remove); - /* Structure mach_header64 has the same fields */ + /* Structure mach_header_64 has the same fields */ /* as mach_header except for the reserved one */ /* at the end, so these casts are OK. */
View file
_service:tar_scm:gc-8.2.4.tar.gz/extra/symbian/init_global_static_roots.cpp -> _service:tar_scm:gc-8.2.6.tar.gz/extra/symbian/init_global_static_roots.cpp
Changed
@@ -10,8 +10,8 @@ void GC_init_global_static_roots() { - ptr_t dataStart = NULL; - ptr_t dataEnd = NULL; + ptr_t dataStart; + ptr_t dataEnd; # if defined (__WINS__) extern int winscw_data_start, winscw_data_end; dataStart = ((ptr_t)&winscw_data_start);
View file
_service:tar_scm:gc-8.2.4.tar.gz/finalize.c -> _service:tar_scm:gc-8.2.6.tar.gz/finalize.c
Changed
@@ -1298,12 +1298,15 @@ /* This is a convenient place to generate backtraces if appropriate, */ /* since that code is not callable with the allocation lock. */ # if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) - if (GC_gc_no > last_back_trace_gc_no) { + if (GC_gc_no != last_back_trace_gc_no) { # ifdef KEEP_BACK_PTRS - long i; - /* Stops when GC_gc_no wraps; that's OK. */ - last_back_trace_gc_no = GC_WORD_MAX; /* disable others. */ - for (i = 0; i < GC_backtraces; ++i) { + static GC_bool bt_in_progress = FALSE; + + if (!bt_in_progress) { + long i; + + bt_in_progress = TRUE; /* prevent recursion or parallel usage */ + for (i = 0; i < GC_backtraces; ++i) { /* FIXME: This tolerates concurrent heap mutation, */ /* which may cause occasional mysterious results. */ /* We need to release the GC lock, since GC_print_callers */ @@ -1314,9 +1317,11 @@ GC_printf("\n****Chosen address %p in object\n", current); GC_print_backtrace(current); LOCK(); + } + bt_in_progress = FALSE; } - last_back_trace_gc_no = GC_gc_no; # endif + last_back_trace_gc_no = GC_gc_no; # ifdef MAKE_BACK_GRAPH if (GC_print_back_height) { GC_print_back_graph_stats();
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/cord_pos.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/cord_pos.h
Changed
@@ -67,8 +67,8 @@ /* Fetch the character located at the given position: */ CORD_API char CORD_pos_fetch(CORD_pos p); -/* Initialize the position to refer to the give cord and index. */ -/* Note that this is the most expensive function on positions: */ +/* Initialize the position to refer to the given cord and index. */ +/* Note that this is the most expensive function on positions. */ CORD_API void CORD_set_pos(CORD_pos p, CORD x, size_t i); /* Advance the position to the next character. */ @@ -118,7 +118,7 @@ /* 0 < n < CORD_pos_chars_left(p). */ #define CORD_pos_cur_char_addr(p) \ - (p)0.cur_leaf + ((p)0.cur_pos - (p)0.cur_start) + ((p)0.cur_leaf + ((p)0.cur_pos - (p)0.cur_start)) /* Address of the current character in cache. */ #ifdef __cplusplus
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/gc_allocator.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/gc_allocator.h
Changed
@@ -124,38 +124,44 @@ typedef gc_allocator<GC_Tp1> other; }; - gc_allocator() GC_NOEXCEPT {} - gc_allocator(const gc_allocator&) GC_NOEXCEPT {} + GC_CONSTEXPR gc_allocator() GC_NOEXCEPT {} + GC_CONSTEXPR gc_allocator(const gc_allocator&) GC_NOEXCEPT {} # ifndef GC_NO_MEMBER_TEMPLATES template <class GC_Tp1> GC_ATTR_EXPLICIT - gc_allocator(const gc_allocator<GC_Tp1>&) GC_NOEXCEPT {} + GC_CONSTEXPR gc_allocator(const gc_allocator<GC_Tp1>&) GC_NOEXCEPT {} # endif - ~gc_allocator() GC_NOEXCEPT {} + GC_CONSTEXPR ~gc_allocator() GC_NOEXCEPT {} - pointer address(reference GC_x) const { return &GC_x; } - const_pointer address(const_reference GC_x) const { return &GC_x; } + GC_CONSTEXPR pointer address(reference GC_x) const { return &GC_x; } + GC_CONSTEXPR const_pointer address(const_reference GC_x) const { + return &GC_x; + } // GC_n is permitted to be 0. The C++ standard says nothing about what // the return value is when GC_n == 0. - GC_Tp* allocate(size_type GC_n, const void* = 0) { + GC_CONSTEXPR GC_Tp* allocate(size_type GC_n, const void* = 0) { GC_type_traits<GC_Tp> traits; return static_cast<GC_Tp *>(GC_selective_alloc(GC_n * sizeof(GC_Tp), - traits.GC_is_ptr_free, - false)); + traits.GC_is_ptr_free, false)); } - void deallocate(pointer __p, size_type /* GC_n */) GC_NOEXCEPT - { GC_FREE(__p); } + GC_CONSTEXPR void deallocate(pointer __p, size_type /* GC_n */) GC_NOEXCEPT { + GC_FREE(__p); + } - size_type max_size() const GC_NOEXCEPT + GC_CONSTEXPR size_type max_size() const GC_NOEXCEPT { return size_t(-1) / sizeof(GC_Tp); } - void construct(pointer __p, const GC_Tp& __val) { new(__p) GC_Tp(__val); } - void destroy(pointer __p) { __p->~GC_Tp(); } + GC_CONSTEXPR void construct(pointer __p, const GC_Tp& __val) { + new(__p) GC_Tp(__val); + } + + GC_CONSTEXPR void destroy(pointer __p) { __p->~GC_Tp(); } }; template<> class gc_allocator<void> { +public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef void* pointer; @@ -169,16 +175,14 @@ template <class GC_T1, class GC_T2> -inline bool operator==(const gc_allocator<GC_T1>&, - const gc_allocator<GC_T2>&) GC_NOEXCEPT -{ +GC_CONSTEXPR inline bool operator==(const gc_allocator<GC_T1>&, + const gc_allocator<GC_T2>&) GC_NOEXCEPT { return true; } template <class GC_T1, class GC_T2> -inline bool operator!=(const gc_allocator<GC_T1>&, - const gc_allocator<GC_T2>&) GC_NOEXCEPT -{ +GC_CONSTEXPR inline bool operator!=(const gc_allocator<GC_T1>&, + const gc_allocator<GC_T2>&) GC_NOEXCEPT { return false; } @@ -199,40 +203,46 @@ typedef gc_allocator_ignore_off_page<GC_Tp1> other; }; - gc_allocator_ignore_off_page() GC_NOEXCEPT {} - gc_allocator_ignore_off_page(const gc_allocator_ignore_off_page&) - GC_NOEXCEPT {} + GC_CONSTEXPR gc_allocator_ignore_off_page() GC_NOEXCEPT {} + GC_CONSTEXPR gc_allocator_ignore_off_page( + const gc_allocator_ignore_off_page&) GC_NOEXCEPT {} # ifndef GC_NO_MEMBER_TEMPLATES template <class GC_Tp1> GC_ATTR_EXPLICIT - gc_allocator_ignore_off_page(const gc_allocator_ignore_off_page<GC_Tp1>&) - GC_NOEXCEPT {} + GC_CONSTEXPR gc_allocator_ignore_off_page( + const gc_allocator_ignore_off_page<GC_Tp1>&) GC_NOEXCEPT {} # endif - ~gc_allocator_ignore_off_page() GC_NOEXCEPT {} + GC_CONSTEXPR ~gc_allocator_ignore_off_page() GC_NOEXCEPT {} - pointer address(reference GC_x) const { return &GC_x; } - const_pointer address(const_reference GC_x) const { return &GC_x; } + GC_CONSTEXPR pointer address(reference GC_x) const { return &GC_x; } + GC_CONSTEXPR const_pointer address(const_reference GC_x) const { + return &GC_x; + } // GC_n is permitted to be 0. The C++ standard says nothing about what // the return value is when GC_n == 0. - GC_Tp* allocate(size_type GC_n, const void* = 0) { + GC_CONSTEXPR GC_Tp* allocate(size_type GC_n, const void* = 0) { GC_type_traits<GC_Tp> traits; return static_cast<GC_Tp *>(GC_selective_alloc(GC_n * sizeof(GC_Tp), - traits.GC_is_ptr_free, - true)); + traits.GC_is_ptr_free, true)); } - void deallocate(pointer __p, size_type /* GC_n */) GC_NOEXCEPT - { GC_FREE(__p); } + GC_CONSTEXPR void deallocate(pointer __p, size_type /* GC_n */) GC_NOEXCEPT { + GC_FREE(__p); + } - size_type max_size() const GC_NOEXCEPT + GC_CONSTEXPR size_type max_size() const GC_NOEXCEPT { return size_t(-1) / sizeof(GC_Tp); } - void construct(pointer __p, const GC_Tp& __val) { new(__p) GC_Tp(__val); } - void destroy(pointer __p) { __p->~GC_Tp(); } + GC_CONSTEXPR void construct(pointer __p, const GC_Tp& __val) { + new(__p) GC_Tp(__val); + } + + GC_CONSTEXPR void destroy(pointer __p) { __p->~GC_Tp(); } }; template<> class gc_allocator_ignore_off_page<void> { +public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef void* pointer; @@ -245,16 +255,14 @@ }; template <class GC_T1, class GC_T2> -inline bool operator==(const gc_allocator_ignore_off_page<GC_T1>&, - const gc_allocator_ignore_off_page<GC_T2>&) GC_NOEXCEPT -{ +GC_CONSTEXPR inline bool operator==(const gc_allocator_ignore_off_page<GC_T1>&, + const gc_allocator_ignore_off_page<GC_T2>&) GC_NOEXCEPT { return true; } template <class GC_T1, class GC_T2> -inline bool operator!=(const gc_allocator_ignore_off_page<GC_T1>&, - const gc_allocator_ignore_off_page<GC_T2>&) GC_NOEXCEPT -{ +GC_CONSTEXPR inline bool operator!=(const gc_allocator_ignore_off_page<GC_T1>&, + const gc_allocator_ignore_off_page<GC_T2>&) GC_NOEXCEPT { return false; } @@ -280,38 +288,46 @@ typedef traceable_allocator<GC_Tp1> other; }; - traceable_allocator() GC_NOEXCEPT {} - traceable_allocator(const traceable_allocator&) GC_NOEXCEPT {} + GC_CONSTEXPR traceable_allocator() GC_NOEXCEPT {} + GC_CONSTEXPR traceable_allocator(const traceable_allocator&) GC_NOEXCEPT {} # ifndef GC_NO_MEMBER_TEMPLATES template <class GC_Tp1> GC_ATTR_EXPLICIT - traceable_allocator(const traceable_allocator<GC_Tp1>&) GC_NOEXCEPT {} + GC_CONSTEXPR traceable_allocator( + const traceable_allocator<GC_Tp1>&) GC_NOEXCEPT {} # endif - ~traceable_allocator() GC_NOEXCEPT {} + GC_CONSTEXPR ~traceable_allocator() GC_NOEXCEPT {} - pointer address(reference GC_x) const { return &GC_x; } - const_pointer address(const_reference GC_x) const { return &GC_x; } + GC_CONSTEXPR pointer address(reference GC_x) const { return &GC_x; } + GC_CONSTEXPR const_pointer address(const_reference GC_x) const { + return &GC_x; + } // GC_n is permitted to be 0. The C++ standard says nothing about what // the return value is when GC_n == 0. - GC_Tp* allocate(size_type GC_n, const void* = 0) { + GC_CONSTEXPR GC_Tp* allocate(size_type GC_n, const void* = 0) { void * obj = GC_MALLOC_UNCOLLECTABLE(GC_n * sizeof(GC_Tp)); if (0 == obj) GC_ALLOCATOR_THROW_OR_ABORT(); return static_cast<GC_Tp*>(obj); } - void deallocate(pointer __p, size_type /* GC_n */) GC_NOEXCEPT - { GC_FREE(__p); }
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/gc_backptr.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/gc_backptr.h
Changed
@@ -49,11 +49,10 @@ /* Store information about the object referencing dest in *base_p */ /* and *offset_p. */ /* If multiple objects or roots point to dest, the one reported */ -/* will be the last on used by the garbage collector to trace the */ +/* will be the last one used by the garbage collector to trace the */ /* object. */ /* source is root ==> *base_p = address, *offset_p = 0 */ /* source is heap object ==> *base_p != 0, *offset_p = offset */ -/* Returns 1 on success, 0 if source couldn't be determined. */ /* Dest can be any address within a heap object. */ typedef enum { GC_UNREFERENCED, /* No reference info available. */
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/gc_config_macros.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/gc_config_macros.h
Changed
@@ -385,7 +385,7 @@ # endif # if (defined(GC_DARWIN_THREADS) || defined(GC_WIN32_PTHREADS) \ - || defined(GC_OPENBSD_THREADS) || defined(__native_client__)) \ + || defined(__native_client__)) \ && !defined(GC_NO_PTHREAD_SIGMASK) /* Either there is no pthread_sigmask() or no need to intercept it. */ # define GC_NO_PTHREAD_SIGMASK @@ -453,6 +453,14 @@ # endif #endif +#ifndef GC_CONSTEXPR +# if __cplusplus >= 202002L +# define GC_CONSTEXPR constexpr +# else +# define GC_CONSTEXPR /* empty */ +# endif +#endif + #endif /* __cplusplus */ #endif
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/gc_mark.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/gc_mark.h
Changed
@@ -82,14 +82,14 @@ /* Object descriptors on mark stack or in objects. Low order two */ /* bits are tags distinguishing among the following 4 possibilities */ -/* for the high order 30 bits. */ +/* for the rest (high order) bits. */ #define GC_DS_TAG_BITS 2 #define GC_DS_TAGS ((1 << GC_DS_TAG_BITS) - 1) #define GC_DS_LENGTH 0 /* The entire word is a length in bytes that */ /* must be a multiple of 4. */ -#define GC_DS_BITMAP 1 /* 30 (62) bits are a bitmap describing pointer */ - /* fields. The msb is 1 if the first word */ - /* is a pointer. */ +#define GC_DS_BITMAP 1 /* The high order bits are describing pointer */ + /* fields. The most significant bit is set if */ + /* the first word is a pointer. */ /* (This unconventional ordering sometimes */ /* makes the marker slightly faster.) */ /* Zeroes indicate definite nonpointers. Ones */ @@ -101,7 +101,7 @@ /* PROC(descr). ENV(descr) is passed as the */ /* last argument. */ #define GC_MAKE_PROC(proc_index, env) \ - (((((env) << GC_LOG_MAX_MARK_PROCS) \ + ((((((GC_word)(env)) << GC_LOG_MAX_MARK_PROCS) \ | (proc_index)) << GC_DS_TAG_BITS) | GC_DS_PROC) #define GC_DS_PER_OBJECT 3 /* The real descriptor is at the */ /* byte displacement from the beginning of the */
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/gc_pthread_redirects.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/gc_pthread_redirects.h
Changed
@@ -56,9 +56,10 @@ # endif /* !GC_NO_DLOPEN */ # ifndef GC_NO_PTHREAD_SIGMASK -# if defined(GC_PTHREAD_SIGMASK_NEEDED) \ - || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) \ - || (_POSIX_C_SOURCE >= 199506L) || (_XOPEN_SOURCE >= 500) +# if defined(GC_PTHREAD_SIGMASK_NEEDED) || defined(_BSD_SOURCE) \ + || defined(_GNU_SOURCE) || defined(_NETBSD_SOURCE) \ + || (_POSIX_C_SOURCE >= 199506L) || (_XOPEN_SOURCE >= 500) \ + || (__POSIX_VISIBLE >= 199506) /* xBSD internal macro */ GC_API int GC_pthread_sigmask(int /* how */, const sigset_t *, sigset_t * /* oset */); # else
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/gc_version.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/gc_version.h
Changed
@@ -30,7 +30,7 @@ /* it to keep the old-style build process working. */ #define GC_TMP_VERSION_MAJOR 8 #define GC_TMP_VERSION_MINOR 2 -#define GC_TMP_VERSION_MICRO 4 /* 8.2.4 */ +#define GC_TMP_VERSION_MICRO 6 /* 8.2.6 */ #ifdef GC_VERSION_MAJOR # if GC_TMP_VERSION_MAJOR != GC_VERSION_MAJOR \
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/private/dbg_mlc.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/private/dbg_mlc.h
Changed
@@ -80,7 +80,7 @@ /* We're careful never to overwrite a value with lsb 0. */ # if ALIGNMENT == 1 /* Fudge back pointer to be even. */ -# define HIDE_BACK_PTR(p) GC_HIDE_POINTER(~1 & (word)(p)) +# define HIDE_BACK_PTR(p) GC_HIDE_POINTER(~(word)1 & (word)(p)) # else # define HIDE_BACK_PTR(p) GC_HIDE_POINTER(p) # endif
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/private/gc_locks.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/private/gc_locks.h
Changed
@@ -145,8 +145,6 @@ # define USE_SPIN_LOCK GC_EXTERN volatile AO_TS_t GC_allocate_lock; GC_INNER void GC_lock(void); - /* Allocation lock holder. Only set if acquired by client through */ - /* GC_call_with_alloc_lock. */ # ifdef GC_ASSERTIONS # define UNCOND_LOCK() \ { GC_ASSERT(I_DONT_HOLD_LOCK()); \ @@ -193,6 +191,7 @@ # endif /* USE_PTHREAD_LOCKS */ # ifdef GC_ASSERTIONS GC_EXTERN unsigned long GC_lock_holder; + /* The allocator lock holder. */ # define SET_LOCK_HOLDER() \ GC_lock_holder = NUMERIC_THREAD_ID(pthread_self()) # define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/private/gc_pmark.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/private/gc_pmark.h
Changed
@@ -83,7 +83,7 @@ * The initiating threads holds the GC lock, and sets GC_help_wanted. * * Other threads: - * 1) update helper_count (while holding mark_lock.) + * 1) update helper_count (while holding the mark lock). * 2) allocate a local mark stack * repeatedly: * 3) Steal a global mark stack entry by atomically replacing @@ -94,7 +94,7 @@ * 6) If necessary, copy local stack to global one, * holding mark lock. * 7) Stop when the global mark stack is empty. - * 8) decrement helper_count (holding mark_lock). + * 8) decrement helper_count (holding the mark lock). * * This is an experiment to see if we can do something along the lines * of the University of Tokyo SGC in a less intrusive, though probably @@ -234,7 +234,7 @@ # define LONG_MULT(hprod, lprod, x, y) \ do { \ __asm__ __volatile__("mull %2" : "=a"(lprod), "=d"(hprod) \ - : "g"(y), "0"(x)); \ + : "r"(y), "0"(x)); \ } while (0) #else # if defined(__int64) && !defined(__GNUC__) && !defined(CPPCHECK) @@ -246,7 +246,7 @@ do { \ ULONG_MULT_T prod = (ULONG_MULT_T)(x) * (ULONG_MULT_T)(y); \ GC_STATIC_ASSERT(sizeof(x) + sizeof(y) <= sizeof(prod)); \ - hprod = prod >> 32; \ + hprod = (unsigned32)(prod >> 32); \ lprod = (unsigned32)prod; \ } while (0) #endif /* !I386 */ @@ -369,7 +369,7 @@ /* * Push a single value onto mark stack. Mark from the object pointed to by p. - * Invoke FIXUP_POINTER(p) before any further processing. + * Invoke FIXUP_POINTER() before any further processing. * P is considered valid even if it is an interior pointer. * Previously marked objects are not pushed. Hence we make progress even * if the mark stack overflows. @@ -379,14 +379,16 @@ /* Try both the raw version and the fixed up one. */ # define GC_PUSH_ONE_STACK(p, source) \ do { \ + word pp = (word)(p); \ + \ if ((word)(p) >= (word)GC_least_plausible_heap_addr \ && (word)(p) < (word)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ } \ - FIXUP_POINTER(p); \ - if ((word)(p) >= (word)GC_least_plausible_heap_addr \ - && (word)(p) < (word)GC_greatest_plausible_heap_addr) { \ - PUSH_ONE_CHECKED_STACK(p, source); \ + FIXUP_POINTER(pp); \ + if (pp >= (word)GC_least_plausible_heap_addr \ + && pp < (word)GC_greatest_plausible_heap_addr) { \ + PUSH_ONE_CHECKED_STACK(pp, source); \ } \ } while (0) #else /* !NEED_FIXUP_POINTER */
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/private/gc_priv.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/private/gc_priv.h
Changed
@@ -27,7 +27,8 @@ #endif #if (defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) \ - || defined(__CYGWIN__) || defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) \ + || defined(__CYGWIN__) || defined(HAVE_DLADDR) \ + || defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) \ || defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG) \ || defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)) && !defined(_GNU_SOURCE) /* Can't test LINUX, since this must be defined before other includes. */ @@ -186,9 +187,7 @@ # define GC_ATTR_WORD_ALIGNED /* empty */ #endif -#ifndef HEADERS_H -# include "gc_hdrs.h" -#endif +#include "gc_hdrs.h" #ifndef GC_ATTR_NO_SANITIZE_ADDR # ifndef ADDRESS_SANITIZER @@ -224,7 +223,7 @@ #endif /* !GC_ATTR_NO_SANITIZE_THREAD */ #ifndef GC_ATTR_UNUSED -# if GC_GNUC_PREREQ(3, 4) +# if GC_GNUC_PREREQ(3, 4) || defined(__clang__) # define GC_ATTR_UNUSED __attribute__((__unused__)) # else # define GC_ATTR_UNUSED /* empty */ @@ -991,7 +990,7 @@ /* Round up allocation size (in bytes) to a multiple of a granule. */ #define ROUNDUP_GRANULE_SIZE(lb) /* lb should have no side-effect */ \ - (SIZET_SAT_ADD(lb, GRANULE_BYTES - 1) & ~(GRANULE_BYTES - 1)) + (SIZET_SAT_ADD(lb, GRANULE_BYTES-1) & ~(size_t)(GRANULE_BYTES-1)) /* Round up byte allocation requests to integral number of words, etc. */ # define ROUNDED_UP_GRANULES(lb) /* lb should have no side-effect */ \ @@ -1936,9 +1935,11 @@ GC_INNER GC_bool GC_collection_in_progress(void); /* Collection is in progress, or was abandoned. */ -#define GC_PUSH_ALL_SYM(sym) \ - GC_push_all((/* no volatile */ void *)&(sym), \ - (/* no volatile */ void *)(&(sym) + 1)) +/* Push contents of the symbol residing in the static roots area */ +/* excluded from scanning by the the collector for a reason. */ +/* Note: it should be used only for symbols of relatively small size */ +/* (one or several words). */ +#define GC_PUSH_ALL_SYM(sym) GC_push_all_eager(&(sym), &(sym) + 1) GC_INNER void GC_push_all_stack(ptr_t b, ptr_t t); /* As GC_push_all but consider */ @@ -2447,9 +2448,24 @@ GC_EXTERN long GC_backtraces; #endif -#ifdef LINT2 -# define GC_RAND_MAX (~0U >> 1) - GC_API_PRIV long GC_random(void); +/* A trivial (linear congruential) pseudo-random numbers generator, */ +/* safe for the concurrent usage. */ +#define GC_RAND_MAX ((int)(~0U >> 1)) +#if defined(AO_HAVE_store) && defined(THREAD_SANITIZER) +# define GC_RAND_STATE_T volatile AO_t +# define GC_RAND_NEXT(pseed) GC_rand_next(pseed) + GC_INLINE int GC_rand_next(GC_RAND_STATE_T *pseed) + { + AO_t next = (AO_t)((AO_load(pseed) * 1103515245U + 12345) + & (unsigned)GC_RAND_MAX); + AO_store(pseed, next); + return (int)next; + } +#else +# define GC_RAND_STATE_T unsigned +# define GC_RAND_NEXT(pseed) /* overflow and race are OK */ \ + (int)(*(pseed) = (*(pseed) * 1103515245U + 12345) \ + & (unsigned)GC_RAND_MAX) #endif GC_EXTERN GC_bool GC_print_back_height; @@ -2501,7 +2517,7 @@ /* Compute end address for an unmap operation on the indicated block. */ GC_INLINE ptr_t GC_unmap_end(ptr_t start, size_t bytes) { - return (ptr_t)((word)(start + bytes) & ~(GC_page_size - 1)); + return (ptr_t)((word)(start + bytes) & ~(word)(GC_page_size-1)); } # endif #endif /* USE_MUNMAP */ @@ -2562,7 +2578,8 @@ # endif # ifdef CAN_HANDLE_FORK -# if defined(PROC_VDB) || defined(SOFT_VDB) +# if defined(PROC_VDB) || defined(SOFT_VDB) \ + || (defined(MPROTECT_VDB) && defined(GC_DARWIN_THREADS)) GC_INNER void GC_dirty_update_child(void); /* Update pid-specific resources (like /proc file */ /* descriptors) needed by the dirty bits implementation */ @@ -2572,6 +2589,19 @@ # endif # endif /* CAN_HANDLE_FORK */ +# if defined(MPROTECT_VDB) && defined(DARWIN) + EXTERN_C_END +# include <pthread.h> + EXTERN_C_BEGIN +# ifdef THREADS + GC_INNER int GC_inner_pthread_create(pthread_t *t, + GC_PTHREAD_CREATE_CONST pthread_attr_t *a, + void *(*fn)(void *), void *arg); +# else +# define GC_inner_pthread_create pthread_create +# endif +# endif /* MPROTECT_VDB && DARWIN */ + GC_INNER GC_bool GC_dirty_init(void); /* Returns true if dirty bits are maintained (otherwise */ /* it is OK to be called again if the client invokes */ @@ -2763,7 +2793,7 @@ #endif #ifdef CHECKSUMS -# if defined(MPROTECT_VDB) && !defined(DARWIN) +# ifdef MPROTECT_VDB void GC_record_fault(struct hblk * h); # endif void GC_check_dirty(void); @@ -2786,6 +2816,13 @@ GC_INNER void *GC_store_debug_info_inner(void *p, word sz, const char *str, int linenum); +#if defined(REDIRECT_MALLOC) && !defined(REDIRECT_MALLOC_IN_HEADER) \ + && defined(GC_LINUX_THREADS) + GC_INNER void GC_init_lib_bounds(void); +#else +# define GC_init_lib_bounds() (void)0 +#endif + #ifdef REDIRECT_MALLOC # ifdef GC_LINUX_THREADS GC_INNER GC_bool GC_text_mapping(char *nm, ptr_t *startp, ptr_t *endp); @@ -2855,7 +2892,7 @@ void * GC_find_limit(void *, int); #endif -#ifdef UNIX_LIKE +#if defined(UNIX_LIKE) && !defined(NO_DEBUGGING) GC_INNER void GC_set_and_save_fault_handler(void (*handler)(int)); #endif @@ -2993,7 +3030,7 @@ # elif (defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS)) \ && !defined(GC_USESIGRT_SIGNALS) # if defined(SPARC) && !defined(SIGPWR) - /* SPARC/Linux doesn't properly define SIGPWR in <signal.h>. */ + /* Linux/SPARC doesn't properly define SIGPWR in <signal.h>. */ /* It is aliased to SIGLOST in asm/signal.h, though. */ # define SIG_SUSPEND SIGLOST # else
View file
_service:tar_scm:gc-8.2.4.tar.gz/include/private/gcconfig.h -> _service:tar_scm:gc-8.2.6.tar.gz/include/private/gcconfig.h
Changed
@@ -26,6 +26,13 @@ #ifndef GCCONFIG_H #define GCCONFIG_H +#ifndef GC_H +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif +# include "../gc.h" +#endif + #ifdef CPPCHECK # undef CLOCKS_PER_SEC # undef FIXUP_POINTER @@ -156,13 +163,12 @@ # endif # if defined(__arm) || defined(__arm__) || defined(__thumb__) # define ARM32 -# if defined(NACL) +# if defined(NACL) || defined(SYMBIAN) # define mach_type_known # elif !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) \ && !defined(OPENBSD) && !defined(DARWIN) && !defined(_WIN32) \ && !defined(__CEGCC__) && !defined(NN_PLATFORM_CTR) \ - && !defined(GC_NO_NOSYS) && !defined(SN_TARGET_PSP2) \ - && !defined(SYMBIAN) + && !defined(GC_NO_NOSYS) && !defined(SN_TARGET_PSP2) # define NOSYS # define mach_type_known # endif @@ -682,7 +688,7 @@ # define mach_type_known # endif # if defined(__riscv) && (defined(FREEBSD) || defined(LINUX) \ - || defined(OPENBSD)) + || defined(NETBSD) || defined(OPENBSD)) # define RISCV # define mach_type_known # endif @@ -700,10 +706,6 @@ # define mach_type_known # endif -# if defined(SYMBIAN) -# define mach_type_known -# endif - # if defined(__EMSCRIPTEN__) || defined(EMSCRIPTEN) # ifndef EMSCRIPTEN # define EMSCRIPTEN @@ -1112,13 +1114,15 @@ # define STACK_GRAN 0x1000000 # ifdef SYMBIAN -# define MACH_TYPE "SYMBIAN" # define OS_TYPE "SYMBIAN" -# define CPP_WORDSZ 32 # define ALIGNMENT 4 # define DATASTART (ptr_t)ALIGNMENT /* cannot be null */ # define DATAEND (ptr_t)ALIGNMENT -# endif +# ifndef USE_MMAP + /* sbrk() is not available. */ +# define USE_MMAP 1 +# endif +# endif /* SYMBIAN */ # ifdef M68K # define MACH_TYPE "M68K" @@ -1158,7 +1162,7 @@ # endif /* !GLIBC2 */ # else extern int etext; -# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff)) +# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~(word)0xfff)) # endif # endif # ifdef AMIGA @@ -1423,7 +1427,7 @@ # ifdef SEQUENT # define OS_TYPE "SEQUENT" extern int etext; -# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff)) +# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~(word)0xfff)) # define STACKBOTTOM ((ptr_t)0x3ffff000) # endif # ifdef EMSCRIPTEN @@ -1451,7 +1455,7 @@ # endif # ifdef HAIKU extern int etext; -# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff)) +# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~(word)0xfff)) # endif # ifdef SOLARIS # define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext) @@ -1464,7 +1468,8 @@ # ifdef SCO # define OS_TYPE "SCO" extern int etext; -# define DATASTART ((ptr_t)((((word)(etext)) + 0x3fffff) & ~0x3fffff) \ +# define DATASTART ((ptr_t)((((word)(etext)) + 0x3fffff) \ + & ~(word)0x3fffff) \ + ((word)(etext) & 0xfff)) # define STACKBOTTOM ((ptr_t)0x7ffffffc) # endif @@ -1536,7 +1541,7 @@ # endif # else extern int etext; -# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff)) +# define DATASTART ((ptr_t)(((word)(etext) + 0xfff) & ~(word)0xfff)) # endif # ifdef USE_I686_PREFETCH # define PREFETCH(x) \ @@ -1617,7 +1622,7 @@ extern int etext; extern int _stklen; extern int __djgpp_stack_limit; -# define DATASTART ((ptr_t)((((word)(etext)) + 0x1ff) & ~0x1ff)) +# define DATASTART ((ptr_t)((((word)(etext)) + 0x1ff) & ~(word)0x1ff)) /* #define STACKBOTTOM ((ptr_t)((word)_stubinfo+_stubinfo->size+_stklen)) */ # define STACKBOTTOM ((ptr_t)((word)__djgpp_stack_limit + _stklen)) /* This may not be right. */ @@ -1756,12 +1761,13 @@ extern int end; # endif extern int _DYNAMIC_LINKING, _gp; -# define DATASTART ((ptr_t)((((word)(etext) + 0x3ffff) & ~0x3ffff) \ +# define DATASTART ((ptr_t)((((word)(etext) + 0x3ffff) \ + & ~(word)0x3ffff) \ + ((word)(etext) & 0xffff))) # define DATAEND ((ptr_t)(edata)) # define GC_HAVE_DATAREGION2 # define DATASTART2 (_DYNAMIC_LINKING \ - ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \ + ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~(word)0x3ffff) \ : (ptr_t)edata) # define DATAEND2 ((ptr_t)(end)) # define ALIGNMENT 4 @@ -1956,7 +1962,8 @@ /* Hence we give an upper pound. */ /* This is currently unused, since we disabled HEURISTIC2 */ extern int __start; -# define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1))) +# define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) \ + & ~(word)(getpagesize()-1))) # ifndef GC_OSF1_THREADS /* Unresolved signal issues with threads. */ # define MPROTECT_VDB @@ -2079,7 +2086,8 @@ extern int etext; # ifdef CX_UX # define OS_TYPE "CX_UX" -# define DATASTART ((ptr_t)((((word)(etext) + 0x3fffff) & ~0x3fffff) \ +# define DATASTART ((ptr_t)((((word)(etext) + 0x3fffff) \ + & ~(word)0x3fffff) \ + 0x10000)) # endif # ifdef DGUX @@ -2160,14 +2168,18 @@ # endif # endif # ifdef DARWIN - /* iOS */ + /* OS X, iOS */ # define DARWIN_DONT_PARSE_STACK 1 # define STACKBOTTOM ((ptr_t)0x16fdfffff) - /* MPROTECT_VDB causes use of non-public API like exc_server, */ - /* this could be a reason for blocking the client application in */ - /* the store. */ -# if TARGET_OS_IPHONE && !defined(NO_DYLD_BIND_FULLY_IMAGE) -# define NO_DYLD_BIND_FULLY_IMAGE +# if TARGET_OS_IPHONE +# ifndef NO_DYLD_BIND_FULLY_IMAGE +# define NO_DYLD_BIND_FULLY_IMAGE +# endif + /* MPROTECT_VDB causes use of non-public API like exc_server, */ + /* this could be a reason for blocking the client application */ + /* in the store. */ +# elif TARGET_OS_OSX +# define MPROTECT_VDB # endif # endif # ifdef FREEBSD @@ -2279,7 +2291,10 @@ extern void *__stack_base__; # define STACKBOTTOM ((ptr_t)(__stack_base__)) # endif -#endif +# ifdef SYMBIAN + /* Nothing specific. */ +# endif +# endif /* ARM32 */ # ifdef CRIS # define MACH_TYPE "CRIS" @@ -2547,6 +2562,9 @@ extern int __data_start __attribute__((__weak__)); # define DATASTART ((ptr_t)__data_start)
View file
_service:tar_scm:gc-8.2.4.tar.gz/mach_dep.c -> _service:tar_scm:gc-8.2.6.tar.gz/mach_dep.c
Changed
@@ -405,7 +405,8 @@ } # if defined(MSWIN32) || defined(MSWINCE) || defined(UTS4) \ || defined(OS2) || defined(CX_UX) || defined(__CC_ARM) \ - || defined(LINUX) || defined(EWS4800) || defined(RTEMS) + || defined(LINUX) || defined(EWS4800) || defined(RTEMS) \ + || defined(DJGPP) (void) setjmp(regs); # else (void) _setjmp(regs);
View file
_service:tar_scm:gc-8.2.4.tar.gz/malloc.c -> _service:tar_scm:gc-8.2.6.tar.gz/malloc.c
Changed
@@ -136,14 +136,14 @@ /* For these larger sizes, we use an even number of granules. */ /* This makes it easier to, e.g., construct a 16-byte-aligned */ /* allocator even if GRANULE_BYTES is 8. */ - granule_sz = (granule_sz + 1) & ~1; + granule_sz = (granule_sz + 1) & ~(size_t)1; if (granule_sz > MAXOBJGRANULES) granule_sz = MAXOBJGRANULES; /* If we can fit the same number of larger objects in a block, do so. */ number_of_objs = HBLK_GRANULES / granule_sz; GC_ASSERT(number_of_objs != 0); - granule_sz = (HBLK_GRANULES / number_of_objs) & ~1; + granule_sz = (HBLK_GRANULES / number_of_objs) & ~(size_t)1; byte_sz = GRANULES_TO_BYTES(granule_sz) - EXTRA_BYTES; /* We may need one extra byte; do not always */ @@ -470,14 +470,22 @@ STATIC ptr_t GC_libpthread_end = 0; STATIC ptr_t GC_libld_start = 0; STATIC ptr_t GC_libld_end = 0; + static GC_bool lib_bounds_set = FALSE; - STATIC void GC_init_lib_bounds(void) + GC_INNER void GC_init_lib_bounds(void) { IF_CANCEL(int cancel_state;) + DCL_LOCK_STATE; + + /* This test does not need to ensure memory visibility, since */ + /* the bounds will be set when/if we create another thread. */ + if (EXPECT(lib_bounds_set, TRUE)) return; - if (GC_libpthread_start != 0) return; DISABLE_CANCEL(cancel_state); GC_init(); /* if not called yet */ +# if defined(GC_ASSERTIONS) && defined(GC_ALWAYS_MULTITHREADED) + LOCK(); /* just to set GC_lock_holder */ +# endif if (!GC_text_mapping("libpthread-", &GC_libpthread_start, &GC_libpthread_end)) { /* Some libc implementations like bionic, musl and glibc 2.34 */ @@ -493,13 +501,15 @@ /* This might still work with some versions of libpthread, */ /* so we do not abort. */ # endif - /* Generate message only once: */ - GC_libpthread_start = (ptr_t)1; } if (!GC_text_mapping("ld-", &GC_libld_start, &GC_libld_end)) { WARN("Failed to find ld.so text mapping: Expect crash\n", 0); } +# if defined(GC_ASSERTIONS) && defined(GC_ALWAYS_MULTITHREADED) + UNLOCK(); +# endif RESTORE_CANCEL(cancel_state); + lib_bounds_set = TRUE; } # endif /* GC_LINUX_THREADS */ @@ -512,14 +522,9 @@ /* libpthread allocated some memory that is only pointed to by */ /* mmapped thread stacks. Make sure it is not collectible. */ { - static GC_bool lib_bounds_set = FALSE; ptr_t caller = (ptr_t)__builtin_return_address(0); - /* This test does not need to ensure memory visibility, since */ - /* the bounds will be set when/if we create another thread. */ - if (!EXPECT(lib_bounds_set, TRUE)) { - GC_init_lib_bounds(); - lib_bounds_set = TRUE; - } + + GC_init_lib_bounds(); if (((word)caller >= (word)GC_libpthread_start && (word)caller < (word)GC_libpthread_end) || ((word)caller >= (word)GC_libld_start @@ -698,7 +703,7 @@ # define REDIRECT_FREE_F REDIRECT_FREE # endif - void free(void * p) + void free(void * p GC_ATTR_UNUSED) { # ifndef IGNORE_FREE # if defined(GC_LINUX_THREADS) && !defined(USE_PROC_FOR_LIBRARIES)
View file
_service:tar_scm:gc-8.2.4.tar.gz/mallocx.c -> _service:tar_scm:gc-8.2.6.tar.gz/mallocx.c
Changed
@@ -536,8 +536,10 @@ /* This one exists largely to redirect posix_memalign for leaks finding. */ GC_API int GC_CALL GC_posix_memalign(void **memptr, size_t align, size_t lb) { - /* Check alignment properly. */ + void *p; size_t align_minus_one = align - 1; /* to workaround a cppcheck warning */ + + /* Check alignment properly. */ if (align < sizeof(void *) || (align_minus_one & align) != 0) { # ifdef MSWINCE return ERROR_INVALID_PARAMETER; @@ -546,14 +548,16 @@ # endif } - if ((*memptr = GC_memalign(align, lb)) == NULL) { + p = GC_memalign(align, lb); + if (EXPECT(NULL == p, FALSE)) { # ifdef MSWINCE return ERROR_NOT_ENOUGH_MEMORY; # else return ENOMEM; # endif } - return 0; + *memptr = p; + return 0; /* success */ } /* provide a version of strdup() that uses the collector to allocate the
View file
_service:tar_scm:gc-8.2.4.tar.gz/mark.c -> _service:tar_scm:gc-8.2.6.tar.gz/mark.c
Changed
@@ -546,7 +546,7 @@ /* The following is 0 only for small objects described by a simple */ /* length descriptor. For many applications this is the common */ /* case, so we try to detect it quickly. */ - if (descr & ((~(WORDS_TO_BYTES(SPLIT_RANGE_WORDS) - 1)) | GC_DS_TAGS)) { + if (descr & (~(word)(WORDS_TO_BYTES(SPLIT_RANGE_WORDS)-1) | GC_DS_TAGS)) { word tag = descr & GC_DS_TAGS; GC_STATIC_ASSERT(GC_DS_TAGS == 0x3); @@ -613,7 +613,7 @@ (unsigned long)descr); } # endif /* ENABLE_TRACE */ - descr &= ~GC_DS_TAGS; + descr &= ~(word)GC_DS_TAGS; credit -= WORDS_TO_BYTES(WORDSZ/2); /* guess */ for (; descr != 0; descr <<= 1, current_p += sizeof(word)) { if ((descr & SIGNB) == 0) continue; @@ -1198,8 +1198,8 @@ { word length; - bottom = (void *)(((word)bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); - top = (void *)((word)top & ~(ALIGNMENT-1)); + bottom = (void *)(((word)bottom + ALIGNMENT-1) & ~(word)(ALIGNMENT-1)); + top = (void *)((word)top & ~(word)(ALIGNMENT-1)); if ((word)bottom >= (word)top) return; GC_mark_stack_top++; @@ -1209,7 +1209,7 @@ length = (word)top - (word)bottom; # if GC_DS_TAGS > ALIGNMENT - 1 length += GC_DS_TAGS; - length &= ~GC_DS_TAGS; + length &= ~(word)GC_DS_TAGS; # endif GC_mark_stack_top -> mse_start = (ptr_t)bottom; GC_mark_stack_top -> mse_descr.w = length; @@ -1230,8 +1230,8 @@ { struct hblk * h; - bottom = (ptr_t)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); - top = (ptr_t)(((word) top) & ~(ALIGNMENT-1)); + bottom = (ptr_t)(((word)bottom + ALIGNMENT-1) & ~(word)(ALIGNMENT-1)); + top = (ptr_t)((word)top & ~(word)(ALIGNMENT-1)); if ((word)bottom >= (word)top) return; h = HBLKPTR(bottom + HBLKSIZE); @@ -1431,7 +1431,7 @@ if (GC_trace_buf_ptr >= TRACE_ENTRIES) GC_trace_buf_ptr = 0; } -GC_API void GC_CALL GC_print_trace_inner(word gc_no) +GC_API void GC_CALL GC_print_trace_inner(GC_word gc_no) { int i; @@ -1440,18 +1440,20 @@ if (i < 0) i = TRACE_ENTRIES-1; p = GC_trace_buf + i; - if (p -> gc_no < gc_no || p -> kind == 0) { + /* Compare gc_no values (p->gc_no is less than given gc_no) */ + /* taking into account that the counter may overflow. */ + if ((((p -> gc_no) - gc_no) & SIGNB) != 0 || p -> kind == 0) { return; } GC_printf("Trace:%s (gc:%u, bytes:%lu) 0x%lX, 0x%lX\n", - p -> kind, (unsigned)p -> gc_no, - (unsigned long)p -> bytes_allocd, + p -> kind, (unsigned)(p -> gc_no), + (unsigned long)(p -> bytes_allocd), (long)p->arg1 ^ 0x80000000L, (long)p->arg2 ^ 0x80000000L); } GC_printf("Trace incomplete\n"); } -GC_API void GC_CALL GC_print_trace(word gc_no) +GC_API void GC_CALL GC_print_trace(GC_word gc_no) { DCL_LOCK_STATE; @@ -1467,8 +1469,8 @@ GC_ATTR_NO_SANITIZE_ADDR GC_ATTR_NO_SANITIZE_MEMORY GC_ATTR_NO_SANITIZE_THREAD GC_API void GC_CALL GC_push_all_eager(void *bottom, void *top) { - word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); - word * t = (word *)(((word) top) & ~(ALIGNMENT-1)); + word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(word)(ALIGNMENT-1)); + word * t = (word *)(((word) top) & ~(word)(ALIGNMENT-1)); REGISTER word *p; REGISTER word *lim; REGISTER ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr; @@ -1515,8 +1517,8 @@ GC_INNER void GC_push_conditional_eager(void *bottom, void *top, GC_bool all) { - word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); - word * t = (word *)(((word) top) & ~(ALIGNMENT-1)); + word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(word)(ALIGNMENT-1)); + word * t = (word *)(((word) top) & ~(word)(ALIGNMENT-1)); REGISTER word *p; REGISTER word *lim; REGISTER ptr_t greatest_ha = (ptr_t)GC_greatest_plausible_heap_addr;
View file
_service:tar_scm:gc-8.2.4.tar.gz/misc.c -> _service:tar_scm:gc-8.2.6.tar.gz/misc.c
Changed
@@ -281,7 +281,8 @@ # ifdef THREADS # define BIG_CLEAR_SIZE 2048 /* Clear this much now and then. */ # else - STATIC word GC_stack_last_cleared = 0; /* GC_no when we last did this */ + STATIC word GC_stack_last_cleared = 0; + /* GC_gc_no value when we last did this. */ STATIC ptr_t GC_min_sp = NULL; /* Coolest stack pointer value from which */ /* we've already cleared the stack. */ @@ -363,22 +364,22 @@ ptr_t limit = sp; MAKE_HOTTER(limit, BIG_CLEAR_SIZE*sizeof(word)); - limit = (ptr_t)((word)limit & ~0xf); + limit = (ptr_t)((word)limit & ~(word)0xf); /* Make it sufficiently aligned for assembly */ /* implementations of GC_clear_stack_inner. */ return GC_clear_stack_inner(arg, limit); } BZERO((void *)dummy, SMALL_CLEAR_SIZE*sizeof(word)); # else - if (GC_gc_no > GC_stack_last_cleared) { - /* Start things over, so we clear the entire stack again */ - if (GC_stack_last_cleared == 0) + if (GC_gc_no != GC_stack_last_cleared) { + /* Start things over, so we clear the entire stack again. */ + if (EXPECT(NULL == GC_high_water, FALSE)) GC_high_water = (ptr_t)GC_stackbottom; GC_min_sp = GC_high_water; GC_stack_last_cleared = GC_gc_no; GC_bytes_allocd_at_reset = GC_bytes_allocd; } - /* Adjust GC_high_water */ + /* Adjust GC_high_water. */ MAKE_COOLER(GC_high_water, WORDS_TO_BYTES(DEGRADE_RATE) + GC_SLOP); if ((word)sp HOTTER_THAN (word)GC_high_water) { GC_high_water = sp; @@ -389,7 +390,7 @@ MAKE_HOTTER(limit, SLOP); if ((word)sp COOLER_THAN (word)limit) { - limit = (ptr_t)((word)limit & ~0xf); + limit = (ptr_t)((word)limit & ~(word)0xf); /* Make it sufficiently aligned for assembly */ /* implementations of GC_clear_stack_inner. */ GC_min_sp = sp; @@ -434,7 +435,7 @@ } if (HBLK_IS_FREE(candidate_hdr)) return(0); /* Make sure r points to the beginning of the object */ - r = (ptr_t)((word)r & ~(WORDS_TO_BYTES(1) - 1)); + r = (ptr_t)((word)r & ~(word)(WORDS_TO_BYTES(1)-1)); { size_t offset = HBLKDISPL(r); word sz = candidate_hdr -> hb_sz;
View file
_service:tar_scm:gc-8.2.4.tar.gz/os_dep.c -> _service:tar_scm:gc-8.2.6.tar.gz/os_dep.c
Changed
@@ -784,7 +784,7 @@ result = VirtualQuery(p, &buf, sizeof(buf)); if (result != sizeof(buf)) ABORT("Weird VirtualQuery result"); if (base != 0) *base = (ptr_t)(buf.AllocationBase); - protect = (buf.Protect & ~(PAGE_GUARD | PAGE_NOCACHE)); + protect = buf.Protect & ~(word)(PAGE_GUARD | PAGE_NOCACHE); if (!is_writable(protect)) { return(0); } @@ -801,7 +801,7 @@ /* function even before GC is initialized). */ if (!GC_page_size) GC_setpagesize(); - trunc_sp = (ptr_t)((word)GC_approx_sp() & ~(GC_page_size - 1)); + trunc_sp = (ptr_t)((word)GC_approx_sp() & ~(word)(GC_page_size-1)); /* FIXME: This won't work if called from a deeply recursive */ /* client code (and the committed stack space has grown). */ size = GC_get_writable_length(trunc_sp, 0); @@ -880,7 +880,9 @@ # define GET_MAIN_STACKBASE_SPECIAL # endif /* AMIGA */ -# if defined(NEED_FIND_LIMIT) || defined(UNIX_LIKE) \ +# if defined(NEED_FIND_LIMIT) \ + || (defined(UNIX_LIKE) && !defined(NO_DEBUGGING)) \ + || (defined(USE_PROC_FOR_LIBRARIES) && defined(THREADS)) \ || (defined(WRAP_MARK_SOME) && defined(__GNUC__)) typedef void (*GC_fault_handler_t)(int); @@ -893,7 +895,7 @@ || defined(HURD) || defined(NETBSD) || defined(FREEBSD) static struct sigaction old_bus_act; # endif -# else +# elif !defined(OPENBSD) static GC_fault_handler_t old_segv_handler; # ifdef HAVE_SIGBUS static GC_fault_handler_t old_bus_handler; @@ -1004,8 +1006,7 @@ GC_ASSERT(I_HOLD_LOCK()); GC_setup_temporary_fault_handler(); if (SETJMP(GC_jmp_buf) == 0) { - result = (ptr_t)(((word)(p)) - & ~(MIN_PAGE_SIZE-1)); + result = (ptr_t)((word)p & ~(word)(MIN_PAGE_SIZE-1)); for (;;) { if (up) { if ((word)result >= (word)bound - MIN_PAGE_SIZE) { @@ -1083,7 +1084,7 @@ /* old way to get the register stackbottom */ return (ptr_t)(((word)GC_stackbottom - BACKING_STORE_DISPLACEMENT - 1) - & ~(BACKING_STORE_ALIGNMENT - 1)); + & ~(word)(BACKING_STORE_ALIGNMENT-1)); } #endif /* HPUX_STACK_BOTTOM */ @@ -1326,9 +1327,10 @@ # define STACKBOTTOM_ALIGNMENT_M1 ((word)STACK_GRAN - 1) # ifdef STACK_GROWS_DOWN result = (ptr_t)(((word)GC_approx_sp() + STACKBOTTOM_ALIGNMENT_M1) - & ~STACKBOTTOM_ALIGNMENT_M1); + & ~(word)STACKBOTTOM_ALIGNMENT_M1); # else - result = (ptr_t)((word)GC_approx_sp() & ~STACKBOTTOM_ALIGNMENT_M1); + result = (ptr_t)((word)GC_approx_sp() + & ~(word)STACKBOTTOM_ALIGNMENT_M1); # endif # elif defined(HPUX_MAIN_STACKBOTTOM) result = GC_hpux_main_stack_base(); @@ -1825,7 +1827,7 @@ { MEMORY_BASIC_INFORMATION buf; LPVOID limit = GC_sysinfo.lpMinimumApplicationAddress; - ptr_t p = (ptr_t)((word)start & ~(GC_page_size - 1)); + ptr_t p = (ptr_t)((word)start & ~(word)(GC_page_size-1)); GC_ASSERT(GC_page_size != 0); for (;;) { @@ -2060,7 +2062,7 @@ /* Try reading at the address. */ /* This should happen before there is another thread. */ for (; next_page < (word)DATAEND; next_page += (word)max_page_size) - *(volatile char *)next_page; + GC_noop1((word)(*(volatile unsigned char *)next_page)); GC_reset_fault_handler(); } else { GC_reset_fault_handler(); @@ -2271,7 +2273,7 @@ return NULL; } last_addr = (ptr_t)(((word)result + bytes + GC_page_size - 1) - & ~(GC_page_size - 1)); + & ~(word)(GC_page_size - 1)); # if !defined(LINUX) if (last_addr == 0) { /* Oops. We got the end of the address space. This isn't */ @@ -2318,7 +2320,7 @@ goto out; } if (lsbs != 0) { - if((ptr_t)sbrk((SBRK_ARG_T)GC_page_size - lsbs) == (ptr_t)(-1)) { + if ((ptr_t)sbrk((SBRK_ARG_T)GC_page_size - lsbs) == (ptr_t)(-1)) { result = 0; goto out; } @@ -2623,7 +2625,7 @@ STATIC ptr_t GC_unmap_start(ptr_t start, size_t bytes) { ptr_t result = (ptr_t)(((word)start + GC_page_size - 1) - & ~(GC_page_size - 1)); + & ~(word)(GC_page_size - 1)); GC_ASSERT(GC_page_size != 0); if ((word)(result + GC_page_size) > (word)(start + bytes)) return 0; @@ -3315,7 +3317,8 @@ # endif if (SIG_OK && CODE_OK) { - struct hblk * h = (struct hblk *)((word)addr & ~(GC_page_size-1)); + struct hblk * h = (struct hblk *)((word)addr + & ~(word)(GC_page_size-1)); GC_bool in_allocd_block; size_t i; @@ -3614,22 +3617,6 @@ * happens to work. */ -# ifdef THREAD_SANITIZER - /* Used by GC_remove_protection only. Potential data race between */ - /* this function and GC_write_fault_handler should not be harmful */ - /* because it would only result in a double call of UNPROTECT() for */ - /* a region. */ - GC_ATTR_NO_SANITIZE_THREAD - static GC_bool get_pht_entry_from_index_async(volatile page_hash_table db, - size_t index) - { - return (GC_bool)get_pht_entry_from_index(db, index); - } -# else -# define get_pht_entry_from_index_async(bl, index) \ - get_pht_entry_from_index(bl, index) -# endif - /* We no longer wrap read by default, since that was causing too many */ /* problems. It is preferred that the client instead avoids writing */ /* to the write-protected heap with a system call. */ @@ -4022,8 +4009,8 @@ ofs = (size_t)(fpos - pagemap_buf_fpos); res = (ssize_t)(pagemap_buf_fpos + pagemap_buf_len - fpos); } else { - off_t aligned_pos = fpos & ~(GC_page_size < VDB_BUF_SZ - ? GC_page_size-1 : VDB_BUF_SZ-1); + off_t aligned_pos = fpos & ~(off_t)(GC_page_size < VDB_BUF_SZ + ? GC_page_size-1 : VDB_BUF_SZ-1); for (;;) { size_t count; @@ -4089,7 +4076,7 @@ break; } - limit_buf = ((word)vaddr & ~(GC_page_size-1)) + limit_buf = ((word)vaddr & ~(word)(GC_page_size-1)) + (res / sizeof(pagemap_elem_t)) * GC_page_size; for (; (word)vaddr < limit_buf; vaddr += GC_page_size, bufp++) if ((*bufp & PM_SOFTDIRTY_MASK) != 0) { @@ -4347,14 +4334,12 @@ if (!GC_auto_incremental || GC_GWW_AVAILABLE()) return; GC_ASSERT(GC_page_size != 0); - h_trunc = (struct hblk *)((word)h & ~(GC_page_size-1)); + h_trunc = (struct hblk *)((word)h & ~(word)(GC_page_size-1)); h_end = (struct hblk *)(((word)(h + nblocks) + GC_page_size - 1) - & ~(GC_page_size - 1)); - if (h_end == h_trunc + 1 && - get_pht_entry_from_index_async(GC_dirty_pages, PHT_HASH(h_trunc))) { - /* already marked dirty, and hence unprotected. */ - return; - } + & ~(word)(GC_page_size - 1)); + /* Note that we cannot examine GC_dirty_pages to check */ + /* whether the page at h_trunc has already been marked */ + /* dirty as there could be a hash collision. */ for (current = h_trunc; (word)current < (word)h_end; ++current) { word index = PHT_HASH(current); @@ -4390,7 +4375,6 @@ #include <mach/mach_error.h> #include <mach/exception.h> #include <mach/task.h> -#include <pthread.h> EXTERN_C_BEGIN @@ -4568,6 +4552,39 @@ GC_mprotect_thread_notify(ID_RESUME); }
View file
_service:tar_scm:gc-8.2.4.tar.gz/pthread_support.c -> _service:tar_scm:gc-8.2.6.tar.gz/pthread_support.c
Changed
@@ -260,6 +260,16 @@ static GC_bool parallel_initialized = FALSE; +#if defined(MPROTECT_VDB) && defined(DARWIN) + GC_INNER int GC_inner_pthread_create(pthread_t *t, + GC_PTHREAD_CREATE_CONST pthread_attr_t *a, + void *(*fn)(void *), void *arg) + { + INIT_REAL_SYMS(); + return REAL_FUNC(pthread_create)(t, a, fn, arg); + } +#endif + #ifndef GC_ALWAYS_MULTITHREADED GC_INNER GC_bool GC_need_to_lock = FALSE; #endif @@ -552,7 +562,8 @@ void GC_push_thread_structures(void) { GC_ASSERT(I_HOLD_LOCK()); - GC_PUSH_ALL_SYM(GC_threads); + GC_push_all((/* no volatile */ void *)&GC_threads, + (ptr_t)(&GC_threads) + sizeof(GC_threads)); # ifdef E2K GC_PUSH_ALL_SYM(first_thread.backing_store_end); # endif @@ -723,8 +734,15 @@ GC_INNER unsigned char *GC_check_finalizer_nested(void) { GC_thread me = GC_lookup_thread(pthread_self()); - unsigned nesting_level = me->finalizer_nested; + unsigned nesting_level; +# if defined(INCLUDE_LINUX_THREAD_DESCR) && defined(REDIRECT_MALLOC) + /* As noted in GC_start_routine, an allocation may happen in */ + /* GC_get_stack_base, causing GC_notify_or_invoke_finalizers */ + /* to be called before the thread gets registered. */ + if (EXPECT(NULL == me, FALSE)) return NULL; +# endif + nesting_level = me->finalizer_nested; if (nesting_level) { /* We are inside another GC_invoke_finalizers(). */ /* Skip some implicitly-called GC_invoke_finalizers() */ @@ -1218,6 +1236,9 @@ static void fork_child_proc(void) { GC_release_dirty_lock(); +# ifndef GC_DISABLE_INCREMENTAL + GC_dirty_update_child(); +# endif # ifdef PARALLEL_MARK if (GC_parallel) { # if defined(THREAD_SANITIZER) && defined(GC_ASSERTIONS) \ @@ -1237,9 +1258,6 @@ # endif /* Clean up the thread table, so that just our thread is left. */ GC_remove_all_threads_but_me(); -# ifndef GC_DISABLE_INCREMENTAL - GC_dirty_update_child(); -# endif RESTORE_CANCEL(fork_cancel_state); UNLOCK(); /* Even though after a fork the child only inherits the single */ @@ -1268,12 +1286,6 @@ GC_API void GC_CALL GC_atfork_prepare(void) { if (!EXPECT(GC_is_initialized, TRUE)) GC_init(); -# if defined(GC_DARWIN_THREADS) && defined(MPROTECT_VDB) - if (GC_auto_incremental) { - GC_ASSERT(0 == GC_handle_fork); - ABORT("Unable to fork while mprotect_thread is running"); - } -# endif if (GC_handle_fork <= 0) fork_prepare_proc(); } @@ -2068,6 +2080,7 @@ UNLOCK(); # endif INIT_REAL_SYMS(); /* to initialize symbols while single-threaded */ + GC_init_lib_bounds(); GC_start_mark_threads(); set_need_to_lock(); } @@ -2218,6 +2231,7 @@ INIT_REAL_SYMS(); if (!EXPECT(parallel_initialized, TRUE)) GC_init_parallel(); + GC_init_lib_bounds(); if (sem_init(&si.registered, GC_SEM_INIT_PSHARED, 0) != 0) ABORT("sem_init failed");
View file
_service:tar_scm:gc-8.2.4.tar.gz/ptr_chck.c -> _service:tar_scm:gc-8.2.6.tar.gz/ptr_chck.c
Changed
@@ -241,7 +241,8 @@ break; case GC_DS_PER_OBJECT: if ((signed_word)descr >= 0) { - descr = *(word *)((ptr_t)base + (descr & ~GC_DS_TAGS)); + descr = *(word *)((ptr_t)base + + (descr & ~(word)GC_DS_TAGS)); } else { ptr_t type_descr = *(ptr_t *)base; descr = *(word *)(type_descr
View file
_service:tar_scm:gc-8.2.4.tar.gz/reclaim.c -> _service:tar_scm:gc-8.2.6.tar.gz/reclaim.c
Changed
@@ -574,7 +574,8 @@ } ps = (struct Print_stats *)raw_ps; - ps->total_bytes += (bytes + (HBLKSIZE-1)) & ~(HBLKSIZE-1); /* round up */ + ps->total_bytes += + (bytes + HBLKSIZE-1) & ~(word)(HBLKSIZE-1); /* round up */ ps->number_of_blocks++; }
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/disclaim_bench.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/disclaim_bench.c
Changed
@@ -23,12 +23,11 @@ #include "gc_disclaim.h" #define NOT_GCBUILD -#include "private/gc_priv.h" /* for CLOCK_TYPE, COVERT_DATAFLOW, GC_random */ +#include "private/gc_priv.h" -#ifdef LINT2 -# undef rand -# define rand() (int)GC_random() -#endif +#undef rand +static GC_RAND_STATE_T seed; +#define rand() GC_RAND_NEXT(&seed) #define my_assert(e) \ if (!(e)) { \
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/disclaim_test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/disclaim_test.c
Changed
@@ -28,26 +28,17 @@ #undef GC_NO_THREAD_REDIRECTS #include "gc_disclaim.h" -#if defined(GC_PTHREADS) || defined(LINT2) -# define NOT_GCBUILD -# include "private/gc_priv.h" - - GC_ATTR_NO_SANITIZE_THREAD - static int GC_rand(void) /* nearly identical to GC_random */ - { - static unsigned seed; /* concurrent update does not hurt the test */ - - seed = (seed * 1103515245U + 12345) & (~0U >> 1); - return (int)seed; - } - +#define NOT_GCBUILD +#include "private/gc_priv.h" /* Redefine the standard rand() with a trivial (yet sufficient for */ /* the test purpose) implementation to avoid crashes inside rand() */ - /* on some targets (e.g. FreeBSD 13.0) when used concurrently. */ + /* on some hosts (e.g. FreeBSD 13.0) when used concurrently. */ /* The standard specifies rand() as not a thread-safe API function. */ -# undef rand -# define rand() GC_rand() -#endif /* GC_PTHREADS || LINT2 */ + /* On other hosts (e.g. OpenBSD 7.3), use of the standard rand() */ + /* causes "rand() may return deterministic values" warning. */ +#undef rand +static GC_RAND_STATE_T seed; /* concurrent update does not hurt the test */ +#define rand() GC_RAND_NEXT(&seed) #define my_assert(e) \ if (!(e)) { \ @@ -211,6 +202,8 @@ memset(pop, 0, sizeof(pop)); for (i = 0; i < MUTATE_CNT; ++i) { int t = rand() % POP_SIZE; + int j; + switch (rand() % (i > GROW_LIMIT? 5 : 3)) { case 0: case 3: if (popt) @@ -221,8 +214,8 @@ popt = popt->cdr; break; case 2: - popt = pair_new(poprand() % POP_SIZE, - poprand() % POP_SIZE); + j = rand() % POP_SIZE; + popt = pair_new(popj, poprand() % POP_SIZE); break; } if (rand() % 8 == 1)
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/disclaim_weakmap_test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/disclaim_weakmap_test.c
Changed
@@ -25,22 +25,11 @@ #include "gc_disclaim.h" /* includes gc.h */ -#if defined(GC_PTHREADS) || defined(LINT2) -# define NOT_GCBUILD -# include "private/gc_priv.h" - - GC_ATTR_NO_SANITIZE_THREAD - static int GC_rand(void) /* same as in disclaim_test.c */ - { - static unsigned seed; /* concurrent update does not hurt the test */ - - seed = (seed * 1103515245U + 12345) & (~0U >> 1); - return (int)seed; - } - -# undef rand -# define rand() GC_rand() -#endif /* GC_PTHREADS || LINT2 */ +#define NOT_GCBUILD +#include "private/gc_priv.h" +#undef rand +static GC_RAND_STATE_T seed; /* concurrent update does not hurt the test */ +#define rand() GC_RAND_NEXT(&seed) #include "gc_mark.h" /* should not precede include gc_priv.h */ @@ -54,7 +43,9 @@ #else # undef NTHREADS # define NTHREADS 1 -# define AO_t GC_word +# ifndef AO_HAVE_compiler_barrier +# define AO_t GC_word +# endif #endif #define POP_SIZE 200
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/huge_test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/huge_test.c
Changed
@@ -11,8 +11,8 @@ #endif #ifndef GC_MAXIMUM_HEAP_SIZE -# define GC_MAXIMUM_HEAP_SIZE 100 * 1024 * 1024 -# define GC_INITIAL_HEAP_SIZE GC_MAXIMUM_HEAP_SIZE / 20 +# define GC_MAXIMUM_HEAP_SIZE (100 * 1024 * 1024) +# define GC_INITIAL_HEAP_SIZE (GC_MAXIMUM_HEAP_SIZE / 20) /* Otherwise heap expansion aborts when deallocating large block. */ /* That's OK. We test this corner case mostly to make sure that */ /* it fails predictably. */
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/initsecondarythread.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/initsecondarythread.c
Changed
@@ -41,6 +41,14 @@ #include <stdlib.h> #include <stdio.h> +#define CHECK_OUT_OF_MEMORY(p) \ + do { \ + if (NULL == (p)) { \ + fprintf(stderr, "Out of memory\n"); \ + exit(69); \ + } \ + } while (0) + #ifdef GC_PTHREADS static void *thread(void *arg) #else @@ -48,8 +56,8 @@ #endif { GC_INIT(); - (void)GC_MALLOC(123); - (void)GC_MALLOC(12345); + CHECK_OUT_OF_MEMORY(GC_MALLOC(123)); + CHECK_OUT_OF_MEMORY(GC_MALLOC(12345)); # ifdef GC_PTHREADS return arg; # else
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/leak_test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/leak_test.c
Changed
@@ -1,5 +1,17 @@ + +#include <stdio.h> +#include <stdlib.h> + #include "leak_detector.h" +#define CHECK_OUT_OF_MEMORY(p) \ + do { \ + if (NULL == (p)) { \ + fprintf(stderr, "Out of memory\n"); \ + exit(69); \ + } \ + } while (0) + int main(void) { char *p10; int i; @@ -10,6 +22,7 @@ /* FIXME: This is not ideal. */ for (i = 0; i < 10; ++i) { pi = (char*)malloc(sizeof(int)+i); + CHECK_OUT_OF_MEMORY(pi); } CHECK_LEAKS(); for (i = 1; i < 10; ++i) { @@ -17,6 +30,7 @@ } for (i = 0; i < 9; ++i) { pi = (char*)malloc(sizeof(int)+i); + CHECK_OUT_OF_MEMORY(pi); } CHECK_LEAKS(); CHECK_LEAKS();
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/middle.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/middle.c
Changed
@@ -2,8 +2,19 @@ * Test at the boundary between small and large objects. * Inspired by a test case from Zoltan Varga. */ -#include "gc.h" + #include <stdio.h> +#include <stdlib.h> + +#include "gc.h" + +#define CHECK_OUT_OF_MEMORY(p) \ + do { \ + if (NULL == (p)) { \ + fprintf(stderr, "Out of memory\n"); \ + exit(69); \ + } \ + } while (0) int main (void) { @@ -15,17 +26,18 @@ printf("This test program is not designed for leak detection mode\n"); for (i = 0; i < 20000; ++i) { - (void)GC_malloc_atomic(4096); - (void)GC_malloc(4096); + CHECK_OUT_OF_MEMORY(GC_malloc_atomic(4096)); + CHECK_OUT_OF_MEMORY(GC_malloc(4096)); } /* Test delayed start of marker threads, if they are enabled. */ GC_start_mark_threads(); for (i = 0; i < 20000; ++i) { - (void)GC_malloc_atomic(2048); - (void)GC_malloc(2048); + CHECK_OUT_OF_MEMORY(GC_malloc_atomic(2048)); + CHECK_OUT_OF_MEMORY(GC_malloc(2048)); } + printf("Final heap size is %lu\n", (unsigned long)GC_get_heap_size()); return 0; }
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/realloc_test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/realloc_test.c
Changed
@@ -1,10 +1,19 @@ #include <stdio.h> #include <stdlib.h> + #include "gc.h" #define COUNT 10000000 +#define CHECK_OUT_OF_MEMORY(p) \ + do { \ + if (NULL == (p)) { \ + fprintf(stderr, "Out of memory\n"); \ + exit(69); \ + } \ + } while (0) + int main(void) { int i; unsigned long last_heap_size = 0; @@ -15,17 +24,22 @@ for (i = 0; i < COUNT; i++) { int **p = GC_NEW(int *); - int *q = (int*)GC_MALLOC_ATOMIC(sizeof(int)); + int *q; - if (p == 0 || *p != 0) { + CHECK_OUT_OF_MEMORY(p); + q = (int *)GC_MALLOC_ATOMIC(sizeof(int)); + CHECK_OUT_OF_MEMORY(q); + if (*p != NULL) { fprintf(stderr, "GC_malloc returned garbage (or NULL)\n"); exit(1); } - *p = (int*)GC_REALLOC(q, 2 * sizeof(int)); + *p = (int *)GC_REALLOC(q, 2 * sizeof(int)); + CHECK_OUT_OF_MEMORY(*p); if (i % 10 == 0) { unsigned long heap_size = (unsigned long)GC_get_heap_size(); + if (heap_size != last_heap_size) { printf("Heap size: %lu\n", heap_size); last_heap_size = heap_size;
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/smash_test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/smash_test.c
Changed
@@ -7,10 +7,19 @@ #include "gc.h" #include <stdio.h> +#include <stdlib.h> #define COUNT 7000 #define SIZE 40 +#define CHECK_OUT_OF_MEMORY(p) \ + do { \ + if (NULL == (p)) { \ + fprintf(stderr, "Out of memory\n"); \ + exit(69); \ + } \ + } while (0) + char * ACOUNT; char * volatile q; @@ -21,21 +30,20 @@ char *p; GC_INIT(); - for (i = 0; i < COUNT; ++i) { - Ai = p = (char*)GC_MALLOC(SIZE); - - if (i%3000 == 0) { - q = NULL; - GC_gcollect(); - } else if (i%5678 == 0 && p != 0) { - /* Write a byte past the end of the allocated object */ - /* but not beyond the last word of the object's memory. */ - /* A volatile intermediate pointer variable is used to */ - /* avoid a compiler complain of out-of-bounds access. */ - q = &p(SIZE + i/2000) /* 42 */; - *q = 42; - } + Ai = p = (char *)GC_MALLOC(SIZE); + CHECK_OUT_OF_MEMORY(p); + if (i % 3000 == 0) { + q = NULL; + GC_gcollect(); + } else if (i % 5678 == 0) { + /* Write a byte past the end of the allocated object */ + /* but not beyond the last word of the object's memory. */ + /* A volatile intermediate pointer variable is used to */ + /* avoid a compiler complain of out-of-bounds access. */ + q = &p(SIZE + i / 2000) /* 42 */; + *q = 42; + } } return 0; }
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/staticrootslib.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/staticrootslib.c
Changed
@@ -1,6 +1,9 @@ /* This test file is intended to be compiled into a DLL. */ +#include <stdio.h> +#include <stdlib.h> + #ifndef GC_DEBUG # define GC_DEBUG #endif @@ -17,6 +20,14 @@ # endif #endif +#define CHECK_OUT_OF_MEMORY(p) \ + do { \ + if (NULL == (p)) { \ + fprintf(stderr, "Out of memory\n"); \ + exit(69); \ + } \ + } while (0) + struct treenode { struct treenode *x; struct treenode *y; @@ -31,21 +42,24 @@ GC_TEST_EXPORT_API struct treenode * libsrl_mktree(int i) { - struct treenode * r = GC_NEW(struct treenode); + struct treenode *r = GC_NEW(struct treenode); + struct treenode *x, *y; + + CHECK_OUT_OF_MEMORY(r); if (0 == i) return 0; - if (1 == i) + if (1 == i) { r = (struct treenode *)GC_MALLOC_ATOMIC(sizeof(struct treenode)); - if (r) { - struct treenode *x = libsrl_mktree(i - 1); - struct treenode *y = libsrl_mktree(i - 1); - r -> x = x; - r -> y = y; - if (i != 1) { - GC_END_STUBBORN_CHANGE(r); - GC_reachable_here(x); - GC_reachable_here(y); - } + CHECK_OUT_OF_MEMORY(r); + } + x = libsrl_mktree(i - 1); + y = libsrl_mktree(i - 1); + r -> x = x; + r -> y = y; + if (i != 1) { + GC_END_STUBBORN_CHANGE(r); + GC_reachable_here(x); + GC_reachable_here(y); } return r; }
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/subthread_create.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/subthread_create.c
Changed
@@ -127,8 +127,11 @@ exit(1); } # else - DWORD thread_id; - thi = CreateThread(NULL, 0, entry, 0, 0, &thread_id); + { + DWORD thread_id; + + thi = CreateThread(NULL, 0, entry, 0, 0, &thread_id); + } if (thi == NULL) { fprintf(stderr, "Thread creation failed, errcode= %d\n", (int)GetLastError()); @@ -140,6 +143,7 @@ for (i = 0; i < n; ++i) { # ifdef GC_PTHREADS void *res; + err = pthread_join(thi, &res); if (err) { fprintf(stderr, "Failed to join thread, error: %s\n",
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/test.c
Changed
@@ -103,7 +103,7 @@ # include <pthread.h> # endif -# if ((defined(DARWIN) && defined(MPROTECT_VDB) \ +# if ((defined(DARWIN) && defined(MPROTECT_VDB) && !defined(THREADS) \ && !defined(MAKE_BACK_GRAPH) && !defined(TEST_HANDLE_FORK)) \ || (defined(THREADS) && !defined(CAN_HANDLE_FORK)) \ || defined(HAVE_NO_FORK) || defined(USE_WINALLOC)) \ @@ -200,6 +200,12 @@ exit(1); \ } +static void *checkOOM(void *p) +{ + CHECK_OUT_OF_MEMORY(p); + return p; +} + /* Define AO primitives for a single-threaded mode. */ #ifndef AO_HAVE_compiler_barrier /* AO_t not defined. */ @@ -458,7 +464,7 @@ sexpr reverse(sexpr x) { # ifdef TEST_WITH_SYSTEM_MALLOC - GC_noop1(GC_HIDE_POINTER(malloc(100000))); + GC_noop1(GC_HIDE_POINTER(checkOOM(malloc(100000)))); # endif return( reverse1(x, nil) ); } @@ -764,7 +770,7 @@ e = uncollectable_ints(1, 1); /* Check that realloc updates object descriptors correctly */ AO_fetch_and_add1(&collectable_count); - f = (sexpr *)GC_MALLOC(4 * sizeof(sexpr)); + f = (sexpr *)checkOOM(GC_MALLOC(4 * sizeof(sexpr))); f = (sexpr *)GC_REALLOC((void *)f, 6 * sizeof(sexpr)); CHECK_OUT_OF_MEMORY(f); AO_fetch_and_add1(&realloc_count); @@ -777,7 +783,7 @@ AO_fetch_and_add1(&realloc_count); GC_PTR_STORE_AND_DIRTY(g + 799, ints(1, 18)); AO_fetch_and_add1(&collectable_count); - h = (sexpr *)GC_MALLOC(1025 * sizeof(sexpr)); + h = (sexpr *)checkOOM(GC_MALLOC(1025 * sizeof(sexpr))); h = (sexpr *)GC_REALLOC((void *)h, 2000 * sizeof(sexpr)); CHECK_OUT_OF_MEMORY(h); AO_fetch_and_add1(&realloc_count); @@ -827,7 +833,7 @@ a_set(reverse(reverse(a_get()))); # if !defined(AT_END) && !defined(THREADS) /* This is not thread safe, since realloc explicitly deallocates */ - a_set(GC_REALLOC(a_get(), (i & 1) != 0 ? 500 : 8200)); + a_set(checkOOM(GC_REALLOC(a_get(), (i & 1) != 0 ? 500 : 8200))); AO_fetch_and_add1(&realloc_count); # endif } @@ -915,6 +921,7 @@ tn * result = GC_NEW(tn); tn * left, * right; + CHECK_OUT_OF_MEMORY(result); AO_fetch_and_add1(&collectable_count); # if defined(MACOS) /* get around static data limitations. */ @@ -925,7 +932,6 @@ } # endif if (n == 0) return(0); - CHECK_OUT_OF_MEMORY(result); result -> level = n; result -> lchild = left = mktree(n - 1); result -> rchild = right = mktree(n - 1); @@ -1053,56 +1059,71 @@ FAIL; } if (AO_fetch_and_add1(&extra_count) % 373 == 0) { - (void)GC_MALLOC((unsigned)AO_fetch_and_add1(&extra_count) % 5001); + (void)checkOOM(GC_MALLOC( + (unsigned)AO_fetch_and_add1(&extra_count) % 5001)); AO_fetch_and_add1(&collectable_count); } chktree(t -> lchild, n-1); if (AO_fetch_and_add1(&extra_count) % 73 == 0) { - (void)GC_MALLOC((unsigned)AO_fetch_and_add1(&extra_count) % 373); + (void)checkOOM(GC_MALLOC( + (unsigned)AO_fetch_and_add1(&extra_count) % 373)); AO_fetch_and_add1(&collectable_count); } chktree(t -> rchild, n-1); } -#if defined(GC_PTHREADS) - pthread_key_t fl_key; -#endif +#ifndef VERY_SMALL_CONFIG +# if defined(GC_PTHREADS) + pthread_key_t fl_key; +# endif -void * alloc8bytes(void) -{ -# ifndef GC_PTHREADS - AO_fetch_and_add1(&atomic_count); - return GC_MALLOC_ATOMIC(8); -# elif defined(SMALL_CONFIG) || defined(GC_DEBUG) - AO_fetch_and_add1(&collectable_count); - return(GC_MALLOC(8)); -# else - void ** my_free_list_ptr; - void * my_free_list; - void * next; + void * alloc8bytes(void) + { +# ifndef GC_PTHREADS + AO_fetch_and_add1(&atomic_count); + return GC_MALLOC_ATOMIC(8); +# elif defined(SMALL_CONFIG) || defined(GC_DEBUG) + AO_fetch_and_add1(&collectable_count); + return GC_MALLOC(8); +# else + void ** my_free_list_ptr; + void * my_free_list; + void * next; - my_free_list_ptr = (void **)pthread_getspecific(fl_key); - if (my_free_list_ptr == 0) { + my_free_list_ptr = (void **)pthread_getspecific(fl_key); + if (NULL == my_free_list_ptr) { my_free_list_ptr = GC_NEW_UNCOLLECTABLE(void *); if (NULL == my_free_list_ptr) return NULL; AO_fetch_and_add1(&uncollectable_count); if (pthread_setspecific(fl_key, my_free_list_ptr) != 0) { - GC_printf("pthread_setspecific failed\n"); - FAIL; + GC_printf("pthread_setspecific failed\n"); + FAIL; } - } - my_free_list = *my_free_list_ptr; - if (my_free_list == 0) { + } + my_free_list = *my_free_list_ptr; + if (NULL == my_free_list) { my_free_list = GC_malloc_many(8); if (NULL == my_free_list) return NULL; + } + next = GC_NEXT(my_free_list); + GC_PTR_STORE_AND_DIRTY(my_free_list_ptr, next); + GC_NEXT(my_free_list) = NULL; + AO_fetch_and_add1(&collectable_count); + return my_free_list; +# endif + } + + void alloc_small(int n) + { + int i; + + for (i = 0; i < n; i += 8) { + void *p = alloc8bytes(); + + CHECK_OUT_OF_MEMORY(p); } - next = GC_NEXT(my_free_list); - GC_PTR_STORE_AND_DIRTY(my_free_list_ptr, next); - GC_NEXT(my_free_list) = 0; - AO_fetch_and_add1(&collectable_count); - return(my_free_list); -# endif -} + } +#endif /* !VERY_SMALL_CONFIG */ #include "gc_inline.h" @@ -1117,19 +1138,11 @@ BZERO(tfls, sizeof(tfls)); /* TODO: Improve testing of FAST_MALLOC functionality. */ GC_MALLOC_WORDS(results0, 11, tfls0); + CHECK_OUT_OF_MEMORY(results0); GC_MALLOC_ATOMIC_WORDS(results1, 20, tfls1); + CHECK_OUT_OF_MEMORY(results1); GC_CONS(results2, results0, results1, tfls2); -} - -void alloc_small(int n) -{ - int i; - - for (i = 0; i < n; i += 8) { - void *p = alloc8bytes(); - - CHECK_OUT_OF_MEMORY(p); - } + CHECK_OUT_OF_MEMORY(results2); } # if defined(THREADS) && defined(GC_DEBUG)
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/thread_leak_test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/thread_leak_test.c
Changed
@@ -22,6 +22,15 @@ #endif /* !GC_PTHREADS */ #include <stdio.h> +#include <stdlib.h> + +#define CHECK_OUT_OF_MEMORY(p) \ + do { \ + if (NULL == (p)) { \ + fprintf(stderr, "Out of memory\n"); \ + exit(69); \ + } \ + } while (0) #ifdef GC_PTHREADS void * test(void * arg) @@ -33,6 +42,7 @@ int i; for (i = 0; i < 10; ++i) { pi = (int *)malloc(sizeof(int) + i); + CHECK_OUT_OF_MEMORY(pi); } CHECK_LEAKS(); for (i = 1; i < 10; ++i) {
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/threadkey_test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/threadkey_test.c
Changed
@@ -94,7 +94,7 @@ if (GC_get_find_leak()) printf("This test program is not designed for leak detection mode\n"); # ifdef GC_SOLARIS_THREADS - pthread_key_create (&key, on_thread_exit); + make_key(); # else pthread_once (&key_once, make_key); # endif
View file
_service:tar_scm:gc-8.2.4.tar.gz/tests/trace_test.c -> _service:tar_scm:gc-8.2.6.tar.gz/tests/trace_test.c
Changed
@@ -8,21 +8,29 @@ #include "gc.h" #include "gc_backptr.h" +#define CHECK_OUT_OF_MEMORY(p) \ + do { \ + if (NULL == (p)) { \ + fprintf(stderr, "Out of memory\n"); \ + exit(69); \ + } \ + } while (0) + struct treenode { struct treenode *x; struct treenode *y; -} * root10; +} *root10; struct treenode * mktree(int i) { struct treenode * r = GC_NEW(struct treenode); struct treenode *x, *y; + + CHECK_OUT_OF_MEMORY(r); if (0 == i) - return 0; - if (1 == i) + return NULL; + if (1 == i) { r = (struct treenode *)GC_MALLOC_ATOMIC(sizeof(struct treenode)); - if (r == NULL) { - fprintf(stderr, "Out of memory\n"); - exit(1); + CHECK_OUT_OF_MEMORY(r); } x = mktree(i - 1); y = mktree(i - 1);
View file
_service:tar_scm:gc-8.2.4.tar.gz/tools/setjmp_t.c -> _service:tar_scm:gc-8.2.6.tar.gz/tools/setjmp_t.c
Changed
@@ -101,12 +101,12 @@ if (nested_sp_fn() < sp) { printf("Stack appears to grow down, which is the default.\n"); printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n", - ((unsigned long)sp + ps) & ~(ps-1)); + ((unsigned long)sp + ps) & ~(unsigned long)(ps-1)); } else { printf("Stack appears to grow up.\n"); printf("Define STACK_GROWS_UP in gc_priv.h\n"); printf("A good guess for STACKBOTTOM on this machine is 0x%lx.\n", - ((unsigned long)sp + ps) & ~(ps-1)); + (unsigned long)sp & ~(unsigned long)(ps-1)); /* round down */ } printf("Note that this may vary between machines of ostensibly\n"); printf("the same architecture (e.g. Sun 3/50s and 3/80s).\n");
View file
_service:tar_scm:gc-8.2.4.tar.gz/typd_mlc.c -> _service:tar_scm:gc-8.2.6.tar.gz/typd_mlc.c
Changed
@@ -169,7 +169,7 @@ if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) { descriptor = GC_bm_tableBYTES_TO_WORDS((word)descriptor); } - descriptor |= (descriptor & ~GC_DS_TAGS) >> nwords; + descriptor |= (descriptor & ~(GC_descr)GC_DS_TAGS) >> nwords; return(descriptor); } @@ -577,7 +577,7 @@ if (index == -1) return(WORDS_TO_BYTES(last_set_bit+1) | GC_DS_LENGTH); /* Out of memory: use conservative */ /* approximation. */ - result = GC_MAKE_PROC(GC_typed_mark_proc_index, (word)index); + result = GC_MAKE_PROC(GC_typed_mark_proc_index, index); } return result; }
View file
_service:tar_scm:gc-8.2.4.tar.gz/win32_threads.c -> _service:tar_scm:gc-8.2.6.tar.gz/win32_threads.c
Changed
@@ -83,7 +83,16 @@ # else # define PUSHED_REGS_COUNT 7 # endif -#elif defined(X86_64) || defined(SHx) +#elif defined(X86_64) +# ifdef XMM_CANT_STORE_PTRS + /* If pointers can't be located in Xmm registers. */ +# define PUSHED_REGS_COUNT 15 +# else + /* gcc-13 may store pointers into SIMD registers when */ + /* certain compiler optimizations are enabled. */ +# define PUSHED_REGS_COUNT (15+32) +# endif +#elif defined(SHx) # define PUSHED_REGS_COUNT 15 #elif defined(ARM32) # define PUSHED_REGS_COUNT 13 @@ -1266,7 +1275,7 @@ } else # endif /* else */ { - GC_PUSH_ALL_SYM(GC_threads); + GC_push_all(&GC_threads, (ptr_t)(&GC_threads) + sizeof(GC_threads)); } # if defined(THREAD_LOCAL_ALLOC) && defined(USE_CUSTOM_SPECIFIC) GC_PUSH_ALL_SYM(GC_thread_key); @@ -1285,9 +1294,12 @@ ? CONTEXT_INTEGER | CONTEXT_CONTROL \ | CONTEXT_EXCEPTION_REQUEST | CONTEXT_SEGMENTS \ : CONTEXT_INTEGER | CONTEXT_CONTROL) -#else +#elif defined(I386) || defined(XMM_CANT_STORE_PTRS) # define GET_THREAD_CONTEXT_FLAGS (CONTEXT_INTEGER | CONTEXT_CONTROL) -#endif /* !WOW64_THREAD_CONTEXT_WORKAROUND */ +#else +# define GET_THREAD_CONTEXT_FLAGS (CONTEXT_INTEGER | CONTEXT_CONTROL \ + | CONTEXT_FLOATING_POINT) +#endif /* !WOW64_THREAD_CONTEXT_WORKAROUND && !I386 */ /* Suspend the given thread, if it's still active. */ STATIC void GC_suspend(GC_thread t) @@ -1581,6 +1593,8 @@ # define PUSH1(reg) (regscnt++ = (word)pcontext->reg) # define PUSH2(r1,r2) (PUSH1(r1), PUSH1(r2)) # define PUSH4(r1,r2,r3,r4) (PUSH2(r1,r2), PUSH2(r3,r4)) +# define PUSH8_LH(r1,r2,r3,r4) (PUSH4(r1.Low,r1.High,r2.Low,r2.High), \ + PUSH4(r3.Low,r3.High,r4.Low,r4.High)) # if defined(I386) # ifdef WOW64_THREAD_CONTEXT_WORKAROUND PUSH2(ContextFlags, SegFs); /* cannot contain pointers */ @@ -1590,6 +1604,12 @@ # elif defined(X86_64) PUSH4(Rax,Rcx,Rdx,Rbx); PUSH2(Rbp, Rsi); PUSH1(Rdi); PUSH4(R8, R9, R10, R11); PUSH4(R12, R13, R14, R15); +# ifndef XMM_CANT_STORE_PTRS + PUSH8_LH(Xmm0, Xmm1, Xmm2, Xmm3); + PUSH8_LH(Xmm4, Xmm5, Xmm6, Xmm7); + PUSH8_LH(Xmm8, Xmm9, Xmm10, Xmm11); + PUSH8_LH(Xmm12, Xmm13, Xmm14, Xmm15); +# endif sp = (ptr_t)context.Rsp; # elif defined(ARM32) PUSH4(R0,R1,R2,R3),PUSH4(R4,R5,R6,R7),PUSH4(R8,R9,R10,R11); @@ -2015,16 +2035,6 @@ #ifdef PARALLEL_MARK -# if defined(GC_PTHREADS) && !defined(GC_PTHREADS_PARAMARK) - /* Use pthread-based parallel mark implementation. */ - - /* Workaround a deadlock in winpthreads-3.0b internals (observed */ - /* with MinGW 32/64). */ -# if !defined(__MINGW32__) -# define GC_PTHREADS_PARAMARK -# endif -# endif - # if !defined(GC_PTHREADS_PARAMARK) STATIC HANDLE GC_marker_cvMAX_MARKERS - 1 = {0}; /* Events with manual reset (one for each */
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2