Projects
openEuler:Mainline
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,12 +1,14 @@ Name: gc -Version: 8.0.6 +Version: 8.2.2 Release: 1 Summary: A garbage collector for C and C++ License: BSD and GPLv1+ Url: http://www.hboehm.info/gc/ Source0: http://www.hboehm.info/gc/gc_source/gc-%{version}.tar.gz +Patch1: gc-8.0.6-sw.patch +Patch2: 0001-add-loongarch-architecture.patch -BuildRequires: gcc gcc-c++ libtool libatomic_ops-devel +BuildRequires: gcc gcc-c++ libtool %description The Boehm-Demers-Weiser conservative garbage collector can be @@ -58,6 +60,7 @@ %{_libdir}/libcord.so.1* %{_libdir}/libgc.so.1* %{_libdir}/libgccpp.so.1* +%{_libdir}/libgctba.so* %files devel %doc doc/README.environment doc/README.linux @@ -72,6 +75,24 @@ %changelog +* Thu Feb 2 2023 huyubiao <huyubiao@huawei.com> - 8.2.2-1 +- Update gc to 8.2.2 + +* Tue Nov 21 2022 doupengda <doupengda@loongson.cn> - 8.0.6-4 +- add loongarch64 support + +* Mon Nov 14 2022 wuzx<wuzx1226@qq.com> - 8.0.6-3 +- Type:feature +- CVE:NA +- SUG:NA +- DESC:Add sw64 architecture + +* Tue Oct 18 2022 Liu Zixian <liuzixian4@huawei.com> - 8.0.6-2 +- Type:cleancode +- ID:NA +- SUG:NA +- DESC:Remove unused BuildRequires + * Thu Dec 2 2021 wangjie <wangjie375@huawei.com> - 8.0.6-1 - Type:enhancement - ID:NA
View file
_service:tar_scm:0001-add-loongarch-architecture.patch
Added
@@ -0,0 +1,96 @@ +From 6ade473e440b2da11e6ecf6a69c4f1b309ab7624 Mon Sep 17 00:00:00 2001 +From: wang--ge <wang__ge@126.com> +Date: Tue, 12 Apr 2022 19:47:14 +0800 +Subject: PATCH add loongarch architecture + +--- + configure.ac | 2 +- + include/private/gcconfig.h | 31 +++++++++++++++++++++++++++++++ + os_dep.c | 2 +- + 3 files changed, 33 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 2bc1282..7cc02a9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -208,7 +208,7 @@ case "$THREADS" in + *-*-aix* | *-*-android* | *-*-cygwin* | *-*-darwin* | *-*-dragonfly* | \ + *-*-freebsd* | *-*-haiku* | *-*-hpux11* | *-*-irix* | \ + *-*-kfreebsd*-gnu | *-*-gnu* | *-*-*linux* | *-*-msys* | *-*-nacl* | \ +- *-*-netbsd* | *-*-openbsd* | *-*-osf* | *-*-solaris*) ++ *-*-netbsd* | *-*-openbsd* | *-*-osf* | *-*-solaris* | loongarch*) + AC_DEFINE(GC_THREADS) + AC_DEFINE(_REENTRANT, 1, + Required define if using POSIX threads.) +diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h +index b4457c1..5826ad5 100644 +--- a/include/private/gcconfig.h ++++ b/include/private/gcconfig.h +@@ -226,6 +226,14 @@ EXTERN_C_BEGIN + # define VAX + # define mach_type_known + # endif ++# if defined(__loongarch64) ++# define LOONGARCH64 ++# define mach_type_known ++# endif ++# if defined(__loongarch64) ++# define LOONGARCH64 ++# define mach_type_known ++# endif + # if defined(mips) || defined(__mips) || defined(_mips) + # define MIPS + # if defined(nec_ews) || defined(_nec_ews) +@@ -518,6 +526,10 @@ EXTERN_C_BEGIN + # define AARCH64 + # define mach_type_known + # endif ++# if defined(FREEBSD) && (defined(__loongarch64) ) ++# define LOONGARCH64 ++# define mach_type_known ++# endif + # if defined(FREEBSD) && (defined(mips) || defined(__mips) || defined(_mips)) + # define MIPS + # define mach_type_known +@@ -1702,6 +1714,25 @@ EXTERN_C_BEGIN + # define STACKBOTTOM ((ptr_t)0xfffff000) /* for Encore */ + # endif + ++# ifdef LOONGARCH64 ++# define MACH_TYPE "LOONGARCH64" ++# ifdef LINUX ++# define OS_TYPE "LINUX" ++# define DYNAMIC_LOADING ++ extern int _end; ++# pragma weak __data_start ++ extern int __data_start; ++# define DATASTART ((ptr_t)(__data_start)) ++# define DATAEND ((ptr_t)(_end)) ++# define CPP_WORDSZ 64 ++# define ALIGNMENT (64/8) ++# ifndef HBLKSIZE ++# define HBLKSIZE 4096 ++# endif ++# define LINUX_STACKBOTTOM ++# endif ++# endif ++ + # ifdef LOONGARCH + # define MACH_TYPE "LoongArch" + # ifdef LINUX +diff --git a/os_dep.c b/os_dep.c +index e116ad0..947ac7f 100644 +--- a/os_dep.c ++++ b/os_dep.c +@@ -3239,7 +3239,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void) + # ifndef SEGV_ACCERR + # define SEGV_ACCERR 2 + # endif +-# if defined(AARCH64) || defined(ARM32) || defined(MIPS) \ ++# if defined(AARCH64) || defined(ARM32) || defined(MIPS) || defined(LOONGARCH64) \ + || __FreeBSD__ >= 7 + # define CODE_OK (si -> si_code == SEGV_ACCERR) + # elif defined(POWERPC) +-- +2.27.0 +
View file
_service:tar_scm:gc-8.0.6-sw.patch
Added
@@ -0,0 +1,207 @@ +diff -Naur gc-8.0.6.org/config.guess gc-8.0.6.sw/config.guess +--- gc-8.0.6.org/config.guess 2022-02-14 09:01:19.450000000 +0000 ++++ gc-8.0.6.sw/config.guess 2022-02-15 02:27:24.780000000 +0000 +@@ -973,6 +973,14 @@ EOF + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; ++ sw_64:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ sw) UNAME_MACHINE=sw_64 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi ++ GUESS=${UNAME_MACHINE}-sunway-linux-${LIBC} ++ ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + EV5) UNAME_MACHINE=alphaev5 ;; +diff -Naur gc-8.0.6.org/config.sub gc-8.0.6.sw/config.sub +--- gc-8.0.6.org/config.sub 2022-02-14 09:01:19.450000000 +0000 ++++ gc-8.0.6.sw/config.sub 2022-02-15 02:25:05.350000000 +0000 +@@ -1175,6 +1175,7 @@ case $cpu-$vendor in + case $cpu in + 1750a | 580 \ + | a29k \ ++ | sw_64 \ + | aarch64 | aarch64_be \ + | abacus \ + | alpha | alphaev4-8 | alphaev56 | alphaev678 \ +diff -Naur gc-8.0.6.org/extra/msvc_dbg.c gc-8.0.6.sw/extra/msvc_dbg.c +--- gc-8.0.6.org/extra/msvc_dbg.c 2022-02-14 09:01:19.470000000 +0000 ++++ gc-8.0.6.sw/extra/msvc_dbg.c 2022-02-15 02:32:56.220000000 +0000 +@@ -156,6 +156,9 @@ size_t GetStackFramesFromContext(HANDLE hProcess, HANDLE hThread, + #elif defined(_M_MRX000) + machineType = IMAGE_FILE_MACHINE_R4000; + stackFrame.AddrPC.Offset = context->Fir; ++#elif defined(_M_SW_64) ++ machineType = IMAGE_FILE_MACHINE_SW_64; ++ stackFrame.AddrPC.Offset = (unsigned long)context->Fir; + #elif defined(_M_ALPHA) + machineType = IMAGE_FILE_MACHINE_ALPHA; + stackFrame.AddrPC.Offset = (unsigned long)context->Fir; +@@ -165,6 +168,9 @@ size_t GetStackFramesFromContext(HANDLE hProcess, HANDLE hThread, + #elif defined(_M_IA64) + machineType = IMAGE_FILE_MACHINE_IA64; + stackFrame.AddrPC.Offset = context->StIIP; ++#elif defined(_M_SW_6464) ++ machineType = IMAGE_FILE_MACHINE_SW_6464; ++ stackFrame.AddrPC.Offset = context->Fir; + #elif defined(_M_ALPHA64) + machineType = IMAGE_FILE_MACHINE_ALPHA64; + stackFrame.AddrPC.Offset = context->Fir; +diff -Naur gc-8.0.6.org/include/gc_config_macros.h gc-8.0.6.sw/include/gc_config_macros.h +--- gc-8.0.6.org/include/gc_config_macros.h 2022-02-14 09:01:19.450000000 +0000 ++++ gc-8.0.6.sw/include/gc_config_macros.h 2022-02-15 02:37:26.990000000 +0000 +@@ -96,7 +96,7 @@ + # define GC_FREEBSD_THREADS + # elif defined(__NetBSD__) + # define GC_NETBSD_THREADS +-# elif defined(__alpha) || defined(__alpha__) /* && !Linux && !xBSD */ ++# elif defined(__alpha) || defined(__alpha__) || defined(__sw_64) || defined(__sw_64__) /* && !Linux && !xBSD */ + # define GC_OSF1_THREADS + # elif (defined(mips) || defined(__mips) || defined(_mips)) \ + && !(defined(nec_ews) || defined(_nec_ews) \ +diff -Naur gc-8.0.6.org/include/gc_tiny_fl.h gc-8.0.6.sw/include/gc_tiny_fl.h +--- gc-8.0.6.org/include/gc_tiny_fl.h 2022-02-14 09:01:19.440000000 +0000 ++++ gc-8.0.6.sw/include/gc_tiny_fl.h 2022-02-15 02:38:20.270000000 +0000 +@@ -49,7 +49,7 @@ + # if defined(__LP64__) || defined (_LP64) || defined(_WIN64) \ + || defined(__s390x__) \ + || (defined(__x86_64__) && !defined(__ILP32__)) \ +- || defined(__alpha__) || defined(__powerpc64__) \ ++ || defined(__alpha__) || defined(__sw_64__) || defined(__powerpc64__) \ + || defined(__arch64__) + # define GC_GRANULE_BYTES 16 + # define GC_GRANULE_WORDS 2 +diff -Naur gc-8.0.6.org/include/private/gc_priv.h gc-8.0.6.sw/include/private/gc_priv.h +--- gc-8.0.6.org/include/private/gc_priv.h 2022-02-14 09:01:19.440000000 +0000 ++++ gc-8.0.6.sw/include/private/gc_priv.h 2022-02-15 02:40:15.270000000 +0000 +@@ -925,7 +925,7 @@ EXTERN_C_BEGIN + /* SMALL_CONFIG: Want less block-level fragmentation. */ + #ifndef HBLKSIZE + # if defined(LARGE_CONFIG) || !defined(SMALL_CONFIG) +-# ifdef ALPHA ++# if defined ALPHA || defined SW_64 + # define CPP_LOG_HBLKSIZE 13 + # elif defined(SN_TARGET_PSP2) + # define CPP_LOG_HBLKSIZE 16 /* page size is set to 64 KB */ +diff -Naur gc-8.0.6.org/include/private/gcconfig.h gc-8.0.6.sw/include/private/gcconfig.h +--- gc-8.0.6.org/include/private/gcconfig.h 2022-02-14 09:01:19.440000000 +0000 ++++ gc-8.0.6.sw/include/private/gcconfig.h 2022-02-15 02:45:28.230000000 +0000 +@@ -418,6 +418,14 @@ EXTERN_C_BEGIN + # define M32R + # define mach_type_known + # endif ++# if defined(__sw_64) || defined(__sw_64__) ++# define SW_64 ++# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) \ ++ && !defined(FREEBSD) ++# define OSF1 /* a.k.a Digital Unix */ ++# endif ++# define mach_type_known ++# endif + # if defined(__alpha) || defined(__alpha__) + # define ALPHA + # if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) \ +@@ -1924,6 +1932,100 @@ EXTERN_C_BEGIN + # endif + # endif /* HP_PA */ + ++# ifdef SW_64 ++# define MACH_TYPE "SW_64" ++# define ALIGNMENT 8 ++# define CPP_WORDSZ 64 ++# ifdef NETBSD ++# define OS_TYPE "NETBSD" ++# define HEURISTIC2 ++ extern ptr_t GC_data_start; ++# define DATASTART GC_data_start ++# define ELFCLASS32 32 ++# define ELFCLASS64 64 ++# define ELF_CLASS ELFCLASS64 ++# define DYNAMIC_LOADING ++# endif ++# ifdef OPENBSD ++# define OS_TYPE "OPENBSD" ++# define ELF_CLASS ELFCLASS64 ++# ifndef GC_OPENBSD_THREADS ++# define HEURISTIC2 ++# endif ++ extern int __data_start; ++# define DATASTART ((ptr_t)__data_start) ++ extern int _end; ++# define DATAEND ((ptr_t)(&_end)) ++# define DYNAMIC_LOADING ++# endif ++# ifdef FREEBSD ++# define OS_TYPE "FREEBSD" ++/* MPROTECT_VDB is not yet supported at all on FreeBSD/sw_64. */ ++# define SIG_SUSPEND SIGUSR1 ++# define SIG_THR_RESTART SIGUSR2 ++ /* SIGTSTP and SIGCONT could be used alternatively. */ ++# define FREEBSD_STACKBOTTOM ++# ifdef __ELF__ ++# define DYNAMIC_LOADING ++# endif ++/* Handle unmapped hole sw_64*-*-freebsd45* puts between etext and edata. */ ++ extern char etext; ++ extern char edata; ++# if !defined(CPPCHECK) ++ extern char end; ++# endif ++# define NEED_FIND_LIMIT ++# define DATASTART ((ptr_t)(&etext)) ++ void * GC_find_limit(void *, int); ++# define DATAEND (ptr_t)GC_find_limit(DATASTART, TRUE) ++# define DATAEND_IS_FUNC ++# define GC_HAVE_DATAREGION2 ++# define DATASTART2 ((ptr_t)(&edata)) ++# define DATAEND2 ((ptr_t)(&end)) ++# endif ++# ifdef OSF1 ++# define OS_TYPE "OSF1" ++# define DATASTART ((ptr_t)0x140000000) ++ extern int _end; ++# define DATAEND ((ptr_t)(&_end)) ++ extern char ** environ; ++ /* round up from the value of environ to the nearest page boundary */ ++ /* Probably breaks if putenv is called before collector */ ++ /* initialization. */ ++# define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1)) ++/* # define HEURISTIC2 */ ++ /* Normally HEURISTIC2 is too conservative, since */ ++ /* the text segment immediately follows the stack. */ ++ /* 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))) ++# ifndef GC_OSF1_THREADS ++ /* Unresolved signal issues with threads. */ ++# define MPROTECT_VDB ++# endif ++# define DYNAMIC_LOADING ++# endif ++# ifdef LINUX ++# define OS_TYPE "LINUX" ++# define LINUX_STACKBOTTOM ++# define COUNT_UNMAPPED_REGIONS ++# ifdef __ELF__ ++# define SEARCH_FOR_DATA_START ++# define DYNAMIC_LOADING ++# else ++# define DATASTART ((ptr_t)0x140000000) ++# endif ++ extern int _end; ++# define DATAEND ((ptr_t)(_end)) ++# if !defined(REDIRECT_MALLOC) ++# define MPROTECT_VDB ++ /* Has only been superficially tested. May not */
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">6ca06e84c45432afc4bb98b877ba4000d9ef2591</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:gc-8.0.6.tar.gz/BCC_MAKEFILE
Deleted
@@ -1,81 +0,0 @@ -# Makefile for Borland C++ 5.5 on NT -# -bc= c:\Borland\BCC55 -bcbin= $(bc)\bin -bclib= $(bc)\lib -bcinclude= $(bc)\include - -gcinclude1 = .\include - -cc= $(bcbin)\bcc32 -rc= $(bcbin)\brc32 -lib= $(bcbin)\tlib -link= $(bcbin)\ilink32 -cflags= -O2 -R -v- -vi -H -H=gc.csm -I$(bcinclude);$(gcinclude1) -L$(bclib) \ - -w-pro -w-aus -w-par -w-ccc -w-inl -w-rch -a4 -defines= -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION \ - -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE -DJAVA_FINALIZATION \ - -DGC_GCJ_SUPPORT -DGC_OPERATOR_NEW_ARRAY -DUSE_MUNMAP - -.c.obj: - $(cc) @&&| - $(cdebug) $(cflags) $(cvars) $(defines) -o$* -c $*.c -| - -.cpp.obj: - $(cc) @&&| - $(cdebug) $(cflags) $(cvars) $(defines) -o$* -c $*.cpp -| - -.rc.res: - $(rc) -i$(bcinclude) -r -fo$* $*.rc - -XXXOBJS= XXXalloc.obj XXXreclaim.obj XXXallchblk.obj XXXmisc.obj \ - XXXmach_dep.obj XXXos_dep.obj XXXmark_rts.obj XXXheaders.obj XXXmark.obj \ - XXXobj_map.obj XXXblacklst.obj XXXfinalize.obj XXXnew_hblk.obj \ - XXXdbg_mlc.obj XXXmalloc.obj XXXdyn_load.obj \ - XXXtypd_mlc.obj XXXptr_chck.obj XXXgc_cpp.obj XXXmallocx.obj \ - XXXfnlz_mlc.obj XXXgcj_mlc.obj - -OBJS= $(XXXOBJS:XXX=) - -all: gctest.exe cord\de.exe test_cpp.exe - -$(OBJS) test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h MAKEFILE - -gc.lib: $(OBJS) - -del gc.lib - $(lib) $* @&&| - $(XXXOBJS:XXX=+) -| - -gctest.exe: tests\test.obj gc.lib - $(cc) @&&| - $(cflags) -W -e$* tests\test.obj gc.lib -| - -cord\tests\de.obj cord\tests\de_win.obj: include\cord.h \ - include\cord_pos.h cord\tests\de_win.h cord\tests\de_cmds.h - -cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\tests\de.obj \ - cord\tests\de_win.obj cord\tests\de_win.res gc.lib - $(cc) @&&| - $(cflags) -W -e$* cord\cordbscs.obj cord\cordxtra.obj \ - cord\tests\de.obj cord\tests\de_win.obj gc.lib -| - $(rc) cord\tests\de_win.res cord\de.exe - -gc_cpp.obj: gc_cpp.cc include\gc_cpp.h include\gc.h - -test_cpp.cpp: tests\test_cpp.cc - copy tests\test_cpp.cc test_cpp.cpp - -test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib - $(cc) @&&| - $(cflags) -W -e$* test_cpp.obj gc.lib -| - -clean: - -del *.obj *.res *.exe *.csm cord\*.obj cord\*.res cord\*.exe cord\*.csm - -del cord\*.tds cord\tests\*.obj cord\tests\*.res - -del *.log *.tds gc.lib tests\test.obj "gc.#0*"
View file
_service:tar_scm:gc-8.0.6.tar.gz/gc.mak
Deleted
@@ -1,2239 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10 -# This has been hand-edited way too many times. -# A clean, manually generated makefile would be an improvement. - -# TARGTYPE "Win32 (x86) Application" 0x0101 -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -!IF "$(CFG)" == "" -CFG=gctest - Win32 Release -!MESSAGE No configuration specified. Defaulting to gctest - Win32 Release. -!ENDIF - -!IF "$(CFG)" != "gc - Win32 Release" && "$(CFG)" != "gc - Win32 Debug" &&\ - "$(CFG)" != "gctest - Win32 Release" && "$(CFG)" != "gctest - Win32 Debug" &&\ - "$(CFG)" != "cord - Win32 Release" && "$(CFG)" != "cord - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE on this makefile -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gc.mak" CFG="cord - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "gc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "gctest - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "gctest - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE "cord - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "cord - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF -################################################################################ -# Begin Project -# PROP Target_Last_Scanned "gctest - Win32 Debug" - -!IF "$(CFG)" == "gc - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -OUTDIR=.\Release -INTDIR=.\Release - -ALL : ".\Release\gc.dll" ".\Release\gc.bsc" - -CLEAN : - -@erase ".\Release\allchblk.obj" - -@erase ".\Release\allchblk.sbr" - -@erase ".\Release\alloc.obj" - -@erase ".\Release\alloc.sbr" - -@erase ".\Release\blacklst.obj" - -@erase ".\Release\blacklst.sbr" - -@erase ".\Release\checksums.obj" - -@erase ".\Release\checksums.sbr" - -@erase ".\Release\dbg_mlc.obj" - -@erase ".\Release\dbg_mlc.sbr" - -@erase ".\Release\dyn_load.obj" - -@erase ".\Release\dyn_load.sbr" - -@erase ".\Release\finalize.obj" - -@erase ".\Release\finalize.sbr" - -@erase ".\Release\fnlz_mlc.obj" - -@erase ".\Release\fnlz_mlc.sbr" - -@erase ".\Release\gc.bsc" - -@erase ".\Release\gc_cpp.obj" - -@erase ".\Release\gc_cpp.sbr" - -@erase ".\Release\gc.dll" - -@erase ".\Release\gc.exp" - -@erase ".\Release\gc.lib" - -@erase ".\Release\headers.obj" - -@erase ".\Release\headers.sbr" - -@erase ".\Release\mach_dep.obj" - -@erase ".\Release\mach_dep.sbr" - -@erase ".\Release\malloc.obj" - -@erase ".\Release\malloc.sbr" - -@erase ".\Release\mallocx.obj" - -@erase ".\Release\mallocx.sbr" - -@erase ".\Release\mark.obj" - -@erase ".\Release\mark.sbr" - -@erase ".\Release\mark_rts.obj" - -@erase ".\Release\mark_rts.sbr" - -@erase ".\Release\misc.obj" - -@erase ".\Release\misc.sbr" - -@erase ".\Release\new_hblk.obj" - -@erase ".\Release\new_hblk.sbr" - -@erase ".\Release\obj_map.obj" - -@erase ".\Release\obj_map.sbr" - -@erase ".\Release\os_dep.obj" - -@erase ".\Release\os_dep.sbr" - -@erase ".\Release\ptr_chck.obj" - -@erase ".\Release\ptr_chck.sbr" - -@erase ".\Release\reclaim.obj" - -@erase ".\Release\reclaim.sbr" - -@erase ".\Release\typd_mlc.obj" - -@erase ".\Release\typd_mlc.sbr" - -@erase ".\Release\win32_threads.obj" - -@erase ".\Release\win32_threads.sbr" - -@erase ".\Release\msvc_dbg.copied.obj" - -@erase ".\Release\msvc_dbg.copied.sbr" - -@erase ".\msvc_dbg.copied.c" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "GC_THREADS" /FR /YX /c -CPP_PROJ=/nologo /MD /W3 /EHsc /O2 /I include /D "NDEBUG" /D "WIN32"\ - /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "ENABLE_DISCLAIM"\ - /D "GC_ATOMIC_UNCOLLECTABLE" /D "GC_THREADS" /D "JAVA_FINALIZATION"\ - /D "NO_EXECUTE_PERMISSION" /D "_CRT_SECURE_NO_DEPRECATE"\ - /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch"\ - /I./libatomic_ops/src /Fo"$(INTDIR)/" /c -CPP_OBJS=.\Release/ -CPP_SBRS=.\Release/ - -.c{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_OBJS)}.obj: - $(CPP) $(CPP_PROJ) $< - -.c{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cpp{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -.cxx{$(CPP_SBRS)}.sbr: - $(CPP) $(CPP_PROJ) $< - -MTL=mktyplib.exe -# ADD BASE MTL /nologo /D "NDEBUG" /win32 -# ADD MTL /nologo /D "NDEBUG" /win32 -MTL_PROJ=/nologo /D "NDEBUG" /win32 -RSC=rc.exe -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -BSC32_FLAGS=/nologo /o"$(OUTDIR)/gc.bsc" -BSC32_SBRS=\ - ".\Release\allchblk.sbr"\ - ".\Release\alloc.sbr"\ - ".\Release\blacklst.sbr"\ - ".\Release\checksums.sbr"\ - ".\Release\dbg_mlc.sbr"\ - ".\Release\dyn_load.sbr"\ - ".\Release\finalize.sbr"\ - ".\Release\fnlz_mlc.sbr"\ - ".\Release\gc_cpp.sbr"\ - ".\Release\headers.sbr"\ - ".\Release\mach_dep.sbr"\ - ".\Release\malloc.sbr"\ - ".\Release\mallocx.sbr"\ - ".\Release\mark.sbr"\ - ".\Release\mark_rts.sbr"\ - ".\Release\misc.sbr"\ - ".\Release\new_hblk.sbr"\ - ".\Release\obj_map.sbr"\ - ".\Release\os_dep.sbr"\ - ".\Release\ptr_chck.sbr"\ - ".\Release\reclaim.sbr"\ - ".\Release\typd_mlc.sbr"\ - ".\Release\msvc_dbg.copied.sbr"\ - ".\Release\win32_threads.sbr" - -".\Release\gc.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ - advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ - odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\ - /pdb:"$(OUTDIR)/gc.pdb" /machine:I386 /out:"$(OUTDIR)/gc.dll"\ - /implib:"$(OUTDIR)/gc.lib" -LINK32_OBJS=\ - ".\Release\allchblk.obj"\
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/gc_alloc_ptrs.h
Deleted
@@ -1,40 +0,0 @@ -/* - * Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. - * - * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED - * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. - * - * Permission is hereby granted to use or copy this program - * for any purpose, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -/* This file should never be included by clients directly. */ - -#ifndef GC_ALLOC_PTRS_H -#define GC_ALLOC_PTRS_H - -#include "gc.h" - -#ifdef __cplusplus - extern "C" { -#endif - -GC_API void ** const GC_objfreelist_ptr; -GC_API void ** const GC_aobjfreelist_ptr; -GC_API void ** const GC_uobjfreelist_ptr; - -#ifdef GC_ATOMIC_UNCOLLECTABLE - GC_API void ** const GC_auobjfreelist_ptr; -#endif - -GC_API void GC_CALL GC_incr_bytes_allocd(size_t bytes); -GC_API void GC_CALL GC_incr_bytes_freed(size_t bytes); - -#ifdef __cplusplus - } /* extern "C" */ -#endif - -#endif /* GC_ALLOC_PTRS_H */
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/new_gc_alloc.h
Deleted
@@ -1,517 +0,0 @@ -/* - * Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. - * - * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED - * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. - * - * Permission is hereby granted to use or copy this program - * for any purpose, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is granted, - * provided the above notices are retained, and a notice that the code was - * modified is included with the above copyright notice. - */ - -// -// This is a revision of gc_allocator.h for SGI STL versions > 3.0. -// Unlike earlier versions, it supplements the standard (STL) alloc.h -// instead of replacing it. -// -// This is sloppy about variable names used in header files. -// It also doesn't yet understand the new header file names or -// namespaces. -// -// This assumes the collector has been compiled with -DGC_ATOMIC_UNCOLLECTABLE. -// The user should also consider -DREDIRECT_MALLOC=GC_uncollectable_malloc, -// to ensure that object allocated through malloc are traced. -// -// Some of this could be faster in the explicit deallocation case. -// In particular, we spend too much time clearing objects on the -// free lists. That could be avoided. -// -// This uses template classes with static members, and hence does not work -// with g++ 2.7.2 and earlier. -// -// Unlike its predecessor, this one simply defines -// gc_alloc -// single_client_gc_alloc -// traceable_alloc -// single_client_traceable_alloc -// -// It does not redefine alloc. Nor does it change the default allocator, -// though the user may wish to do so. (The argument against changing -// the default allocator is that it may introduce subtle link compatibility -// problems. The argument for changing it is that the usual default -// allocator is usually a very bad choice for a garbage collected environment.) -// - -#ifndef GC_NEW_ALLOC_H -#define GC_NEW_ALLOC_H - -#include "gc.h" - -#if GC_GNUC_PREREQ(3, 0) -# include <bits/stl_alloc.h> -# ifndef __STL_BEGIN_NAMESPACE -# define __STL_BEGIN_NAMESPACE namespace std { -# define __STL_END_NAMESPACE }; -# endif -# ifndef __STL_USE_STD_ALLOCATORS -# define __STL_USE_STD_ALLOCATORS -# endif -#else -# include <stack> // A more portable way to get stl_alloc.h file. -#endif - -/* A hack to deal with gcc 3.1. If you are using gcc3.1 and later, */ -/* you should probably really use gc_allocator.h instead. */ -#if GC_GNUC_PREREQ(3, 1) -# define simple_alloc __simple_alloc -#endif - -#include <stddef.h> -#include <string.h> - -// We can't include gc_priv.h, since that pulls in way too much stuff. -#include "gc_alloc_ptrs.h" - -#include "gc_mark.h" // for GC_generic_malloc - -#define GC_generic_malloc_words_small(lw, k) \ - GC_generic_malloc((lw) * sizeof(GC_word), k) - -#define GC_ALLOCATOR_THROW_OR_ABORT() GC_abort_on_oom() - -// Object kinds; must match PTRFREE, NORMAL, UNCOLLECTABLE, and -// AUNCOLLECTABLE in gc_priv.h. - -enum { GC_PTRFREE = 0, GC_NORMAL = 1, GC_UNCOLLECTABLE = 2, - GC_AUNCOLLECTABLE = 3 }; - -enum { GC_max_fast_bytes = 255 }; - -enum { GC_byte_alignment = 8 }; - -#if defined(CPPCHECK) - const unsigned GC_bytes_per_word = sizeof(char *); - const unsigned GC_word_alignment = GC_byte_alignment/GC_bytes_per_word; -#else - enum { GC_bytes_per_word = sizeof(char *) }; - enum { GC_word_alignment = GC_byte_alignment/GC_bytes_per_word }; -#endif - -inline void * &GC_obj_link(void * p) -{ return *reinterpret_cast<void **>(p); } - -// Compute a number of words >= n+1 bytes. -// The +1 allows for pointers one past the end. -inline size_t GC_round_up(size_t n) -{ - return ((n + GC_byte_alignment)/GC_byte_alignment)*GC_word_alignment; -} - -// The same but don't allow for extra byte. -inline size_t GC_round_up_uncollectable(size_t n) -{ - return ((n + GC_byte_alignment - 1)/GC_byte_alignment)*GC_word_alignment; -} - -template <int dummy> -class GC_aux_template { -public: - // File local count of allocated words. Occasionally this is - // added into the global count. A separate count is necessary since the - // real one must be updated with a procedure call. - static size_t GC_bytes_recently_allocd; - - // Same for uncollectible memory. Not yet reflected in either - // GC_bytes_recently_allocd or GC_non_gc_bytes. - static size_t GC_uncollectable_bytes_recently_allocd; - - // Similar counter for explicitly deallocated memory. - static size_t GC_bytes_recently_freed; - - // Again for uncollectible memory. - static size_t GC_uncollectable_bytes_recently_freed; - - static void * GC_out_of_line_malloc(size_t nwords, int kind); -}; - -template <int dummy> -size_t GC_aux_template<dummy>::GC_bytes_recently_allocd = 0; - -template <int dummy> -size_t GC_aux_template<dummy>::GC_uncollectable_bytes_recently_allocd = 0; - -template <int dummy> -size_t GC_aux_template<dummy>::GC_bytes_recently_freed = 0; - -template <int dummy> -size_t GC_aux_template<dummy>::GC_uncollectable_bytes_recently_freed = 0; - -template <int dummy> -void * GC_aux_template<dummy>::GC_out_of_line_malloc(size_t nwords, int kind) -{ - void * op = GC_generic_malloc_words_small(nwords, kind); - if (0 == op) - GC_ALLOCATOR_THROW_OR_ABORT(); - - GC_word non_gc_bytes = GC_get_non_gc_bytes(); - GC_bytes_recently_allocd += GC_uncollectable_bytes_recently_allocd; - non_gc_bytes += GC_uncollectable_bytes_recently_allocd; - GC_uncollectable_bytes_recently_allocd = 0; - - GC_bytes_recently_freed += GC_uncollectable_bytes_recently_freed; - non_gc_bytes -= GC_uncollectable_bytes_recently_freed; - GC_uncollectable_bytes_recently_freed = 0; - GC_set_non_gc_bytes(non_gc_bytes); - - GC_incr_bytes_allocd(GC_bytes_recently_allocd); - GC_bytes_recently_allocd = 0; - - GC_incr_bytes_freed(GC_bytes_recently_freed); - GC_bytes_recently_freed = 0; - return op; -} - -typedef GC_aux_template<0> GC_aux; - -// A fast, single-threaded, garbage-collected allocator -// We assume the first word will be immediately overwritten. -// In this version, deallocation is not a no-op, and explicit -// deallocation is likely to help performance. -template <int dummy> -class single_client_gc_alloc_template { - public: - static void * allocate(size_t n) - { - size_t nwords = GC_round_up(n); - void ** flh; - void * op; - - if (n > GC_max_fast_bytes) { - op = GC_malloc(n); - if (0 == op) - GC_ALLOCATOR_THROW_OR_ABORT(); - return op; - } - flh = &GC_objfreelist_ptrnwords; - op = *flh; - if (0 == op) {
View file
_service:tar_scm:gc-8.0.6.tar.gz/sparc_sunos4_mach_dep.s
Deleted
@@ -1,32 +0,0 @@ -! SPARCompiler 3.0 and later apparently no longer handles -! asm outside functions. So we need a separate .s file -! This is only set up for SunOS 4. -! Assumes this is called before the stack contents are -! examined. - - .seg "text" - .globl _GC_save_regs_in_stack - .globl _GC_push_regs -_GC_save_regs_in_stack: -_GC_push_regs: - ta 0x3 ! ST_FLUSH_WINDOWS - mov %sp,%o0 - retl - nop - - .globl _GC_clear_stack_inner -_GC_clear_stack_inner: - mov %sp,%o2 ! Save sp - add %sp,-8,%o3 ! p = sp-8 - clr %g1 ! g0,g1 = 0 - add %o1,-0x60,%sp ! Move sp out of the way, - ! so that traps still work. - ! Includes some extra words - ! so we can be sloppy below. -loop: - std %g0,%o3 ! *(long long *)p = 0 - cmp %o3,%o1 - bgu loop ! if (p > limit) goto loop - add %o3,-8,%o3 ! p -= 8 (delay slot) - retl - mov %o2,%sp ! Restore sp., delay slot
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/CMakeLists.txt
Deleted
@@ -1,47 +0,0 @@ -# -# Copyright (c) 1994 by Xerox Corporation. All rights reserved. -# Copyright (c) 1996 by Silicon Graphics. All rights reserved. -# Copyright (c) 1998 by Fergus Henderson. All rights reserved. -# Copyright (c) 2000-2010 by Hewlett-Packard Company. All rights reserved. -## -# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED -# OR IMPLIED. ANY USE IS AT YOUR OWN RISK. -## -# Permission is hereby granted to use or copy this program -# for any purpose, provided the above notices are retained on all copies. -# Permission to modify the code and to distribute modified code is granted, -# provided the above notices are retained, and a notice that the code was -# modified is included with the above copyright notice. -## - -ADD_DEFINITIONS(-DGC_NOT_DLL) - -# Compile some tests as C++ to test extern "C" in header files. -SET_SOURCE_FILES_PROPERTIES( - leak_test.c - test.c - PROPERTIES LANGUAGE CXX) - -ADD_EXECUTABLE(gctest WIN32 test.c) -TARGET_LINK_LIBRARIES(gctest gc-lib) -ADD_TEST(NAME gctest COMMAND gctest) - -ADD_EXECUTABLE(hugetest huge_test.c) -TARGET_LINK_LIBRARIES(hugetest gc-lib) -ADD_TEST(NAME hugetest COMMAND hugetest) - -ADD_EXECUTABLE(leaktest leak_test.c) -TARGET_LINK_LIBRARIES(leaktest gc-lib) -ADD_TEST(NAME leaktest COMMAND leaktest) - -ADD_EXECUTABLE(middletest middle.c) -TARGET_LINK_LIBRARIES(middletest gc-lib) -ADD_TEST(NAME middletest COMMAND middletest) - -ADD_EXECUTABLE(realloc_test realloc_test.c) -TARGET_LINK_LIBRARIES(realloc_test gc-lib) -ADD_TEST(NAME realloc_test COMMAND realloc_test) - -ADD_EXECUTABLE(smashtest smash_test.c) -TARGET_LINK_LIBRARIES(smashtest gc-lib) -ADD_TEST(NAME smashtest COMMAND smashtest)
View file
_service:tar_scm:gc-8.0.6.tar.gz/AUTHORS -> _service:tar_scm:gc-8.2.2.tar.gz/AUTHORS
Changed
@@ -55,6 +55,7 @@ Andrew Pinski <pinskia@physics.uc.edu> Andrew Stitcher <astitcher@redhat.com> Andrew Stone <andrew@stone.com> +Andrew Whatson <whatson@gmail.com> Andy Li <andy@onthewings.net> Andy Wingo <wingo@pobox.com> Anselm Baird-Smith <Anselm.BairdSmith@inria.fr> @@ -85,6 +86,7 @@ Brian Burton <bburton@users.sourceforge.net> Brian D. Carlstrom <bdc@clark.lcs.mit.edu> Brian F. Dennis <xjam@cork.cs.berkeley.edu> +Brian J. Cardiff <bcardiff@gmail.com> Brian Lewis <btlewis@eng.sun.com> Bruce A Henderson <woollybah@gmail.com> Bruce Hoult <bruce@hoult.org> @@ -128,17 +130,19 @@ David Grove <groved@us.ibm.com> David Leonard <leonard@users.sourceforge.net> David Miller <davem@davemloft.net> -David Mossberger +David Mosberger <davidm@hpl.hp.com> David Peroutka <djp@volny.cz> David Pickens <dsp@rci.rutgers.edu> David Stes <stes@d5e02b1d.kabel.telenet.be> David Terei <d@davidterei.com> David Van Horn <dvanhorn@ccs.neu.edu> Davide Angelocola <davide.angelocola@tiscali.it> +Davide Beatrici <git@davidebeatrici.dev> Demyan Kimitsa <demyan.kimitsa@gmail.com> Dick Porter <dick@acm.org> Dietmar Planitzer <dave.pl@ping.at> Dima Pasechnik <dimpase@gmail.com> +Dimitris Apostolou <dimitris.apostolou@icloud.com> Dimitris Vyzovitis <vyzo@media.mit.edu> Dimitry Andric <dim@freebsd.org> Djamel Magri <djamel.magri@googlemail.com> @@ -162,6 +166,7 @@ Gabor Drescher <gabor.drescher@cs.fau.de> Gary Leavens <leavens@eecs.ucf.edu> Geoff Norton <grompf@sublimeintervention.com> +George Koehler <kernigh@gmail.com> George Talbot <Gtalbot@ansarisbio.com> Gerard A Allan Glauco Masotti <glauco.masotti@libero.it> @@ -184,6 +189,7 @@ Ian Piumarta <piumarta@prof.inria.fr> Ian Searle <ians@eskimo.com> Igor Khavkine <i_khavki@alcor.concordia.ca> +Ilya Kurdyukov <ilyakurdyukov@altlinux.org> Ivan Demakov <ivan@tgrad.nsk.su> Ivan Maidanski <ivmai@mail.ru> Ivan R <iarspider@gmail.com> @@ -191,8 +197,10 @@ Jack Andrews <effbiae@gmail.com> Jacob Navia <jacob.navia@jacob.remcomp.fr> Jakub Jelinek <jakub@redhat.com> +Jakub Wojciech <jakub-w@riseup.net> James Clark <jjc@jclark.com> James Dominy +James Moran <jamesmo@unity3d.com> Jan Alexander Steffens <jan.steffens@gmail.com> Jan Wielemaker <J.Wielemaker@cs.vu.nl> Jani Kajala <jani@sumea.com> @@ -207,7 +215,7 @@ Jeffrey Mark Siskind Jeremy Fitzhardinge <jeremy@goop.org> Jesper Peterson <jep@mtiame.mtia.oz.au> -Jesse Hull +Jesse Hull <jhull@parc.xerox.com> Jesse Jones <jesjones@mindspring.com> Jesse Rosenstock <jmr@ugcs.caltech.edu> Ji-Yong Chung @@ -221,7 +229,8 @@ John Bowman <bowman@ualberta.ca> John Clements <clements@brinkerhoff.org> John David Anglin <dave.anglin@bell.net> -John Ellis <ellis@xerox.parc.com> +John Ellis <ellis@parc.xerox.com> +John Ericson <git@JohnEricson.me> John Merryweather Cooper <jmerry@mono-cvs.ximian.com> Jon Moore <jonm@apache.org> Jonas Echterhoff <jonas@unity3d.com> @@ -280,16 +289,21 @@ Martin Koeppe <mkoeppe@gmx.de> Martin Tauchmann <martintauchmann@bigfoot.com> Massimiliano Gubinelli <m.gubinelli@gmail.com> +Matheus Rambo <mrambo@grupodimed.com.br> Matt Austern <austern@google.com> Matthew Flatt <mflatt@plt-scheme.org> Matthias Andree <matthias.andree@gmx.de> Matthias Drochner <M.Drochner@fz-juelich.de> +Matthieu Herrb <matthieu@openbsd.org> Maurizio Vairani <maurizio.vairani@cloverinformatica.it> Max Mouratov <mmouratov@gmail.com> +Maximilian Downey Twiss <creatorsmithmdt@gmail.com> +Maya Rashish <coypu@sdf.org> Melissa O'Neill <oneill@cs.sfu.ca> Michael Arnoldus <chime@proinf.dk> Michael DeRoy <deroymichael@gmail.com> Michael Fox <mfox@cavium.com> +Michael Herring <khakionion@gmail.com> Michael Smith <msmith@spinnakernet.com> Michael Spertus <mps@geodesic.com> Michel Schinz <schinz@alphanet.ch> @@ -305,6 +319,7 @@ Nathanael Nerode <neroden@twcny.rr.com> Neale Ferguson <neale@mono-cvs.ximian.com> Neil Sharman <neil@cs.mu.oz.au> +Nguyen Thai Ngoc Duy <pclouds@gmail.com> Nicolas Cannasse <ncannasse@motion-twin.com> Niibe Yutaka <gniibe@fsij.org> Nikita Ermakov <coffe92@gmail.com> @@ -371,16 +386,20 @@ Samuel Martin <s.martin49@gmail.com> Samuel Thibault <samuel.thibault@gnu.org> Scott Ananian <cananian@lesser-magoo.lcs.mit.edu> +Scott Ferguson <scott.ferguson@unity3d.com> Scott Schwartz <schwartz@groucho.cse.psu.edu> Shawn Wagner <shawnw@speakeasy.org> Shea Levy <shea@shealevy.com> Shiro Kawai <shiro@lava.net> Simon Gornall <simon@gornall.net> +Simon Kainz <simon@familiekainz.at> Simon Posnjak <simon.posnjak@siol.net> Slava Sysoltsev <Viatcheslav.Sysoltsev@h-d-gmbh.de> Sorawee Porncharoenwase <sorawee.pwase@gmail.com> +ssrlive <ssrlivebox@gmail.com> Stefan Ring <stefanrin@gmail.com> Stefano Rivera <stefano@rivera.za.net> +Steve Youngs <steve@sxemacs.org> Sugioka Toshinobu <sugioka@itonet.co.jp> Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> Sven Hartrumpf <Sven.Hartrumpf@fernuni-hagen.de> @@ -399,6 +418,7 @@ Thorsten Glaser <tg@debian.org> Tilman Vogel <Tilman.Vogel@web.de> Tim Bingham <tjb@zko.dec.com> +Tim Cannell <timcannell@unity3d.com> Tim Gates <tim.gates@iress.com> Timothy N. Newsham <newsham@wiliki.eng.hawaii.edu> Tom Tromey <tromey@cygnus.com> @@ -415,6 +435,7 @@ Vernon Lee <scorpion@rice.edu> Victor Ivrii <ivrii@math.toronto.edu> Victor Romero <romerosanchezv@gmail.com> +Vineet Gupta <vgupta@synopsys.com> Vitaly Magerya <vmagerya@gmail.com> Vladimir Tsichevski <wowa@jet.msk.su> Walter Bright <walter@walterbright.com> @@ -426,10 +447,12 @@ Xiaokun Zhu <xiaokun@aero.gla.ac.uk> Yann Dirson <dirson@debian.org> Yannis Bres <Yannis@bres.name> +Yasuhiro Kimura <yasu@utahime.org> Yuki Okumura <mjt@cltn.org> Yusuke Suzuki <utatane.tea@gmail.com> Yvan Roux <yvan.roux@linaro.org> Zach Saw <zach.saw@gmail.com> +Zhang Na <zhangna@loongson.cn> Zhiying Chen Zhong Shao <zhong.shao@yale.edu> Zoltan Varga <vargaz@gmail.com>
View file
_service:tar_scm:gc-8.0.6.tar.gz/CMakeLists.txt -> _service:tar_scm:gc-8.2.2.tar.gz/CMakeLists.txt
Changed
@@ -3,6 +3,7 @@ # Copyright (c) 1996 by Silicon Graphics. All rights reserved. # Copyright (c) 1998 by Fergus Henderson. All rights reserved. # Copyright (c) 2000-2010 by Hewlett-Packard Company. All rights reserved. +# Copyright (c) 2010-2021 Ivan Maidanski ## # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -21,232 +22,768 @@ # this will generate gc.sln # -SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required - -PROJECT(gc) - -INCLUDE(CTest) - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) - -ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE - -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION") - -#LIBATOMIC #TODO -#ADD_LIBRARY(atomic_ops STATIC ) -#SET_TARGET_PROPERTIES(atomic_ops PROPERTIES COMPILE_FLAGS -DNO_DEBUGGING) - - -#LIBGC - -INCLUDE_DIRECTORIES(include) -INCLUDE_DIRECTORIES(libatomic_ops/src) - -SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c +cmake_minimum_required(VERSION 3.1) + +set(PACKAGE_VERSION 8.2.2) +# 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:1:5) +set(LIBGCCPP_VER_INFO 6:0:5) + +option(enable_cplusplus "C++ support" OFF) +if (enable_cplusplus) + project(gc) +else() + project(gc C) +endif() + +include(CheckCCompilerFlag) +include(CheckCSourceCompiles) +include(CheckFunctionExists) +include(CheckIncludeFile) +include(CheckSymbolExists) +include(CMakePackageConfigHelpers) +include(CTest) +include(GNUInstallDirs) + +# Customize the build by passing "-D<option_name>=ON|OFF" in the command line. +option(BUILD_SHARED_LIBS "Build shared libraries" ON) +option(build_cord "Build cord library" ON) +option(build_tests "Build tests" OFF) +option(enable_docs "Build and install documentation" ON) +option(enable_threads "Support threads" ON) +option(enable_parallel_mark "Parallelize marking and free list construction" ON) +option(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON) +option(enable_threads_discovery "Enable threads discovery in GC" ON) +option(enable_throw_bad_alloc_library "Turn on C++ gctba library build" ON) +option(enable_gcj_support "Support for gcj" ON) +option(enable_sigrt_signals "Use SIGRTMIN-based signals for thread suspend/resume" OFF) +option(enable_gc_debug "Support for pointer back-tracing" OFF) +option(disable_gc_debug "Disable debugging like GC_dump and its callees" OFF) +option(enable_java_finalization "Support for java finalization" ON) +option(enable_atomic_uncollectable "Support for atomic uncollectible allocation" ON) +option(enable_redirect_malloc "Redirect malloc and friends to GC routines" OFF) +option(enable_disclaim "Support alternative finalization interface" ON) +option(enable_large_config "Optimize for large heap or root set" OFF) +option(enable_gc_assertions "Enable collector-internal assertion checking" OFF) +option(enable_mmap "Use mmap instead of sbrk to expand the heap" OFF) +option(enable_munmap "Return page to the OS if empty for N collections" ON) +option(enable_dynamic_loading "Enable tracing of dynamic library data roots" ON) +option(enable_register_main_static_data "Perform the initial guess of data root sets" ON) +option(enable_checksums "Report erroneously cleared dirty bits" OFF) +option(enable_werror "Pass -Werror to the C compiler (treat warnings as errors)" OFF) +option(enable_single_obj_compilation "Compile all libgc source files into single .o" OFF) +option(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) +option(disable_handle_fork "Prohibit installation of pthread_atfork() handlers" OFF) +option(install_headers "Install header and pkg-config metadata files" ON) +option(without_libatomic_ops "Use atomic_ops.h in libatomic_ops/src" OFF) + +# Override the default build type to RelWithDebInfo (this instructs cmake to +# pass -O2 -g -DNDEBUG options to the compiler by default). +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE + STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY + STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel") +endif() + +# Convert VER_INFO values to SOVERSION ones. +if (BUILD_SHARED_LIBS) + # cord: + string(REGEX REPLACE "(.+):.+:.+" "\\1" cord_cur ${LIBCORD_VER_INFO}) + string(REGEX REPLACE ".+:(.+):.+" "\\1" cord_rev ${LIBCORD_VER_INFO}) + string(REGEX REPLACE ".+:.+:(.+)$" "\\1" cord_age ${LIBCORD_VER_INFO}) + math(EXPR CORD_SOVERSION "${cord_cur} - ${cord_age}") + set(CORD_VERSION_PROP "${CORD_SOVERSION}.${cord_age}.${cord_rev}") + message(STATUS "CORD_VERSION_PROP = ${CORD_VERSION_PROP}") + # gc: + string(REGEX REPLACE "(.+):.+:.+" "\\1" gc_cur ${LIBGC_VER_INFO}) + string(REGEX REPLACE ".+:(.+):.+" "\\1" gc_rev ${LIBGC_VER_INFO}) + string(REGEX REPLACE ".+:.+:(.+)$" "\\1" gc_age ${LIBGC_VER_INFO}) + math(EXPR GC_SOVERSION "${gc_cur} - ${gc_age}") + set(GC_VERSION_PROP "${GC_SOVERSION}.${gc_age}.${gc_rev}") + message(STATUS "GC_VERSION_PROP = ${GC_VERSION_PROP}") + # gccpp and gctba: + string(REGEX REPLACE "(.+):.+:.+" "\\1" gccpp_cur ${LIBGCCPP_VER_INFO}) + string(REGEX REPLACE ".+:(.+):.+" "\\1" gccpp_rev ${LIBGCCPP_VER_INFO}) + string(REGEX REPLACE ".+:.+:(.+)$" "\\1" gccpp_age ${LIBGCCPP_VER_INFO}) + math(EXPR GCCPP_SOVERSION "${gccpp_cur} - ${gccpp_age}") + set(GCCPP_VERSION_PROP "${GCCPP_SOVERSION}.${gccpp_age}.${gccpp_rev}") + message(STATUS "GCCPP_VERSION_PROP = ${GCCPP_VERSION_PROP}") +endif(BUILD_SHARED_LIBS) + +add_definitions("-DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION") + +# Set struct packing alignment to word (instead of 1-byte). +if (BORLAND) + add_compile_options(/a4) +elseif (WATCOM) + add_compile_options(/zp4) +endif() + +# Output all warnings. +if (BORLAND) + # All warnings except for particular ones. + add_compile_options(/w /w-pro /w-aus /w-par /w-ccc /w-inl /w-rch) +elseif (MSVC) + # 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) +else() + # TODO add -Wpedantic -Wno-long-long + add_compile_options(-Wall -Wextra) +endif() + +include_directories(include) + +set(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c blacklst.c finalize.c new_hblk.c dbg_mlc.c malloc.c dyn_load.c typd_mlc.c ptr_chck.c mallocx.c) -SET(LIBS) -OPTION(enable_threads "TODO" NO) -IF(enable_threads) - FIND_PACKAGE(Threads REQUIRED) - MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" ) - INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR}) - SET(LIBS ${LIBS} ${Threads_LIBRARIES}) -ENDIF(enable_threads) - -OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) - -OPTION(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON) - -OPTION(enable_parallel_mark "Parallelize marking and free list construction" ON) - -#IF(Threads_FOUND) -# ADD_DEFINITIONS("") -#ELSE -# MESSAGE("Parallel mark requires enable_threads ON" ) -#ENDIF(Threads_FOUND) - -#OPTION(enable_cplusplus "install C++ support" ON) -SET(SRC ${SRC} gc_cpp.cc) - -SET(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM}) #FIXME missing the vendor field. -STRING(TOLOWER ${_HOST} HOST) -MESSAGE("HOST = ${HOST}") - -# Thread Detection. Relying on cmake for lib and includes. -#TODO check cmake detection -IF(CMAKE_USE_PTHREADS_INIT) - SET(SRC ${SRC} gc_dlopen.c pthread_start.c pthread_stop_world.c - pthread_support.c) - # Common defines for most POSIX platforms. - IF( HOST MATCHES .*-.*-aix.*|.*-.*-android.*|.*-.*-cygwin.*|.*-.*-darwin.*|.*-.*-.*freebsd.*|.*-.*-haiku.*|.*-.*-gnu.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-.*linux.*|.*-.*-msys.*|.*-.*-nacl.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) - ADD_DEFINITIONS("-DGC_THREADS -D_REENTRANT") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF(enable_parallel_mark)
View file
_service:tar_scm:gc-8.0.6.tar.gz/ChangeLog -> _service:tar_scm:gc-8.2.2.tar.gz/ChangeLog
Changed
@@ -1,4 +1,435 @@ +== 8.2.2 2022-08-26 == + +* Abort if no progress with thread suspend/resume signals resending +* Add CMake option to force libatomic_ops headers usage +* Add _PROP suffix to CORD/GCCPP_VERSION variables in CMake script +* Allow not to bypass pthread_cancel hardening in pthread_start +* Allow to start marker threads in child of single-threaded client +* Avoid potential race in GC_init_real_syms after GC_allow_register_threads +* Avoid potential signal loss before sigsuspend in suspend_handler if TSan +* Define SUNOS5SIGS macro for kFreeBSD +* Distribute gc_gcj.h and some other headers in single-obj-compilation +* Do not assert that GC is initialized at DLL_THREAD_DETACH (Win32) +* Do not call SET_HDR() to remove forwarding counts if none exists in hblk +* Do not call mprotect/mmap to GC_unmap/remap (Linux) +* Do not count unmapped regions if GC_unmap is madvise-based (Linux) +* Do not define NEED_FIND_LIMIT in case of OpenBSD user threads +* Do not fail tests if pthread_create returns resource unavailable error +* Do not name GCC intrinsics as C11 ones +* Do not probe to find main data root start if dl_iterate_phdr exists +* Do not send signal to thread which is suspended manually +* Do not use usleep between signals resend if ThreadSanitizer +* Eliminate '-pedantic is not option that controls warnings' GCC-6.3 message +* Eliminate '/GS can not protect parameters' MS VC warning in msvc_dbg +* Eliminate 'R_AARCH64_ABS64 used with TLS symbol' linker warning (clang) +* Eliminate 'buffer overflow detected' FP error in realloc_test +* Eliminate 'extension used' clang warning in sparc_mach_dep.S (configure) +* Eliminate 'function/data pointer conversion in expression' MSVC warning +* Eliminate 'implicit decl of _setjmp' gcc warning if -std=c11 on Cygwin +* Eliminate 'layout of aggregates has changed in GCC 5' warning in test_cpp +* Eliminate 'new_l may be used uninitialized' gcc warning in os_dep (Cygwin) +* Eliminate 'old_gc_no is initialized but not referenced' MS VC false warning +* Eliminate 'possible loss of data' compiler warning in GC_envfile_getenv +* Eliminate 'potentially uninitialized local variable tc' warning (MSVC) +* Eliminate 'skipping config since MAX_HEAP_SECTS is unknown' cppcheck FP +* Eliminate 'unused but set variable' gcc warnings in cpptest +* Eliminate 'value exceeds maximum size' warnings in debug_malloc, huge_test +* Eliminate 'writing into region of size 0' gcc FP warning in realloc +* Eliminate ASan stack-buffer-underflow FP in GC_mark_and_push_stack (E2K) +* Eliminate code defect about incorrect size of allocated object (leaktest) +* Eliminate data race reported by TSan in GC_have_errors +* Eliminate division-by-zero FP warning in GC_ASSERT in reclaim_block +* Eliminate stringop-overflow gcc-12 warning in CORD__next +* Ensure typed objects descriptor is never located in the first word +* Fix 'GC_greatest_stack_base_below is defined but not used' warning (IA64) +* Fix 'GC_text_mapping not used' GCC warning if redirect malloc w/o threads +* Fix 'ISO C forbids conversion of function pointer to object' warning +* Fix 'undeclared getpagesize' compiler warning on AIX and OSF1 +* Fix 'undefined reference to __data_start' linker error on Linux/aarch64 +* Fix 'unresolved __imp__wsprintfA' linker error in msvc_dbg.c (MSVC) +* Fix 'unresolved symbol GetModuleHandle' error in win32_threads.c (UWP) +* Fix (workaround) stack overflow in gctest on Alpine Linux/s390x +* Fix GC_ATTR_NO_SANITIZE_THREAD definition for GCC +* Fix GC_allocate_ml incorrect cleanup in GC_deinit if pthreads (MinGW) +* Fix GC_dirty() argument in GC_malloc_explicitly_typed_ignore_off_page +* Fix GC_make_descriptor for zero length argument +* Fix GC_suspend_thread if called before thread destructor +* Fix GC_unmapped_bytes update in GC_unmap for Sony PS/3 +* Fix SIGSEGV caused by dropped stack access from child process in gctest +* Fix SUNOS5SIGS documentation to match macro definition in gcconfig.h +* Fix abort in Win32 DllMain if PARALLEL_MARK +* Fix abort when GC_repeat_read returns zero +* Fix assertion about built-in AO_test_and_set_acquire on sparc64 (gcc-12) +* Fix assertion violation in GC_allow_register_threads on Windows +* Fix assertion violation of GC_thread_key alignment if pthread-based TLS +* Fix comment in GC_init regarding GC_init_parallel call +* Fix context saving when GC_suspend_thread(self) +* Fix data race in fail_proc1 of gctest +* Fix hang in GC_free if GC_PREFER_MPROTECT_VDB (Mingw64) +* Fix hang in select() called from suspend signal handler if TSan +* Fix hang on sem_wait in GC_suspend_thread if thread was resumed recently +* Fix hb_obj_kind type in documentation (ASCII diagram) describing hblkhdr +* Fix incremental mode enabling in gctest if TEST_MANUAL_VDB +* Fix linking of tests in case of finalization is off +* Fix lock assertion violation in GC_find_limit if always multi-threaded +* Fix memory return to OS in GC_unmap +* Fix missing lock when GC_generate_random_valid_address is called +* Fix missing write() declaration if CONSOLE_LOG (Watcom) +* Fix nodist_libgc_la_SOURCES value in Makefile.am for Solaris/sparc +* Fix oldProc initialization in gc_cleanup and eliminate related warnings +* Fix parallel_initialized assertion violation in initsecondarythread (Win32) +* Fix potential race if start_mark_threads called from threads in child +* Fix propagation of out-of-memory occurred in GC_make_sequence_descriptor +* Fix pthread_setname_np and dladdr detection by CMake +* Fix race between calloc_explicitly_typed and push_complex_descriptor +* Fix typos in comments and debugging.md +* Fix undefined __stack_base__ on UWP/arm64 (llvm-mingw) +* Force GC_with_callee_saves_pushed in suspend_handler if NO_SA_SIGACTION +* Link with rt library to get clock_gettime where necessary +* Make finalizer_closure pointer read/write atomic in malloc and callback +* Move platform-specific sleep call to GC_usleep (refactoring) +* Pass -lrt linker option in CMake script on HP/UX, NetBSD +* Prevent (fix) parallel custom mark procs run in single-threaded clients +* Prevent changing of GC_markers_m1 value while collection in progress +* Refer to Makefile.direct instead of deleted Makefile file in README +* Relax assertion of hb_n_marks in reclaim_block if more than two markers +* Remove IF_IA64 macro in pthread_stop_world (refactoring) +* Remove checking of RS6000 completely +* Remove duplicate check of MSWIN_XBOX1 in os_dep.c +* Remove duplicate include gc_tiny_fl.h in gc_priv.h +* Remove non-working check of M68K in gctest +* Remove useless TSan W/A about read of mark_lock_holder for Windows +* Replace RAISE_SIGNAL macro with a static function (refactoring) +* Replace SSH cloning with HTTPS one in README +* Retry pthread_kill if EAGAIN (Linux) +* Revert "Check real-symbols are already initialized in pthread_join/detach" +* Revert "Remove nested always-false ifdef for HPUX and FREEBSD" +* Revert addition of msvc_dbg.h in include.am +* Set default build type to RelWithDebInfo (CMake) +* Start configure help messages with a lower case letter +* Support 'z' format modifier by CORD_vsprintf +* Support Elbrus 2000 (Linux/e2k) +* Support GCC MCF thread model (mcfgthreads) in configure (MinGW) +* Support GC_remove_roots on Win32 +* Support OpenBSD/riscv64 +* Support build using Makefile.direct on Linux/sparc +* Support space-separated flags in CFLAGS_EXTRA passed to CMake +* Update README.win32 about default build configuration (configure, cmake) +* Update documentation of GC_RATE and MAX_PRIOR_ATTEMPTS +* Use SIGRTMIN+6 as suspend signal if sigrt-signals on OpenBSD +* Use SIGUSR1/2 on FreeBSD/arm64 +* Use compiler TLS on NetBSD only if at least gcc-4.4 or clang-3.9 +* Workaround 'info is not assigned' cppcheck FP if assertions on (OS X) +* Workaround SIG_SUSPEND delivery to thread inside mutex_lock fail if TSan +* Workaround TSan FP about race between generic_malloc and array_mark_proc +* Workaround TSan FP in acquire_mark_lock called from fork_prepare_proc +* Workaround TSan FP warning in finalized_malloc, push_unconditionally +* Workaround TSan FP warning in fork_prepare_proc +* Workaround TSan FP warning in push_marked1/2/4, ptr_store_and_dirty +* Workaround Thread Sanitizer (TSan) FP warning in is_valid_displacement +* Workaround call stack size exceeded in gctest (Wasm) +* Workaround crash in FreeBSD rand() by avoiding its concurrent usage +* Workaround gctest hang if test compiled as C++ code by MSVC (CMake) +* Workaround msvc_dbg.c build failure on arm64 (MSVC) + + +== 8.2.0 2021-09-29 == + +* Add API for accessing incremental GC time limit with nanosecond precision +* Add API function to force start of incremental collection +* Add GC_ prefix to scan_ptr and some other static variables (refactoring) +* Add GC_get/set_disable_automatic_collection API +* Add I_HOLD_LOCK assertion to expand_hp_inner and related functions +* Add assertion on free-list argument and result of GC_new_kind +* Add assertion that GC is initialized to base incremental_protection_needs +* Add assertions that GC_page_size is initialized +* Add cordtest, staticrootstest, test_cpp, tracetest, disclaim tests (CMake) +* Add debug messages on thread suspend/resume (Win32) +* Add dummy testing of GC_incr_bytes_allocd/freed +* Add table of contents in gcdescr.md +* Add testing of GC_CALLOC/MALLOC_EXPLICITLY_TYPED (gctest) +* Adjust formatting of numbered lists in README.md to match other .md files +* Adjust highlighting of API prototypes in gcinterface.md +* Adjust macro def/usage for AVR32, CRIS, NETBSD, OPENBSD, SH4 in gcconfig.h +* Adjust printf calls in gctest check_heap_stats so that each has new-line +* Allow incremental GC on Cygwin +* Allow memory unmapping in case of MPROTECT_VDB +* Allow to disable GWW or mprotect-based VDB at build +* Allow to disable Glibc FPU exception mask and TSX workarounds (Linux) +* Allow to disable __builtin_return_address(1) usage (x86 and x64) +* Allow to specify custom value of LOG_PHT_ENTRIES +* Always abort on failure to access /proc/self/maps (Linux) +* Always define default_push_other_roots (code refactoring) +* Avoid gcc stringop-overflow warning for intended overflow in smashtest +* Avoid initial 3ms pause on world stop/start with GC_retry_signals (Linux) +* Build cord.lib by Makefile.direct, NT_MAKEFILE, OS2_MAKEFILE, WCC_MAKEFILE +* Build gc as a shared multi-threaded library by default (CMake) +* Build gccpp library by Makefile.direct, NT_MAKEFILE and WCC_MAKEFILE +* Build gctba library +* Build shared libraries by default (WCC_MAKEFILE) +* Change CLOCK_TYPE to timespec for Nintendo Switch (code refactoring) +* Change EMSCRIPTEN macro for internal use to no-underscore format +* Change log_size fields of finalizer to unsigned type (code refactoring) +* Change type of toggleref_array_size/capacity to size_t (code refactoring) +* Check leak of objects allocated by CRT malloc in gctest (MS VC) +* Check real-symbols are already initialized in pthread_join/detach +* Collapse multiple includes of windows.h (code refactoring) +* Comments reformatting in mark.c to properly delimit sentences +* Compile de test GUI app with resources (CMake) +* Compile gc.c unless building static libraries (NT_MAKEFILE, WCC_MAKEFILE) +* Compile msvc_dbg.c by CMake script (MS VC) +* Declare API function and print amount of memory obtained from OS +* Define GC_win32_free_heap API function for all Windows targets +* Define STATIC macro to static by default +* Depend number of fork_a_thread calls on NTHREADS (gctest) +* Detect dladdr() presence in CMake script +* Detect presence of execinfo.h system header in CMake script +* Detect presence of getcontext and dl_iterate_phdr in CMake script +* Detect sigsetjmp() availability in CMake script +* Disable Clang/GCC aliasing optimization in CMake script by default +* Do not build tests by default (Makefile.direct and other Makefiles) +* Do not build the tests by default (CMake) +* Do not call GC_push_conditional unless PROC_VDB +* Do not call add_to_our_memory with null pointer (refactoring) +* Do not compile pthread_*.c files in Cygwin or MSYS (CMake) +* Do not define GC_write_cs for Xbox One target +* Do not define HAVE_NO_FORK for all Unix-like systems +* Do not hard-code CMAKE_DL_LIBS value and install paths (CMake) +* Do not hard-code finalizable objects limit which triggers GC
View file
_service:tar_scm:gc-8.2.2.tar.gz/Config.cmake.in
Added
@@ -0,0 +1,5 @@ +# The BDWgc CMake configuration file. + +@PACKAGE_INIT@ +include("${CMAKE_CURRENT_LIST_DIR}/BDWgcTargets.cmake") +check_required_components(gc)
View file
_service:tar_scm:gc-8.0.6.tar.gz/Makefile.am -> _service:tar_scm:gc-8.2.2.tar.gz/Makefile.am
Changed
@@ -14,8 +14,8 @@ # 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 = 5:4:4 -LIBGCCPP_VER_INFO = 5:1:4 +LIBGC_VER_INFO = 6:1:5 +LIBGCCPP_VER_INFO = 6:0:5 ## FIXME: `make distcheck' in this directory will not currently work. ## This is most likely to the explicit flags passed to submakes. @@ -70,7 +70,7 @@ EXTRA_DIST += extra/gc.c libgc_la_SOURCES = \ allchblk.c alloc.c blacklst.c dbg_mlc.c \ - dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \ + dyn_load.c finalize.c gc_dlopen.c headers.c \ mach_dep.c malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \ obj_map.c os_dep.c ptr_chck.c reclaim.c specific.c typd_mlc.c @@ -103,31 +103,45 @@ libgc_la_SOURCES += checksums.c endif +if ENABLE_GCJ_SUPPORT +libgc_la_SOURCES += gcj_mlc.c +endif + if ENABLE_DISCLAIM libgc_la_SOURCES += fnlz_mlc.c -pkginclude_HEADERS += include/gc_disclaim.h endif ## End of !SINGLE_GC_OBJ endif -if USE_INTERNAL_LIBATOMIC_OPS -nodist_libgc_la_SOURCES = libatomic_ops/src/atomic_ops.c +if PTHREADS +pkginclude_HEADERS += include/gc_pthread_redirects.h +endif + +if ENABLE_GCJ_SUPPORT +pkginclude_HEADERS += include/gc_gcj.h endif +if ENABLE_DISCLAIM +pkginclude_HEADERS += include/gc_disclaim.h +endif + +if USE_INTERNAL_LIBATOMIC_OPS +nodist_libgc_la_SOURCES = libatomic_ops/src/atomic_ops.c if NEED_ATOMIC_OPS_ASM -nodist_libgc_la_SOURCES = libatomic_ops/src/atomic_ops_sysdeps.S +nodist_libgc_la_SOURCES += libatomic_ops/src/atomic_ops_sysdeps.S +endif endif # Include THREADDLLIBS here to ensure that the correct versions of -# linuxthread semaphore functions get linked: +# linuxthread semaphore (and clock_gettime) functions get linked: libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS) $(ATOMIC_OPS_LIBS) libgc_la_DEPENDENCIES = @addobjs@ libgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info $(LIBGC_VER_INFO) \ -no-undefined EXTRA_libgc_la_SOURCES = ia64_save_regs_in_stack.s sparc_mach_dep.S \ - sparc_netbsd_mach_dep.s sparc_sunos4_mach_dep.s + sparc_netbsd_mach_dep.s if CPLUSPLUS # C++ Interface @@ -135,15 +149,23 @@ lib_LTLIBRARIES += libgccpp.la pkginclude_HEADERS += include/gc_allocator.h include/gc_cpp.h include_HEADERS += include/extra/gc_cpp.h -libgccpp_la_SOURCES = gc_cpp.cc -libgccpp_la_LIBADD = ./libgc.la +libgccpp_la_SOURCES = gc_badalc.cc gc_cpp.cc +libgccpp_la_LIBADD = libgc.la libgccpp_la_LDFLAGS = -version-info $(LIBGCCPP_VER_INFO) -no-undefined +if GC_TBA_LIBRARY +# The same as libgccpp but contains only gc_badalc.o. +lib_LTLIBRARIES += libgctba.la +libgctba_la_SOURCES = gc_badalc.cc +libgctba_la_LIBADD = libgc.la +# Set the same version as for libgccpp. +libgctba_la_LDFLAGS = -version-info $(LIBGCCPP_VER_INFO) -no-undefined +endif endif ## FIXME: If Visual C++ users use Makefile.am, this should go into ## pkginclude_HEADERS with proper AM_CONDITIONALization. Otherwise ## delete this comment. -EXTRA_DIST += gc_cpp.cpp +EXTRA_DIST += gc_badalc.cpp gc_cpp.cpp # Misc @@ -195,20 +217,17 @@ EXTRA_DIST += README.QUICK # other makefiles -# :GOTCHA: deliberately we do not include 'Makefile' -EXTRA_DIST += BCC_MAKEFILE NT_MAKEFILE \ - OS2_MAKEFILE PCR-Makefile digimars.mak \ - Makefile.direct SMakefile.amiga WCC_MAKEFILE autogen.sh \ - CMakeLists.txt tests/CMakeLists.txt +EXTRA_DIST += NT_MAKEFILE OS2_MAKEFILE PCR-Makefile digimars.mak \ + Makefile.direct SMakefile.amiga WCC_MAKEFILE autogen.sh CMakeLists.txt \ + Config.cmake.in build/s60v3/bld.inf build/s60v3/libgc.mmp # files used by makefiles other than Makefile.am # EXTRA_DIST += tools/if_mach.c tools/if_not_there.c tools/setjmp_t.c \ - tools/threadlibs.c gc.mak extra/MacOS.c extra/AmigaOS.c \ + tools/threadlibs.c extra/MacOS.c extra/AmigaOS.c \ extra/symbian/global_end.cpp extra/symbian/global_start.cpp \ extra/symbian/init_global_static_roots.cpp extra/symbian.cpp \ extra/pcr_interface.c extra/real_malloc.c \ - build/s60v3/bld.inf build/s60v3/libgc.mmp \ extra/Mac_files/datastart.c extra/Mac_files/dataend.c \ extra/Mac_files/MacOS_config.h \ include/private/msvc_dbg.h extra/msvc_dbg.c tools/callprocs.sh @@ -225,3 +244,6 @@ include doc/doc.am ## Putting these at the top causes cord to be built first, and not find ## libgc.a on HP/UX. There may be a better fix. + +# A dummy target for mono build. +test-bundle:
View file
_service:tar_scm:gc-8.0.6.tar.gz/Makefile.direct -> _service:tar_scm:gc-8.2.2.tar.gz/Makefile.direct
Changed
@@ -2,13 +2,13 @@ # to build the collector. # # Primary targets: -# gc.a - builds basic library -# c++ - adds C++ interface to library -# cords - adds cords (heavyweight strings) to library -# check - prints porting information, then builds basic version of gc.a, -# and runs some tests of collector and cords. Does not add cords or -# c++ interface to gc.a -# check-cpp - runs C++ test without adding C++ (and cords) interface to gc.a +# all - builds gc.a, gccpp.a, gctba.a and cord.a +# base_lib - builds gc.a only (basic library) +# c++ - builds gccpp.a and gctba.a only (C++ interface to library) +# cords - builds cord.a only (heavyweight strings library) +# check - same as "all" but also prints porting information, and runs some +# tests of collector and cords +# check-cpp - builds gc.a, gccpp.a and gctba.a, runs C++ only test # cord/de - builds dumb editor based on cords. ABI_FLAG= @@ -25,7 +25,7 @@ # Compiler executable name. For EMX, replace to "gcc". CXX=g++ $(ABI_FLAG) -# Needed only for "make c++", which adds the c++ interface. +# Needed only for "make c++", which builds the C++ interface. AS=as $(AS_ABI_FLAG) # The above doesn't work with gas, which doesn't run cpp. @@ -108,17 +108,17 @@ include/gc_version.h include/private/gc_hdrs.h include/private/gc_priv.h \ include/private/gcconfig.h include/private/gc_pmark.h \ include/gc_inline.h include/gc_mark.h include/gc_disclaim.h \ - tools/threadlibs.c tools/if_mach.c tools/if_not_there.c gc_cpp.cc \ - include/gc_cpp.h include/private/gc_locks.h include/new_gc_alloc.h \ - include/gc_alloc_ptrs.h include/gc_allocator.h include/javaxfc.h \ - include/gc_backptr.h include/gc_gcj.h include/private/dbg_mlc.h \ + tools/threadlibs.c tools/if_mach.c tools/if_not_there.c gc_badalc.cc \ + gc_cpp.cc include/gc_cpp.h include/private/gc_alloc_ptrs.h \ + include/gc_allocator.h include/javaxfc.h include/gc_backptr.h \ + include/gc_gcj.h include/private/gc_locks.h include/private/dbg_mlc.h \ include/private/specific.h include/leak_detector.h \ include/gc_pthread_redirects.h include/private/gc_atomic_ops.h \ include/gc_config_macros.h include/private/pthread_support.h \ include/private/pthread_stop_world.h include/private/darwin_semaphore.h \ include/private/darwin_stop_world.h include/private/thread_local_alloc.h \ ia64_save_regs_in_stack.s sparc_mach_dep.S \ - sparc_netbsd_mach_dep.s sparc_sunos4_mach_dep.s $(CORD_SRCS) + sparc_netbsd_mach_dep.s $(CORD_SRCS) CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \ $(srcdir)/include/ec.h $(srcdir)/include/cord_pos.h @@ -143,7 +143,7 @@ # not time-critical anyway. # Set SPECIALCFLAGS to -q nodirect_code on Encore. -all: base_lib gctest$(EXEEXT) +all: base_lib cords c++ atomic_ops.o: $(AO_SRC_DIR)/src/atomic_ops.c $(CC) $(CFLAGS) -c -o $@ $(AO_SRC_DIR)/src/atomic_ops.c @@ -156,9 +156,11 @@ BSD-pkg-all: bsd-libgc.a bsd-libleak.a -bsd-libgc.a: +bsd-libgc.a bsd-libgccpp.a bsd-libgctba.a: $(MAKE) -f Makefile.direct CFLAGS="$(CFLAGS)" clean c++-t mv gc.a bsd-libgc.a + mv gccpp.a bsd-libgccpp.a + mv gctba.a bsd-libgctba.a bsd-libleak.a: $(MAKE) -f Makefile.direct CFLAGS="$(LEAKFLAGS)" clean c++-nt @@ -167,12 +169,16 @@ BSD-pkg-install: BSD-pkg-all ${CP} bsd-libgc.a libgc.a ${INSTALL_DATA} libgc.a ${PREFIX}/lib + ${CP} bsd-libgccpp.a libgccpp.a + ${INSTALL_DATA} libgccpp.a ${PREFIX}/lib + ${CP} bsd-libgctba.a libgctba.a + ${INSTALL_DATA} libgctba.a ${PREFIX}/lib ${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include ${INSTALL_MAN} doc/gc.man ${PREFIX}/man/man3/gc.3 pcr: PCR-Makefile include/private/gc_private.h include/private/gc_hdrs.h \ -include/private/gc_locks.h include/gc.h include/private/gcconfig.h \ -mach_dep.o $(SRCS) + include/private/gc_locks.h include/gc.h include/private/gcconfig.h \ + mach_dep.o $(SRCS) $(MAKE) -f PCR-Makefile depend $(MAKE) -f PCR-Makefile @@ -209,24 +215,28 @@ # Ignore ranlib failure; that usually means it doesn't exist, and # isn't needed. -cords: $(CORD_OBJS) $(UTILS) base_lib +cords cord.a: $(CORD_OBJS) $(UTILS) rm -f dont_ar_3 ./if_mach SPARC SOLARIS touch dont_ar_3 - ./if_mach SPARC SOLARIS $(AR) rus gc.a $(CORD_OBJS) + ./if_mach SPARC SOLARIS $(AR) rus cord.a $(CORD_OBJS) ./if_mach M68K AMIGA touch dont_ar_3 - ./if_mach M68K AMIGA $(AR) -vrus gc.a $(CORD_OBJS) - ./if_not_there dont_ar_3 || $(AR) ru gc.a $(CORD_OBJS) - ./if_not_there dont_ar_3 || $(RANLIB) gc.a || cat /dev/null + ./if_mach M68K AMIGA $(AR) -vrus cord.a $(CORD_OBJS) + ./if_not_there dont_ar_3 || $(AR) ru cord.a $(CORD_OBJS) + ./if_not_there dont_ar_3 || $(RANLIB) cord.a || cat /dev/null echo > cords +gc_badalc.o: $(srcdir)/gc_badalc.cc $(srcdir)/include/gc_cpp.h \ + $(srcdir)/include/gc.h + $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_badalc.cc + gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h $(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc test_cpp$(EXEEXT): $(srcdir)/tests/test_cpp.cc $(srcdir)/include/gc_cpp.h \ - $(srcdir)/include/gc.h gc_cpp.o base_lib $(UTILS) + $(srcdir)/include/gc.h c++ base_lib $(UTILS) rm -f test_cpp$(EXEEXT) - ./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a -ldld `./threadlibs` - ./if_not_there test_cpp$(EXEEXT) || $(CXX) $(CXXFLAGS) -DGC_NOT_DLL -o test_cpp$(EXEEXT) $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a `./threadlibs` + ./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc.a gccpp.a -ldld `./threadlibs` + ./if_not_there test_cpp$(EXEEXT) || $(CXX) $(CXXFLAGS) -DGC_NOT_DLL -o test_cpp$(EXEEXT) $(srcdir)/tests/test_cpp.cc gc.a gccpp.a `./threadlibs` check-cpp: test_cpp$(EXEEXT) ./test_cpp @@ -237,14 +247,18 @@ c++-nt: c++ @echo "Use ./test_cpp 1 to test the leak library" -c++: gc_cpp.o $(srcdir)/include/gc_cpp.h base_lib $(UTILS) +c++ gccpp.a gctba.a: gc_badalc.o gc_cpp.o $(UTILS) rm -f dont_ar_4 ./if_mach SPARC SOLARIS touch dont_ar_4 - ./if_mach SPARC SOLARIS $(AR) rus gc.a gc_cpp.o + ./if_mach SPARC SOLARIS $(AR) rus gccpp.a gc_badalc.o gc_cpp.o + ./if_mach SPARC SOLARIS $(AR) rus gctba.a gc_badalc.o ./if_mach M68K AMIGA touch dont_ar_4 - ./if_mach M68K AMIGA $(AR) -vrus gc.a gc_cpp.o - ./if_not_there dont_ar_4 || $(AR) ru gc.a gc_cpp.o - ./if_not_there dont_ar_4 || $(RANLIB) gc.a || cat /dev/null + ./if_mach M68K AMIGA $(AR) -vrus gccpp.a gc_badalc.o gc_cpp.o + ./if_mach M68K AMIGA $(AR) -vrus gctba.a gc_badalc.o + ./if_not_there dont_ar_4 || $(AR) ru gccpp.a gc_badalc.o gc_cpp.o + ./if_not_there dont_ar_4 || $(RANLIB) gccpp.a || cat /dev/null + ./if_not_there dont_ar_4 || $(AR) ru gctba.a gc_badalc.o + ./if_not_there dont_ar_4 || $(RANLIB) gctba.a || cat /dev/null echo > c++ dyn_load_sunos53.o: dyn_load.c @@ -292,6 +306,7 @@ $(srcdir)/ia64_save_regs_in_stack.s \ $(srcdir)/sparc_netbsd_mach_dep.s $(UTILS) rm -f mach_dep.o + ./if_mach SPARC LINUX $(CC) -c -o mach_dep2.o $(srcdir)/sparc_mach_dep.S ./if_mach SPARC SOLARIS $(CC) -c -o mach_dep2.o $(srcdir)/sparc_mach_dep.S ./if_mach SPARC OPENBSD $(CC) -c -o mach_dep2.o $(srcdir)/sparc_mach_dep.S ./if_mach SPARC NETBSD $(AS) -o mach_dep2.o $(srcdir)/sparc_netbsd_mach_dep.s @@ -331,27 +346,24 @@ mkdir cord || cat /dev/null mv cordprnt.o cord/cordprnt.o -cord/cordtest$(EXEEXT): $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) \ - base_lib $(UTILS) - rm -f cord/cordtest$(EXEEXT) - ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a -lucb - ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a -ldld `./threadlibs` - ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/cordtest $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a `./threadlibs` - ./if_not_there cord/cordtest$(EXEEXT) || $(CC) $(CFLAGS) -o cord/cordtest$(EXEEXT) $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a `./threadlibs` - -cord/de: $(srcdir)/cord/tests/de.c $(srcdir)/cord/tests/de_win.c \ - $(srcdir)/cord/tests/de_win.h cord/cordbscs.o cord/cordxtra.o base_lib \ - $(UTILS) - rm -f cord/de - ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses -ltermlib -lucb `./threadlibs` - ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses -ltermlib -ldld `./threadlibs` - ./if_mach POWERPC AIX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses - ./if_mach POWERPC DARWIN $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a - ./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs` - ./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs` - ./if_mach IA64 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs` - ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/de $(srcdir)/cord/tests/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses - ./if_not_there cord/de$(EXEEXT) || $(CC) $(CFLAGS) -o cord/de$(EXEEXT) $(srcdir)/cord/tests/de.c $(srcdir)/cord/tests/de_win.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) `./threadlibs` +cordtest$(EXEEXT): $(srcdir)/cord/tests/cordtest.c cords base_lib $(UTILS) + rm -f cordtest$(EXEEXT) + ./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cordtest $(srcdir)/cord/tests/cordtest.c gc.a cord.a -lucb + ./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cordtest $(srcdir)/cord/tests/cordtest.c gc.a cord.a -ldld `./threadlibs` + ./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cordtest $(srcdir)/cord/tests/cordtest.c gc.a cord.a `./threadlibs` + ./if_not_there cordtest$(EXEEXT) || $(CC) $(CFLAGS) -o cordtest$(EXEEXT) $(srcdir)/cord/tests/cordtest.c gc.a cord.a `./threadlibs` + +cord/de: de$(EXEEXT) + +de$(EXEEXT): $(srcdir)/cord/tests/de.c $(srcdir)/cord/tests/de_win.c \ + $(srcdir)/cord/tests/de_win.h cords base_lib $(UTILS) + rm -f de$(EXEEXT)
View file
_service:tar_scm:gc-8.0.6.tar.gz/Makefile.in -> _service:tar_scm:gc-8.2.2.tar.gz/Makefile.in
Changed
@@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -132,10 +132,11 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -check_PROGRAMS = cordtest$(EXEEXT) gctest$(EXEEXT) leaktest$(EXEEXT) \ - middletest$(EXEEXT) smashtest$(EXEEXT) hugetest$(EXEEXT) \ - realloc_test$(EXEEXT) staticrootstest$(EXEEXT) $(am__EXEEXT_1) \ - $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) +check_PROGRAMS = cordtest$(EXEEXT) gctest$(EXEEXT) $(am__EXEEXT_1) \ + leaktest$(EXEEXT) middletest$(EXEEXT) smashtest$(EXEEXT) \ + hugetest$(EXEEXT) realloc_test$(EXEEXT) \ + staticrootstest$(EXEEXT) $(am__EXEEXT_2) $(am__EXEEXT_3) \ + $(am__EXEEXT_4) $(am__EXEEXT_5) @PTHREAD_START_STANDALONE_TRUE@@SINGLE_GC_OBJ_TRUE@am__append_1 = -DGC_PTHREAD_START_STANDALONE @PTHREAD_START_STANDALONE_TRUE@@SINGLE_GC_OBJ_TRUE@am__append_2 = pthread_start.c @SINGLE_GC_OBJ_FALSE@am__append_3 = extra/gc.c @@ -150,36 +151,46 @@ @SINGLE_GC_OBJ_FALSE@@THREAD_LOCAL_ALLOC_TRUE@am__append_8 = thread_local_alloc.c @MAKE_BACK_GRAPH_TRUE@@SINGLE_GC_OBJ_FALSE@am__append_9 = backgraph.c @CHECKSUMS_TRUE@@SINGLE_GC_OBJ_FALSE@am__append_10 = checksums.c -@ENABLE_DISCLAIM_TRUE@@SINGLE_GC_OBJ_FALSE@am__append_11 = fnlz_mlc.c -@ENABLE_DISCLAIM_TRUE@@SINGLE_GC_OBJ_FALSE@am__append_12 = include/gc_disclaim.h +@ENABLE_GCJ_SUPPORT_TRUE@@SINGLE_GC_OBJ_FALSE@am__append_11 = gcj_mlc.c +@ENABLE_DISCLAIM_TRUE@@SINGLE_GC_OBJ_FALSE@am__append_12 = fnlz_mlc.c +@PTHREADS_TRUE@am__append_13 = include/gc_pthread_redirects.h +@ENABLE_GCJ_SUPPORT_TRUE@am__append_14 = include/gc_gcj.h +@ENABLE_DISCLAIM_TRUE@am__append_15 = include/gc_disclaim.h +@NEED_ATOMIC_OPS_ASM_TRUE@@USE_INTERNAL_LIBATOMIC_OPS_TRUE@am__append_16 = libatomic_ops/src/atomic_ops_sysdeps.S # C++ Interface # ------------- -@CPLUSPLUS_TRUE@am__append_13 = libgccpp.la -@CPLUSPLUS_TRUE@am__append_14 = include/gc_allocator.h include/gc_cpp.h -@CPLUSPLUS_TRUE@am__append_15 = include/extra/gc_cpp.h -@ENABLE_SHARED_TRUE@am__append_16 = $(top_builddir)/libgc.la -@THREADS_TRUE@am__append_17 = $(THREADDLLIBS) -@ENABLE_SHARED_TRUE@am__append_18 = $(top_builddir)/libgc.la -@KEEP_BACK_PTRS_TRUE@am__append_19 = tracetest$(EXEEXT) -@KEEP_BACK_PTRS_TRUE@am__append_20 = tracetest -@THREADS_TRUE@am__append_21 = test_atomic_ops$(EXEEXT) \ +@CPLUSPLUS_TRUE@am__append_17 = libgccpp.la +@CPLUSPLUS_TRUE@am__append_18 = include/gc_allocator.h include/gc_cpp.h +@CPLUSPLUS_TRUE@am__append_19 = include/extra/gc_cpp.h +# The same as libgccpp but contains only gc_badalc.o. +@CPLUSPLUS_TRUE@@GC_TBA_LIBRARY_TRUE@am__append_20 = libgctba.la +@ENABLE_SHARED_TRUE@am__append_21 = $(top_builddir)/libgc.la +@THREADS_TRUE@am__append_22 = $(THREADDLLIBS) + +# Note: because of libtool, you'll need to point your browser to +# .libs/gctest.html, not gctest.html at topdir. +@EMSCRIPTEN_TRUE@am__append_23 = gctest.html +@ENABLE_SHARED_TRUE@am__append_24 = $(top_builddir)/libgc.la +@KEEP_BACK_PTRS_TRUE@am__append_25 = tracetest$(EXEEXT) +@KEEP_BACK_PTRS_TRUE@am__append_26 = tracetest +@THREADS_TRUE@am__append_27 = test_atomic_ops$(EXEEXT) \ @THREADS_TRUE@ threadleaktest$(EXEEXT) threadkey_test$(EXEEXT) \ @THREADS_TRUE@ subthreadcreate_test$(EXEEXT) \ @THREADS_TRUE@ initsecondarythread_test$(EXEEXT) -@THREADS_TRUE@am__append_22 = test_atomic_ops threadleaktest \ +@THREADS_TRUE@am__append_28 = test_atomic_ops threadleaktest \ @THREADS_TRUE@ threadkey_test subthreadcreate_test \ @THREADS_TRUE@ initsecondarythread_test -@CPLUSPLUS_TRUE@am__append_23 = test_cpp$(EXEEXT) -@CPLUSPLUS_TRUE@am__append_24 = test_cpp -@AVOID_CPP_LIB_FALSE@@CPLUSPLUS_TRUE@@ENABLE_SHARED_TRUE@am__append_25 = $(top_builddir)/libgc.la -@ENABLE_DISCLAIM_TRUE@am__append_26 = disclaim_test$(EXEEXT) \ +@CPLUSPLUS_TRUE@am__append_29 = test_cpp$(EXEEXT) +@CPLUSPLUS_TRUE@am__append_30 = test_cpp +@AVOID_CPP_LIB_FALSE@@CPLUSPLUS_TRUE@@ENABLE_SHARED_TRUE@am__append_31 = $(top_builddir)/libgc.la +@ENABLE_DISCLAIM_TRUE@am__append_32 = disclaim_test$(EXEEXT) \ @ENABLE_DISCLAIM_TRUE@ disclaim_bench$(EXEEXT) \ @ENABLE_DISCLAIM_TRUE@ disclaim_weakmap_test$(EXEEXT) -@ENABLE_DISCLAIM_TRUE@am__append_27 = disclaim_test disclaim_bench \ +@ENABLE_DISCLAIM_TRUE@am__append_33 = disclaim_test disclaim_bench \ @ENABLE_DISCLAIM_TRUE@ disclaim_weakmap_test -@ENABLE_DISCLAIM_TRUE@@THREADS_TRUE@am__append_28 = $(THREADDLLIBS) -@ENABLE_DISCLAIM_TRUE@@THREADS_TRUE@am__append_29 = $(THREADDLLIBS) +@ENABLE_DISCLAIM_TRUE@@THREADS_TRUE@am__append_34 = $(THREADDLLIBS) +@ENABLE_DISCLAIM_TRUE@@THREADS_TRUE@am__append_35 = $(THREADDLLIBS) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gc_set_version.m4 \ @@ -198,6 +209,16 @@ CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = bdw-gc.pc CONFIG_CLEAN_VPATH_FILES = +@EMSCRIPTEN_TRUE@am__EXEEXT_1 = gctest.html$(EXEEXT) +@KEEP_BACK_PTRS_TRUE@am__EXEEXT_2 = tracetest$(EXEEXT) +@THREADS_TRUE@am__EXEEXT_3 = test_atomic_ops$(EXEEXT) \ +@THREADS_TRUE@ threadleaktest$(EXEEXT) threadkey_test$(EXEEXT) \ +@THREADS_TRUE@ subthreadcreate_test$(EXEEXT) \ +@THREADS_TRUE@ initsecondarythread_test$(EXEEXT) +@CPLUSPLUS_TRUE@am__EXEEXT_4 = test_cpp$(EXEEXT) +@ENABLE_DISCLAIM_TRUE@am__EXEEXT_5 = disclaim_test$(EXEEXT) \ +@ENABLE_DISCLAIM_TRUE@ disclaim_bench$(EXEEXT) \ +@ENABLE_DISCLAIM_TRUE@ disclaim_weakmap_test$(EXEEXT) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -229,7 +250,7 @@ "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)" \ "$(DESTDIR)$(includedir)" "$(DESTDIR)$(pkgincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) -libcord_la_DEPENDENCIES = $(top_builddir)/libgc.la +libcord_la_DEPENDENCIES = libgc.la am__dirstamp = $(am__leading_dot)dirstamp am_libcord_la_OBJECTS = cord/libcord_la-cordbscs.lo \ cord/libcord_la-cordprnt.lo cord/libcord_la-cordxtra.lo @@ -243,12 +264,12 @@ $(libcord_la_LDFLAGS) $(LDFLAGS) -o $@ am__DEPENDENCIES_1 = am__libgc_la_SOURCES_DIST = allchblk.c alloc.c blacklst.c dbg_mlc.c \ - dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \ - mach_dep.c malloc.c mallocx.c mark.c mark_rts.c misc.c \ - new_hblk.c obj_map.c os_dep.c ptr_chck.c reclaim.c specific.c \ - typd_mlc.c win32_threads.c pthread_start.c pthread_support.c \ + dyn_load.c finalize.c gc_dlopen.c headers.c mach_dep.c \ + malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \ + obj_map.c os_dep.c ptr_chck.c reclaim.c specific.c typd_mlc.c \ + win32_threads.c pthread_start.c pthread_support.c \ darwin_stop_world.c pthread_stop_world.c thread_local_alloc.c \ - backgraph.c checksums.c fnlz_mlc.c extra/gc.c + backgraph.c checksums.c gcj_mlc.c fnlz_mlc.c extra/gc.c @SINGLE_GC_OBJ_FALSE@@WIN32_THREADS_TRUE@am__objects_1 = \ @SINGLE_GC_OBJ_FALSE@@WIN32_THREADS_TRUE@ win32_threads.lo @PTHREADS_TRUE@@SINGLE_GC_OBJ_FALSE@@WIN32_THREADS_FALSE@am__objects_2 = pthread_start.lo \ @@ -259,40 +280,55 @@ @MAKE_BACK_GRAPH_TRUE@@SINGLE_GC_OBJ_FALSE@am__objects_6 = \ @MAKE_BACK_GRAPH_TRUE@@SINGLE_GC_OBJ_FALSE@ backgraph.lo @CHECKSUMS_TRUE@@SINGLE_GC_OBJ_FALSE@am__objects_7 = checksums.lo -@ENABLE_DISCLAIM_TRUE@@SINGLE_GC_OBJ_FALSE@am__objects_8 = \ +@ENABLE_GCJ_SUPPORT_TRUE@@SINGLE_GC_OBJ_FALSE@am__objects_8 = \ +@ENABLE_GCJ_SUPPORT_TRUE@@SINGLE_GC_OBJ_FALSE@ gcj_mlc.lo +@ENABLE_DISCLAIM_TRUE@@SINGLE_GC_OBJ_FALSE@am__objects_9 = \ @ENABLE_DISCLAIM_TRUE@@SINGLE_GC_OBJ_FALSE@ fnlz_mlc.lo -@PTHREAD_START_STANDALONE_TRUE@@SINGLE_GC_OBJ_TRUE@am__objects_9 = pthread_start.lo +@PTHREAD_START_STANDALONE_TRUE@@SINGLE_GC_OBJ_TRUE@am__objects_10 = pthread_start.lo @SINGLE_GC_OBJ_FALSE@am_libgc_la_OBJECTS = allchblk.lo alloc.lo \ @SINGLE_GC_OBJ_FALSE@ blacklst.lo dbg_mlc.lo dyn_load.lo \ -@SINGLE_GC_OBJ_FALSE@ finalize.lo gc_dlopen.lo gcj_mlc.lo \ -@SINGLE_GC_OBJ_FALSE@ headers.lo mach_dep.lo malloc.lo \ -@SINGLE_GC_OBJ_FALSE@ mallocx.lo mark.lo mark_rts.lo misc.lo \ -@SINGLE_GC_OBJ_FALSE@ new_hblk.lo obj_map.lo os_dep.lo \ -@SINGLE_GC_OBJ_FALSE@ ptr_chck.lo reclaim.lo specific.lo \ -@SINGLE_GC_OBJ_FALSE@ typd_mlc.lo $(am__objects_1) \ -@SINGLE_GC_OBJ_FALSE@ $(am__objects_2) $(am__objects_3) \ -@SINGLE_GC_OBJ_FALSE@ $(am__objects_4) $(am__objects_5) \ -@SINGLE_GC_OBJ_FALSE@ $(am__objects_6) $(am__objects_7) \ -@SINGLE_GC_OBJ_FALSE@ $(am__objects_8) -@SINGLE_GC_OBJ_TRUE@am_libgc_la_OBJECTS = extra/gc.lo $(am__objects_9) \ -@SINGLE_GC_OBJ_TRUE@ $(am__objects_1) $(am__objects_2) \ -@SINGLE_GC_OBJ_TRUE@ $(am__objects_3) $(am__objects_4) \ -@SINGLE_GC_OBJ_TRUE@ $(am__objects_5) $(am__objects_6) \ -@SINGLE_GC_OBJ_TRUE@ $(am__objects_7) $(am__objects_8) -@NEED_ATOMIC_OPS_ASM_FALSE@@USE_INTERNAL_LIBATOMIC_OPS_TRUE@nodist_libgc_la_OBJECTS = libatomic_ops/src/atomic_ops.lo -@NEED_ATOMIC_OPS_ASM_TRUE@nodist_libgc_la_OBJECTS = libatomic_ops/src/atomic_ops_sysdeps.lo +@SINGLE_GC_OBJ_FALSE@ finalize.lo gc_dlopen.lo headers.lo \ +@SINGLE_GC_OBJ_FALSE@ mach_dep.lo malloc.lo mallocx.lo mark.lo \ +@SINGLE_GC_OBJ_FALSE@ mark_rts.lo misc.lo new_hblk.lo \ +@SINGLE_GC_OBJ_FALSE@ obj_map.lo os_dep.lo ptr_chck.lo \ +@SINGLE_GC_OBJ_FALSE@ reclaim.lo specific.lo typd_mlc.lo \ +@SINGLE_GC_OBJ_FALSE@ $(am__objects_1) $(am__objects_2) \ +@SINGLE_GC_OBJ_FALSE@ $(am__objects_3) $(am__objects_4) \ +@SINGLE_GC_OBJ_FALSE@ $(am__objects_5) $(am__objects_6) \ +@SINGLE_GC_OBJ_FALSE@ $(am__objects_7) $(am__objects_8) \ +@SINGLE_GC_OBJ_FALSE@ $(am__objects_9) +@SINGLE_GC_OBJ_TRUE@am_libgc_la_OBJECTS = extra/gc.lo \ +@SINGLE_GC_OBJ_TRUE@ $(am__objects_10) $(am__objects_1) \ +@SINGLE_GC_OBJ_TRUE@ $(am__objects_2) $(am__objects_3) \ +@SINGLE_GC_OBJ_TRUE@ $(am__objects_4) $(am__objects_5) \ +@SINGLE_GC_OBJ_TRUE@ $(am__objects_6) $(am__objects_7) \ +@SINGLE_GC_OBJ_TRUE@ $(am__objects_8) $(am__objects_9) +@NEED_ATOMIC_OPS_ASM_TRUE@@USE_INTERNAL_LIBATOMIC_OPS_TRUE@am__objects_11 = libatomic_ops/src/atomic_ops_sysdeps.lo +@USE_INTERNAL_LIBATOMIC_OPS_TRUE@nodist_libgc_la_OBJECTS = libatomic_ops/src/atomic_ops.lo \ +@USE_INTERNAL_LIBATOMIC_OPS_TRUE@ $(am__objects_11) libgc_la_OBJECTS = $(am_libgc_la_OBJECTS) $(nodist_libgc_la_OBJECTS) libgc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libgc_la_LDFLAGS) $(LDFLAGS) -o $@ -@CPLUSPLUS_TRUE@libgccpp_la_DEPENDENCIES = ./libgc.la -am__libgccpp_la_SOURCES_DIST = gc_cpp.cc -@CPLUSPLUS_TRUE@am_libgccpp_la_OBJECTS = gc_cpp.lo +@CPLUSPLUS_TRUE@libgccpp_la_DEPENDENCIES = libgc.la +am__libgccpp_la_SOURCES_DIST = gc_badalc.cc gc_cpp.cc +@CPLUSPLUS_TRUE@am_libgccpp_la_OBJECTS = gc_badalc.lo gc_cpp.lo libgccpp_la_OBJECTS = $(am_libgccpp_la_OBJECTS) libgccpp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(libgccpp_la_LDFLAGS) $(LDFLAGS) -o $@ @CPLUSPLUS_TRUE@am_libgccpp_la_rpath = -rpath $(libdir)
View file
_service:tar_scm:gc-8.0.6.tar.gz/NT_MAKEFILE -> _service:tar_scm:gc-8.2.2.tar.gz/NT_MAKEFILE
Changed
@@ -1,9 +1,9 @@ # Makefile for Windows NT. Assumes Microsoft compiler. # Should be invoked as "nmake -f NT_MAKEFILE <args>"; the optional arguments # are: "cpu=AMD64" - to target x64, "cpu=i386" - to target x86, -# "make_as_lib=1" - to build it as a static library, "nodebug=1" - to produce -# the release variant of the library, "nothreads=1" - to build the library and -# the tests without threads support. +# "enable_static=1" - to build it as a static library, "nodebug=1" - to produce +# the release variant of the library, "disable_threads=1" - to build the +# library and the tests without threads support. cc = cl link = link @@ -52,26 +52,25 @@ CFLAGS_DEBUG=-DGC_ASSERTIONS !ENDIF -!IFNDEF NOTHREADS -CFLAGS_MT=$(cvarsmt) -DGC_THREADS -DTHREAD_LOCAL_ALLOC -DPARALLEL_MARK -!ENDIF - -!IFDEF MAKE_AS_LIB +!IFDEF ENABLE_STATIC CFLAGS_GCDLL=-DGC_NOT_DLL -GC_LIB=gc.lib -LINK_GC=lib /out:$(GC_LIB) +CORDFLAG= !ELSE CFLAGS_GCDLL=-DGC_DLL -!IF "$(CPU)" == "AMD64" -GC_DLL=gc64.dll -GC_LIB=gc64_dll.lib +# cord.dll and its clients should not link C library statically otherwise +# FILE-related functions might not work (because own set of opened FILEs +# is maintained by each copy of the C library thus making impossible to pass +# FILE pointer from .exe code to .dll code). +cvarsmt= +!IFDEF NODEBUG +CORDFLAG=-MD !ELSE -GC_DLL=gc.dll -GC_LIB=gc_dll.lib +CORDFLAG=-MDd !ENDIF -LINK_DLL_FLAGS=kernel32.lib user32.lib /subsystem:windows /dll \ - /INCREMENTAL:NO /pdb:"gc.pdb" /out:$(GC_DLL) /implib:$(GC_LIB) -LINK_GC=$(link) $(ldebug) $(LINK_DLL_FLAGS) +!ENDIF + +!IFNDEF DISABLE_THREADS +CFLAGS_MT=$(cvarsmt) -DGC_THREADS -DTHREAD_LOCAL_ALLOC -DPARALLEL_MARK !ENDIF CFLAGS_SPECIFIC=$(CFLAGS_DEBUG) $(CFLAGS_GCDLL) $(CFLAGS_MT) @@ -91,12 +90,23 @@ AO_SRC_DIR=libatomic_ops/src AO_INCLUDE_DIR=$(AO_SRC_DIR) -OBJS= misc.obj win32_threads.obj alloc.obj reclaim.obj allchblk.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 fnlz_mlc.obj malloc.obj dyn_load.obj typd_mlc.obj ptr_chck.obj gc_cpp.obj gcj_mlc.obj mallocx.obj extra\msvc_dbg.obj thread_local_alloc.obj +!IFDEF ENABLE_STATIC +OBJS= misc.obj win32_threads.obj alloc.obj reclaim.obj allchblk.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 fnlz_mlc.obj malloc.obj dyn_load.obj typd_mlc.obj ptr_chck.obj gcj_mlc.obj mallocx.obj extra\msvc_dbg.obj thread_local_alloc.obj +!ELSE +OBJS= extra\gc.obj extra\msvc_dbg.obj +!ENDIF + +COBJS= cord\cordbscs.obj cord\cordxtra.obj cord\cordprnt.obj -all: gctest.exe cord\de.exe test_cpp.exe +all: gc.lib cord.lib gccpp.lib gctba.lib + +check: gctest.exe test_cpp.exe cordtest.exe de.exe + gctest.exe + cordtest.exe + test_cpp.exe .c.obj: - $(cc) $(cdebug) $(cflags) $(CFLAGS_SPECIFIC) -Iinclude -I$(AO_INCLUDE_DIR) $(CFLAGS_DEFAULT) -DCORD_NOT_DLL -D_CRT_SECURE_NO_DEPRECATE $*.c /Fo$*.obj /wd4100 /wd4127 /wd4701 + $(cc) $(cdebug) $(cflags) $(CFLAGS_SPECIFIC) $(CORDFLAG) -Iinclude -I$(AO_INCLUDE_DIR) $(CFLAGS_DEFAULT) -D_CRT_SECURE_NO_DEPRECATE $*.c /Fo$*.obj /wd4100 /wd4127 /wd4701 # Disable crt security warnings, since unfortunately they warn about all sorts # of safe uses of strncpy. It would be nice to leave the rest enabled. @@ -105,11 +115,39 @@ $(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h include\gc_disclaim.h include\private\msvc_dbg.h -$(GC_LIB): $(OBJS) - $(LINK_GC) /MACHINE:$(CPU) $(OBJS) +!IFDEF ENABLE_STATIC + +gc.lib: $(OBJS) + lib /out:gc.lib /MACHINE:$(CPU) $(OBJS) + +cord.lib: $(COBJS) + lib /out:cord.lib /MACHINE:$(CPU) $(COBJS) -gctest.exe: $(GC_LIB) tests\test.obj - $(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:$*.exe tests\test.obj $(GC_LIB) +gccpp.lib: gc_badalc.obj gc_cpp.obj + lib /out:gccpp.lib /MACHINE:$(CPU) gc_badalc.obj gc_cpp.obj + +# The same as gccpp.lib but contains only gc_badalc.obj. +gctba.lib: gc_badalc.obj + lib /out:gctba.lib /MACHINE:$(CPU) gc_badalc.obj + +!ELSE + +gc.lib: $(OBJS) + $(link) $(ldebug) kernel32.lib user32.lib /subsystem:windows /dll /INCREMENTAL:NO /pdb:"gc.pdb" /out:gc.dll /implib:gc.lib /MACHINE:$(CPU) $(OBJS) + +cord.lib: $(COBJS) gc.lib + $(link) $(ldebug) gc.lib /subsystem:windows /dll /INCREMENTAL:NO /pdb:"cord.pdb" /out:cord.dll /implib:cord.lib /MACHINE:$(CPU) $(COBJS) + +gccpp.lib: gc_badalc.obj gc_cpp.obj gc.lib + $(link) $(ldebug) gc.lib /subsystem:windows /dll /INCREMENTAL:NO /pdb:"gccpp.pdb" /out:gccpp.dll /implib:gccpp.lib /MACHINE:$(CPU) gc_badalc.obj gc_cpp.obj + +gctba.lib: gc_badalc.obj gc.lib + $(link) $(ldebug) gc.lib /subsystem:windows /dll /INCREMENTAL:NO /pdb:"gctba.pdb" /out:gctba.dll /implib:gctba.lib /MACHINE:$(CPU) gc_badalc.obj + +!ENDIF + +gctest.exe: gc.lib tests\test.obj + $(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:$*.exe tests\test.obj gc.lib # mapsympe -n -o gctest.sym gctest.exe # This produces a GUI app that opens no window and writes to gctest.gc.log. @@ -122,8 +160,13 @@ $(rc) $(rcvars) -r -fo cord\tests\de_win.res cord\tests\de_win.rc # Cord/de is a real win32 GUI app. -cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\tests\de.obj cord\tests\de_win.obj cord\tests\de_win.rbj $(GC_LIB) - $(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) -out:cord\de.exe cord\cordbscs.obj cord\cordxtra.obj cord\tests\de.obj cord\tests\de_win.obj cord\tests\de_win.rbj $(GC_LIB) gdi32.lib user32.lib +de.exe: cord\tests\de.obj cord\tests\de_win.obj cord\tests\de_win.rbj gc.lib cord.lib + $(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) -out:de.exe cord\tests\de.obj cord\tests\de_win.obj cord\tests\de_win.rbj gc.lib cord.lib gdi32.lib user32.lib + +cordtest.exe: cord\tests\cordtest.obj gc.lib cord.lib + $(link) /subsystem:console /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) -out:cordtest.exe cord\tests\cordtest.obj gc.lib cord.lib user32.lib + +gc_badalc.obj: gc_badalc.cc include\gc_cpp.h include\gc.h gc_cpp.obj: gc_cpp.cc include\gc_cpp.h include\gc.h @@ -133,11 +176,11 @@ # This generates the C++ test executable. The executable expects # a single numeric argument, which is the number of iterations. # The output appears in test_cpp.gc.log file. -test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h $(GC_LIB) - $(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:test_cpp.exe test_cpp.obj $(GC_LIB) +test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib gccpp.lib + $(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:test_cpp.exe test_cpp.obj gc.lib gccpp.lib $(AO_SRC_DIR): tar xvfz $(AO_SRC_DIR).tar.gz clean: - del *.exe *.log *.obj *.pdb cord\*.exe cord\*.exp cord\*.lib cord\*.obj cord\*.pdb cord\tests\*.rbj cord\tests\*.res cord\tests\*.obj extra\*.obj gc*.lib gc*.dll gc*.exp test_cpp.cpp tests\*.obj 2> nul + del *.dll *.exe *.exp *.lib *.log *.obj *.pdb cordtst*.tmp cord\*.obj cord\tests\*.rbj cord\tests\*.res cord\tests\*.obj extra\*.obj test_cpp.cpp tests\*.obj 2> nul
View file
_service:tar_scm:gc-8.0.6.tar.gz/OS2_MAKEFILE -> _service:tar_scm:gc-8.2.2.tar.gz/OS2_MAKEFILE
Changed
@@ -3,7 +3,7 @@ # Adding thread support may be nontrivial, since we haven't yet figured out how to # look at another thread's registers. -# Significantly revised for GC version 4.4 by Mark Boulter (Jan 1994). +# Significantly revised by Mark Boulter (Jan 1994). OBJS= alloc.obj reclaim.obj allchblk.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 fnlz_mlc.obj malloc.obj typd_mlc.obj ptr_chck.obj mallocx.obj gcj_mlc.obj @@ -15,7 +15,11 @@ # Setjmp_test may yield overly optimistic results when compiled # without optimization. -all: $(OBJS) gctest.exe cord\cordtest.exe +all: gc.lib cord.lib + +check: gctest.exe cordtest.exe + gctest.exe + cordtest.exe $(OBJS) test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h @@ -41,5 +45,15 @@ cord\cordprnt.obj: cord\cordprnt.c include\cord.h include\cord_pos.h include\ec.h $(CC) $(CFLAGS) /C /Focord\cordprnt cord\cordprnt.c -cord\cordtest.exe: cord\tests\cordtest.c include\cord.h include\cord_pos.h include\ec.h $(CORDOBJS) gc.lib - $(CC) $(CFLAGS) /B"/STACK:65536" /Fecord\cordtest cord\tests\cordtest.c gc.lib $(CORDOBJS) +cord.lib: $(CORDOBJS) + echo . > cord.lib + erase cord.lib + LIB cord.lib $(CORDOBJS), cord.lst + +cordtest.exe: cord\tests\cordtest.c include\cord.h include\cord_pos.h include\ec.h gc.lib cord.lib + $(CC) $(CFLAGS) /B"/STACK:65536" /Fecordtest cord\tests\cordtest.c gc.lib cord.lib + +clean: + erase gc.lib cord.lib + erase gctest.exe cordtest.exe + erase $(OBJS) $(CORDOBJS)
View file
_service:tar_scm:gc-8.0.6.tar.gz/README.QUICK -> _service:tar_scm:gc-8.2.2.tar.gz/README.QUICK
Changed
@@ -2,7 +2,7 @@ Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. Copyright (c) 1999-2001 by Hewlett-Packard. All rights reserved. -Copyright (c) 2009-2019 Ivan Maidanski +Copyright (c) 2009-2021 Ivan Maidanski THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -36,7 +36,7 @@ See doc/README.autoconf for details Under Windows 95, 98, Me, NT, or 2000: -copy the appropriate makefile to MAKEFILE, read it, and type "nmake test". +copy the appropriate makefile to MAKEFILE, read it, and type "nmake check". (Under Windows, this assumes you have Microsoft command-line tools installed, and suitably configured.) Read the machine specific README.XXX in the doc directory if one exists. @@ -52,10 +52,11 @@ package should still work.) See include/cord.h for the API. If you wish to use the collector from C++, type "make c++", or use ---enable-cplusplus with the configure script. With Makefile.direct, -these ones add further files to gc.a and to the include subdirectory. -With the alternate build process, this generates libgccpp. -See include/gc_cpp.h. +--enable-cplusplus with the configure script. With Makefile.direct, +"make c++" creates gccpp.a and gctba.a files (you should link with either +gccpp.a or gctba.a). With the alternate (preferred) build process, this +generates libgccpp.a and libgctba.a, and/or libgccpp.so and libgctba.so. +See include/gc_cpp.h and doc/gcinterface.md. TYPICAL USE: Include "gc.h" from the include subdirectory. Link against the @@ -75,10 +76,10 @@ with system malloc, since the collector usually does not scan memory allocated in this way. -Use with threads may be supported on your system, but requires the -collector to be built with thread support. See Makefile. The collector -does not guarantee to scan thread-local storage (e.g. of the kind -accessed with pthread_getspecific()). The collector does scan +Use with threads may be supported on your system, but requires the collector +to be built with thread support. See Makefile.am or Makefile.direct. +The collector does not guarantee to scan thread-local storage (e.g. of the +kind accessed with pthread_getspecific()). The collector does scan thread stacks though, so generally the best solution is to ensure that any pointers stored in thread-local storage are also stored on the thread's stack for the duration of their lifetime.
View file
_service:tar_scm:gc-8.0.6.tar.gz/README.md -> _service:tar_scm:gc-8.2.2.tar.gz/README.md
Changed
@@ -1,6 +1,6 @@ # Boehm-Demers-Weiser Garbage Collector -This is version 8.0.6 of a conservative garbage +This is version 8.2.2 of a conservative garbage collector for C and C++. @@ -55,7 +55,7 @@ by others. Notably, some of the run-time systems developed at Xerox PARC in the early 1980s conservatively scanned thread stacks to locate possible pointers (cf. Paul Rovner, "On Adding Garbage Collection and Runtime Types -to a Strongly-Typed Statically Checked, Concurrent Language" Xerox PARC +to a Strongly-Typed Statically Checked, Concurrent Language" Xerox PARC CSL 84-7). Doug McIlroy wrote a simpler fully conservative collector that was part of version 8 UNIX (tm), but appears to not have received widespread use. @@ -134,8 +134,8 @@ visible to the collector. Note that the garbage collector does not need to be informed of shared -read-only data. However if the shared library mechanism can introduce -discontiguous data areas that may contain pointers, then the collector does +read-only data. However, if the shared library mechanism can introduce +discontiguous data areas that may contain pointers then the collector does need to be informed. Signal processing for most signals may be deferred during collection, @@ -158,7 +158,7 @@ ## Installation and Portability -As distributed, the collector operates silently +The collector operates silently in the default configuration. In the event of problems, this can usually be changed by defining the `GC_PRINT_STATS` or `GC_PRINT_VERBOSE_STATS` environment variables. This will result in a few lines of descriptive output for each collection. @@ -176,9 +176,9 @@ and similar auto-generated files, thus the full procedure of autoconf-based build of `master` branch of the collector could look like: - git clone git://github.com/ivmai/bdwgc.git + git clone https://github.com/ivmai/bdwgc cd bdwgc - git clone git://github.com/ivmai/libatomic_ops.git + git clone https://github.com/ivmai/libatomic_ops ./autogen.sh ./configure make -j @@ -195,24 +195,18 @@ a somewhat superficial test of collector functionality. Failure is indicated by a core dump or a message to the effect that the collector is broken. Gctest takes about a second to two to run on reasonable 2007 vintage desktops. It may -use up to about 30MB of memory. (The multi-threaded version will use more. -64-bit versions may use more.) `make test` will also, as its last step, attempt -to build and test the "cord" string library.) +use up to about 30 MB of memory. (The multi-threaded version will use more. +64-bit versions may use more.) `make check` will also, as its last step, +attempt to build and test the "cord" string library.) Makefile.direct will generate a library gc.a which you should link against. -Typing "make cords" will add the cord library to gc.a. +Typing "make cords" will build the cord library (cord.a). The GNU style build process understands the usual targets. `make check` runs a number of tests. `make install` installs at least libgc, and libcord. Try `./configure --help` to see the configuration options. It is currently not possible to exercise all combinations of build options this way. -It is suggested that if you need to replace a piece of the collector -(e.g. GC_mark_rts.c) you simply list your version ahead of gc.a on the -ld command line, rather than replacing the one in gc.a. (This will -generate numerous warnings under some versions of AIX, but it still -works.) - All include files that need to be used by clients will be put in the include subdirectory. (Normally this is just gc.h. `make cords` adds "cord.h" and "ec.h".) @@ -220,8 +214,6 @@ The collector currently is designed to run essentially unmodified on machines that use a flat 32-bit or 64-bit address space. That includes the vast majority of Workstations and X86 (X >= 3) PCs. -(The list here was deleted because it was getting too long and constantly -out of date.) In a few cases (Amiga, OS/2, Win32, MacOS) a separate makefile or equivalent is supplied. Many of these have separate README.system @@ -234,14 +226,13 @@ of dyn_load.c. On other machines we recommend that you do one of the following: - 1) Add dynamic library support (and send us the code). - 2) Use static versions of the libraries. - 3) Arrange for dynamic libraries to use the standard malloc. - This is still dangerous if the library stores a pointer to a - garbage collected object. But nearly all standard interfaces - prohibit this, because they deal correctly with pointers - to stack allocated objects. (Strtok is an exception. Don't - use it.) + 1. Add dynamic library support (and send us the code). + 2. Use static versions of the libraries. + 3. Arrange for dynamic libraries to use the standard malloc. This is still + dangerous if the library stores a pointer to a garbage collected object. + But nearly all standard interfaces prohibit this, because they deal + correctly with pointers to stack allocated objects. (`strtok` is an + exception. Don't use it.) In all cases we assume that pointer alignment is consistent with that enforced by the standard C compilers. If you use a nonstandard compiler @@ -265,81 +256,69 @@ from nonstandard places (e.g. from dynamic library data areas on a machine on which the collector doesn't already understand them.) On some machines, it may be desirable to set `GC_stackbottom` to a good -approximation of the stack base. (This enhances code portability on -HP PA machines, since there is no good way for the collector to -compute this value.) Client code may include "gc.h", which defines -all of the following, plus many others. - - 1) `GC_malloc(nbytes)` - - Allocate an object of size nbytes. Unlike malloc, the object is - cleared before being returned to the user. `GC_malloc` will - invoke the garbage collector when it determines this to be appropriate. - GC_malloc may return 0 if it is unable to acquire sufficient - space from the operating system. This is the most probable - consequence of running out of space. Other possible consequences - are that a function call will fail due to lack of stack space, - or that the collector will fail in other ways because it cannot - maintain its internal data structures, or that a crucial system - process will fail and take down the machine. Most of these - possibilities are independent of the malloc implementation. - - 2) `GC_malloc_atomic(nbytes)` - - Allocate an object of size nbytes that is guaranteed not to contain any - pointers. The returned object is not guaranteed to be cleared. - (Can always be replaced by `GC_malloc`, but results in faster collection - times. The collector will probably run faster if large character - arrays, etc. are allocated with `GC_malloc_atomic` than if they are - statically allocated.) - - 3) `GC_realloc(object, new_size)` - - Change the size of object to be `new_size`. Returns a pointer to the - new object, which may, or may not, be the same as the pointer to - the old object. The new object is taken to be atomic if and only if the - old one was. If the new object is composite and larger than the original - object,then the newly added bytes are cleared (we hope). This is very - likely to allocate a new object, unless `MERGE_SIZES` is defined in - gc_priv.h. Even then, it is likely to recycle the old object only if the - object is grown in small additive increments (which, we claim, is - generally bad coding practice.) - - 4) `GC_free(object)` - - Explicitly deallocate an object returned by `GC_malloc` or - `GC_malloc_atomic`. Not necessary, but can be used to minimize - collections if performance is critical. Probably a performance - loss for very small objects (<= 8 bytes). - - 5) `GC_expand_hp(bytes)` - - Explicitly increase the heap size. (This is normally done automatically - if a garbage collection failed to `GC_reclaim` enough memory. Explicit - calls to `GC_expand_hp` may prevent unnecessarily frequent collections at - program startup.) - - 6) `GC_malloc_ignore_off_page(bytes)` - - Identical to `GC_malloc`, but the client promises to keep a pointer to - the somewhere within the first 256 bytes of the object while it is - live. (This pointer should normally be declared volatile to prevent - interference from compiler optimizations.) This is the recommended - way to allocate anything that is likely to be larger than 100 Kbytes - or so. (`GC_malloc` may result in failure to reclaim such objects.) - - 7) `GC_set_warn_proc(proc)` - - Can be used to redirect warnings from the collector. Such warnings - should be rare, and should not be ignored during code development. - - 8) `GC_enable_incremental()` - - Enables generational and incremental collection. Useful for large - heaps on machines that provide access to page dirty information. - Some dirty bit implementations may interfere with debugging - (by catching address faults) and place restrictions on heap arguments - to system calls (since write faults inside a system call may not be - handled well). - - 9) Several routines to allow for registration of finalization code. - User supplied finalization code may be invoked when an object becomes - unreachable. To call `(*f)(obj, x)` when obj becomes inaccessible, use - `GC_register_finalizer(obj, f, x, 0, 0);` - For more sophisticated uses, and for finalization ordering issues, - see gc.h. +approximation of the stack base (bottom). + +Client code may include "gc.h", which defines all of the following, plus many +others. + + 1. `GC_malloc(bytes)` - Allocate an object of a given size. Unlike malloc, + the object is cleared before being returned to the user. `GC_malloc` will + invoke the garbage collector when it determines this to be appropriate. + GC_malloc may return 0 if it is unable to acquire sufficient space from the + operating system. This is the most probable consequence of running out + of space. Other possible consequences are that a function call will fail + due to lack of stack space, or that the collector will fail in other ways
View file
_service:tar_scm:gc-8.0.6.tar.gz/SMakefile.amiga -> _service:tar_scm:gc-8.2.2.tar.gz/SMakefile.amiga
Changed
@@ -49,39 +49,39 @@ #------------------LINKING---------------------------- -all: gctest setjmp_t cord/cordtest +all: gc.lib cord.lib clean: - delete *.lib gctest setjmp_t *.o *.lnk cord/*.o cord/*.lib cord/*.lnk cord/tests/*.o cord/cordtest + delete *.lib gctest setjmp_t *.o *.lnk cord/*.o cord/tests/*.o cordtest smake -test: setjmp_t gctest cord/cordtest +check: setjmp_t gctest cordtest setjmp_t gctest - cord/cordtest + cordtest -gctest: gc$(CPU).lib GCAmigaOS$(CPU).lib test.o - $(LINKER) LIB:c.o test.o TO gctest LIB gc$(CPU).lib LIB:sc.lib $(MATHLIB) +gctest: gc.lib GCAmigaOS$(CPU).lib test.o + $(LINKER) LIB:c.o test.o TO gctest LIB gc.lib LIB:sc.lib $(MATHLIB) setjmp_t: setjmp_t.o gc.h $(LINKER) LIB:c.o setjmp_t.o to setjmp_t lib LIB:sc.lib -cord/cordtest: cord/tests/cordtest.o cord/cord$(CPU).lib gc$(CPU).lib - slink LIB:c.o cord/tests/cordtest.o LIB $(MATHLIB) gc$(CPU).lib cord/cord$(CPU).lib LIB:sc.lib TO cord/cordtest +cordtest: cord/tests/cordtest.o cord.lib gc.lib + $(LINKER) LIB:c.o cord/tests/cordtest.o LIB $(MATHLIB) gc.lib cord.lib LIB:sc.lib TO cordtest #------------------LIBBING---------------------------- OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dyn_load.o dbg_mlc.o malloc.o checksums.o typd_mlc.o ptr_chck.o mallocx.o fnlz_mlc.o -gc$(CPU).lib: $(OBJS) - $(LIBER) gc$(CPU).lib r $(OBJS) +gc.lib: $(OBJS) + $(LIBER) gc.lib r $(OBJS) COBJS = cord/cordbscs.o cord/cordprnt.o cord/cordxtra.o -cord/cord$(CPU).lib: $(COBJS) - oml cord/cord$(CPU).lib r $(COBJS) +cord.lib: $(COBJS) + $(LIBER) cord.lib r $(COBJS) #------------------COMPILING-------------------------- @@ -160,13 +160,13 @@ # cords: cord/cordbscs.o: cord/cordbscs.c - sc cord/cordbscs.c $(CSCOPT) + $(CC) cord/cordbscs.c $(CSCOPT) cord/cordprnt.o: cord/cordprnt.c - sc cord/cordprnt.c $(CSCOPT) + $(CC) cord/cordprnt.c $(CSCOPT) cord/cordxtra.o: cord/cordxtra.c - sc cord/cordxtra.c $(CSCOPT) + $(CC) cord/cordxtra.c $(CSCOPT) cord/tests/cordtest.o: cord/tests/cordtest.c - sc cord/tests/cordtest.c $(CSCOPT) + $(CC) cord/tests/cordtest.c $(CSCOPT)
View file
_service:tar_scm:gc-8.0.6.tar.gz/WCC_MAKEFILE -> _service:tar_scm:gc-8.2.2.tar.gz/WCC_MAKEFILE
Changed
@@ -6,10 +6,9 @@ #SYSTEM=DOS4GW #SYSTEM=OS2 -# The collector can be built either as dynamic or as static library. -# Select the library type you need. -#MAKE_AS_DLL=1 -MAKE_AS_LIB=1 +# The collector can be built either as dynamic (the default) or as static +# library. The latter is selected by setting ENABLE_STATIC variable. +#ENABLE_STATIC=1 # Select calling conventions. # Possible choices are r and s. @@ -54,14 +53,19 @@ !else !error undefined or unsupported target platform: $(SYSTEM) !endif -!ifdef MAKE_AS_DLL -DLLFLAG=-bd -DGC_DLL -TEST_DLLFLAG=-DGC_DLL -!else ifdef MAKE_AS_LIB + +!ifdef ENABLE_STATIC DLLFLAG= -TEST_DLLFLAG= +TEST_DLLFLAG=-DGC_NOT_DLL +CORDFLAG= !else -!error Either MAKE_AS_LIB or MAKE_AS_DLL should be defined +DLLFLAG=-bd -DGC_DLL +TEST_DLLFLAG=-DGC_DLL +# cord.dll and its clients should not link C library statically otherwise +# FILE-related functions might not work (because own set of opened FILEs +# is maintained by each copy of the C library thus making impossible to pass +# FILE pointer from, e.g., .exe code to .dll one). +CORDFLAG=-br !endif CC=wcc386 @@ -72,20 +76,54 @@ TEST_CFLAGS=-$(CPU)$(CALLING) $(OPTIM) -iinclude -zp4 -zc $(SYSFLAG) $(TEST_DLLFLAG) $(DEFS) TEST_CXXFLAGS= $(TEST_CFLAGS) -xs +COBJS= cordbscs.obj cordxtra.obj cordprnt.obj + +all: gc.lib gccpp.lib gctba.lib cord.lib + +check: gctest.exe test_cpp.exe cordtest.exe .SYMBOLIC + *gctest.exe + *test_cpp.exe + *cordtest.exe + +!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 & 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 -all: gc.lib gctest.exe test_cpp.exe +gc.lib: $(OBJS) + @%create $*.lb1 + @for %i in ($(OBJS)) do @%append $*.lb1 +'%i' + *wlib -b -c -n -p=512 $@ @$*.lb1 -!ifdef MAKE_AS_DLL +cord.lib: $(COBJS) + @%create $*.lb1 + @for %i in ($(COBJS)) do @%append $*.lb1 +'%i' + *wlib -b -c -n -p=512 $@ @$*.lb1 + +gccpp.lib: gc_badalc.obj gc_cpp.obj + @%create $*.lb1 + @%append $*.lb1 +'gc_badalc.obj' + @%append $*.lb1 +'gc_cpp.obj' + *wlib -b -c -n -p=512 $@ @$*.lb1 + +# The same as gccpp.lib but contains only gc_badalc.obj. +gctba.lib: gc_badalc.obj + @%create $*.lb1 + @%append $*.lb1 +'gc_badalc.obj' + *wlib -b -c -n -p=512 $@ @$*.lb1 + +!else -gc.lib: gc.dll gc_cpp.obj - *wlib -b -c -n -p=512 $@ +gc.dll +gc_cpp.obj +gc.obj: extra\gc.c .AUTODEPEND + $(CC) $(CFLAGS) extra\gc.c -gc.dll: $(OBJS) .AUTODEPEND +gc.lib: gc.dll + *wlib -b -c -n -p=512 $@ +gc.dll + +gc.dll: gc.obj .AUTODEPEND @%create $*.lnk !ifdef DOS4GW @%append $*.lnk sys os2v2_dll @@ -94,18 +132,69 @@ !else ifdef OS2 @%append $*.lnk sys os2v2_dll !endif + @%append $*.lnk op case @%append $*.lnk name $* - @for %i in ($(OBJS)) do @%append $*.lnk file '%i' + @%append $*.lnk file 'gc.obj' *wlink @$*.lnk -!else -gc.lib: $(OBJS) gc_cpp.obj - @%create $*.lb1 - @for %i in ($(OBJS)) do @%append $*.lb1 +'%i' - @%append $*.lb1 +'gc_cpp.obj' - *wlib -b -c -n -p=512 $@ @$*.lb1 +cord.lib: cord.dll + *wlib -b -c -n -p=512 $@ +cord.dll + +cord.dll: $(COBJS) gc.lib .AUTODEPEND + @%create $*.lnk +!ifdef DOS4GW + @%append $*.lnk sys os2v2_dll +!else ifdef MSWIN32 + @%append $*.lnk sys nt_dll +!else ifdef OS2 + @%append $*.lnk sys os2v2_dll !endif + @%append $*.lnk op case + @%append $*.lnk name $* + @for %i in ($(COBJS)) do @%append $*.lnk file '%i' + @%append $*.lnk library gc.lib + *wlink @$*.lnk +gccpp.lib: gccpp.dll + *wlib -b -c -n -p=512 $@ +gccpp.dll + +gccpp.dll: gc_badalc.obj gc_cpp.obj gc.lib .AUTODEPEND + @%create $*.lnk +!ifdef DOS4GW + @%append $*.lnk sys os2v2_dll +!else ifdef MSWIN32 + @%append $*.lnk sys nt_dll +!else ifdef OS2 + @%append $*.lnk sys os2v2_dll +!endif + @%append $*.lnk op case + @%append $*.lnk name $* + @%append $*.lnk file 'gc_badalc.obj' + @%append $*.lnk file 'gc_cpp.obj' + @%append $*.lnk library gc.lib + @%append $*.lnk library wr7$(CALLING)dll.lib + *wlink @$*.lnk + +gctba.lib: gctba.dll + *wlib -b -c -n -p=512 $@ +gctba.dll + +gctba.dll: gc_badalc.obj gc.lib .AUTODEPEND + @%create $*.lnk +!ifdef DOS4GW + @%append $*.lnk sys os2v2_dll +!else ifdef MSWIN32 + @%append $*.lnk sys nt_dll +!else ifdef OS2 + @%append $*.lnk sys os2v2_dll +!endif + @%append $*.lnk op case + @%append $*.lnk name $* + @%append $*.lnk file 'gc_badalc.obj' + @%append $*.lnk library gc.lib + @%append $*.lnk library wr7$(CALLING)dll.lib + *wlink @$*.lnk + +!endif gctest.exe: test.obj gc.lib %create $*.lnk @@ -122,7 +211,25 @@ @%append $*.lnk file test.obj @%append $*.lnk library gc.lib *wlink @$*.lnk -test_cpp.exe: test_cpp.obj gc.lib + +cordtest.exe: cordtest.obj gc.lib cord.lib + %create $*.lnk +!ifdef DOS4GW + @%append $*.lnk sys dos4g +!else ifdef MSWIN32 + @%append $*.lnk sys nt +!else ifdef OS2 + @%append $*.lnk sys os2v2 +!endif + @%append $*.lnk op case + @%append $*.lnk op stack=256K + @%append $*.lnk name $* + @%append $*.lnk file cordtest.obj + @%append $*.lnk library gc.lib + @%append $*.lnk library cord.lib + *wlink @$*.lnk +
View file
_service:tar_scm:gc-8.0.6.tar.gz/aclocal.m4 -> _service:tar_scm:gc-8.2.2.tar.gz/aclocal.m4
Changed
@@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.)) -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN(AM_AUTOMAKE_VERSION, -am__api_version='1.15' +am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if($1, 1.15, , +m4_if($1, 1.16.5, , AC_FATAL(Do not call $0, use AM_INIT_AUTOMAKE($1).))dnl ) @@ -51,14 +51,14 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN(AM_SET_CURRENT_AUTOMAKE_VERSION, -AM_AUTOMAKE_VERSION(1.15)dnl +AM_AUTOMAKE_VERSION(1.16.5)dnl m4_ifndef(AC_AUTOCONF_VERSION, m4_copy(m4_PACKAGE_VERSION, AC_AUTOCONF_VERSION))dnl _AM_AUTOCONF_VERSION(m4_defn(AC_AUTOCONF_VERSION))) # Figure out how to run the assembler. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -78,7 +78,7 @@ # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -130,7 +130,7 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -161,7 +161,7 @@ Usually this means the macro was only invoked conditionally.) fi)) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -352,13 +352,12 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. - # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN(_AM_OUTPUT_DEPENDENCY_COMMANDS, @@ -366,49 +365,43 @@ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE($CONFIG_FILES, + *\'*, eval set x "$CONFIG_FILES", + *, set x $CONFIG_FILES) shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`AS_ECHO("$am_mf") | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME("$file")` - AS_MKDIR_P($dirpart/$fdir) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME("$am_mf")` + am_filepart=`AS_BASENAME("$am_mf")` + AM_RUN_LOG(cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) || am_rc=$? done + if test $am_rc -ne 0; then + AC_MSG_FAILURE(Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).) + fi + AS_UNSET(am_dirpart) + AS_UNSET(am_filepart) + AS_UNSET(am_mf) + AS_UNSET(am_rc) + rm -f conftest-deps.mk } )# _AM_OUTPUT_DEPENDENCY_COMMANDS @@ -417,18 +410,17 @@ # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. AC_DEFUN(AM_OUTPUT_DEPENDENCY_COMMANDS, AC_CONFIG_COMMANDS(depfiles, test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS, - AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir") -) + AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}")) # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -456,6 +448,10 @@ # release and drop the old call support. AC_DEFUN(AM_INIT_AUTOMAKE, AC_PREREQ(2.65)dnl
View file
_service:tar_scm:gc-8.0.6.tar.gz/allchblk.c -> _service:tar_scm:gc-8.2.2.tar.gz/allchblk.c
Changed
@@ -130,7 +130,7 @@ if (0 != h) GC_printf("Free list %u (total size %lu):\n", i, (unsigned long)GC_free_bytesi); - while (h != 0) { + while (h /* != NULL */) { /* CPPCHECK */ hdr * hhdr = HDR(h); GC_printf("\t%p size %lu %s black listed\n", @@ -389,7 +389,7 @@ GC_ASSERT(GC_free_bytesindex <= GC_large_free_bytes); hhdr -> hb_next = second; hhdr -> hb_prev = 0; - if (0 != second) { + if (second /* != NULL */) { /* CPPCHECK */ hdr * second_hdr; GET_HDR(second, second_hdr); @@ -460,8 +460,8 @@ # endif } -/* Unmap blocks that haven't been recently touched. This is the only way */ -/* way blocks are ever unmapped. */ +/* Unmap blocks that haven't been recently touched. This is the only */ +/* way blocks are ever unmapped. */ GC_INNER void GC_unmap_old(void) { int i; @@ -507,24 +507,6 @@ } } -# ifdef MPROTECT_VDB - GC_INNER GC_bool GC_has_unmapped_memory(void) - { - int i; - - for (i = 0; i <= N_HBLK_FLS; ++i) { - struct hblk * h; - hdr * hhdr; - - for (h = GC_hblkfreelisti; h != NULL; h = hhdr -> hb_next) { - hhdr = HDR(h); - if (!IS_MAPPED(hhdr)) return TRUE; - } - } - return FALSE; - } -# endif /* MPROTECT_VDB */ - /* Merge all unmapped blocks that are adjacent to other free */ /* blocks. This may involve remapping, since all blocks are either */ /* fully mapped or fully unmapped. */ @@ -587,7 +569,7 @@ GC_add_to_fl(h, hhdr); /* Start over at beginning of list */ h = GC_hblkfreelisti; - } else /* not mergable with successor */ { + } else /* not mergeable with successor */ { h = hhdr -> hb_next; } } /* while (h != 0) ... */ @@ -659,12 +641,12 @@ nhdr -> hb_next = next; nhdr -> hb_sz = total_size - h_size; nhdr -> hb_flags = 0; - if (0 != prev) { + if (prev /* != NULL */) { /* CPPCHECK */ HDR(prev) -> hb_next = n; } else { GC_hblkfreelistindex = n; } - if (0 != next) { + if (next /* != NULL */) { HDR(next) -> hb_prev = n; } GC_ASSERT(GC_free_bytesindex > h_size); @@ -701,6 +683,7 @@ int split_limit; /* Highest index of free list whose blocks we */ /* split. */ + GC_ASSERT(I_HOLD_LOCK()); GC_ASSERT((sz & (GRANULE_BYTES - 1)) == 0); blocks = OBJ_SZ_TO_BLOCKS_CHECKED(sz); if ((signed_word)(blocks * HBLKSIZE) < 0) { @@ -769,7 +752,11 @@ for (hbp = GC_hblkfreelistn;; hbp = hhdr -> hb_next) { signed_word size_avail; /* bytes available in this block */ - if (NULL == hbp) return NULL; + if (hbp /* != NULL */) { + /* CPPCHECK */ + } else { + return NULL; + } GET_HDR(hbp, hhdr); /* set hhdr value */ size_avail = (signed_word)hhdr->hb_sz; if (size_avail < size_needed) continue; @@ -779,7 +766,7 @@ /* This prevents us from disassembling a single large */ /* block to get tiny blocks. */ thishbp = hhdr -> hb_next; - if (thishbp != 0) { + if (thishbp /* != NULL */) { /* CPPCHECK */ signed_word next_size; GET_HDR(thishbp, thishdr); @@ -952,7 +939,7 @@ GET_HDR(hbp, hhdr); size = HBLKSIZE * OBJ_SZ_TO_BLOCKS(hhdr->hb_sz); - if ((signed_word)size <= 0) + if ((size & SIGNB) != 0) ABORT("Deallocating excessively large block. Too large an allocation?"); /* Probably possible if we try to allocate more than half the address */ /* space at once. If we don't catch it here, strange things happen */ @@ -983,7 +970,7 @@ GC_remove_header(next); } /* Coalesce with predecessor, if possible. */ - if (0 != prev) { + if (prev /* != NULL */) { /* CPPCHECK */ prevhdr = HDR(prev); if (IS_MAPPED(prevhdr) && (signed_word)(hhdr -> hb_sz + prevhdr -> hb_sz) > 0) {
View file
_service:tar_scm:gc-8.0.6.tar.gz/alloc.c -> _service:tar_scm:gc-8.2.2.tar.gz/alloc.c
Changed
@@ -3,7 +3,7 @@ * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved. * Copyright (c) 1998 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. - * Copyright (c) 2008-2019 Ivan Maidanski + * Copyright (c) 2008-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -21,7 +21,7 @@ #include <stdio.h> #if !defined(MACOS) && !defined(MSWINCE) # include <signal.h> -# if !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) \ +# if !defined(GC_NO_TYPES) && !defined(SN_TARGET_PSP2) \ && !defined(__CC_ARM) # include <sys/types.h> # endif @@ -69,7 +69,8 @@ word GC_gc_no = 0; #ifndef NO_CLOCK - static unsigned long full_gc_total_time = 0; /* in msecs, may wrap */ + static unsigned long full_gc_total_time = 0; /* in ms, may wrap */ + static unsigned full_gc_total_ns_frac = 0; /* fraction of 1 ms */ static GC_bool measure_performance = FALSE; /* Do performance measurements if set to true (e.g., */ /* accumulation of the total time of full collections). */ @@ -87,6 +88,7 @@ #ifndef GC_DISABLE_INCREMENTAL GC_INNER GC_bool GC_incremental = FALSE; /* By default, stop the world. */ + STATIC GC_bool GC_should_start_incremental_collection = FALSE; #endif GC_API int GC_CALL GC_is_incremental_mode(void) @@ -107,12 +109,34 @@ #endif STATIC GC_bool GC_need_full_gc = FALSE; - /* Need full GC do to heap growth. */ + /* Need full GC due to heap growth. */ #ifdef THREAD_LOCAL_ALLOC GC_INNER GC_bool GC_world_stopped = FALSE; #endif +STATIC GC_bool GC_disable_automatic_collection = FALSE; + +GC_API void GC_CALL GC_set_disable_automatic_collection(int value) +{ + DCL_LOCK_STATE; + + LOCK(); + GC_disable_automatic_collection = (GC_bool)value; + UNLOCK(); +} + +GC_API int GC_CALL GC_get_disable_automatic_collection(void) +{ + int value; + DCL_LOCK_STATE; + + LOCK(); + value = (int)GC_disable_automatic_collection; + UNLOCK(); + return value; +} + STATIC word GC_used_heap_size_after_full = 0; /* GC_copyright symbol is externally visible. */ @@ -124,7 +148,7 @@ "Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. ", "Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. ", "Copyright (c) 1999-2009 by Hewlett-Packard Company. All rights reserved. ", -"Copyright (c) 2008-2019 Ivan Maidanski ", +"Copyright (c) 2008-2021 Ivan Maidanski ", "THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY", " EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.", "See source code for details." }; @@ -168,15 +192,44 @@ unsigned long GC_time_limit = GC_TIME_LIMIT; /* We try to keep pause times from exceeding */ /* this by much. In milliseconds. */ +#elif defined(PARALLEL_MARK) + unsigned long GC_time_limit = GC_TIME_UNLIMITED; + /* The parallel marker cannot be interrupted for */ + /* now, so the time limit is absent by default. */ #else unsigned long GC_time_limit = 50; #endif #ifndef NO_CLOCK + STATIC unsigned long GC_time_lim_nsec = 0; + /* The nanoseconds add-on to GC_time_limit */ + /* value. Not updated by GC_set_time_limit(). */ + /* Ignored if the value of GC_time_limit is */ + /* GC_TIME_UNLIMITED. */ + +# define TV_NSEC_LIMIT (1000UL * 1000) /* amount of nanoseconds in 1 ms */ + + GC_API void GC_CALL GC_set_time_limit_tv(struct GC_timeval_s tv) + { + GC_ASSERT(tv.tv_ms <= GC_TIME_UNLIMITED); + GC_ASSERT(tv.tv_nsec < TV_NSEC_LIMIT); + GC_time_limit = tv.tv_ms; + GC_time_lim_nsec = tv.tv_nsec; + } + + GC_API struct GC_timeval_s GC_CALL GC_get_time_limit_tv(void) + { + struct GC_timeval_s tv; + + tv.tv_ms = GC_time_limit; + tv.tv_nsec = GC_time_lim_nsec; + return tv; + } + STATIC CLOCK_TYPE GC_start_time = CLOCK_TYPE_INITIALIZER; /* Time at which we stopped world. */ /* used only in GC_timeout_stop_func. */ -#endif +#endif /* !NO_CLOCK */ STATIC int GC_n_attempts = 0; /* Number of attempts at finishing */ /* collection within GC_time_limit. */ @@ -210,7 +263,7 @@ { CLOCK_TYPE current_time; static unsigned count = 0; - unsigned long time_diff; + unsigned long time_diff, nsec_diff; if ((*GC_default_stop_func)()) return(1); @@ -218,11 +271,16 @@ if ((count++ & 3) != 0) return(0); GET_TIME(current_time); time_diff = MS_TIME_DIFF(current_time,GC_start_time); - if (time_diff >= GC_time_limit) { - GC_COND_LOG_PRINTF( - "Abandoning stopped marking after %lu msecs (attempt %d)\n", - time_diff, GC_n_attempts); - return(1); + nsec_diff = NS_FRAC_TIME_DIFF(current_time, GC_start_time); +# if defined(CPPCHECK) + GC_noop1((word)&nsec_diff); +# endif + if (time_diff >= GC_time_limit + && (time_diff > GC_time_limit || nsec_diff >= GC_time_lim_nsec)) { + GC_COND_LOG_PRINTF("Abandoning stopped marking after %lu ms %lu ns" + " (attempt %d)\n", + time_diff, nsec_diff, GC_n_attempts); + return 1; } return(0); } @@ -351,15 +409,40 @@ /* limits used by blacklisting. */ STATIC word GC_collect_at_heapsize = GC_WORD_MAX; +GC_API void GC_CALL GC_start_incremental_collection(void) +{ +# ifndef GC_DISABLE_INCREMENTAL + DCL_LOCK_STATE; + + if (!GC_incremental) return; + LOCK(); + GC_should_start_incremental_collection = TRUE; + ENTER_GC(); + GC_collect_a_little_inner(1); + EXIT_GC(); + UNLOCK(); +# endif +} + /* Have we allocated enough to amortize a collection? */ GC_INNER GC_bool GC_should_collect(void) { static word last_min_bytes_allocd; static word last_gc_no; + + GC_ASSERT(I_HOLD_LOCK()); if (last_gc_no != GC_gc_no) { - last_gc_no = GC_gc_no; last_min_bytes_allocd = min_bytes_allocd(); + last_gc_no = GC_gc_no; + } +# ifndef GC_DISABLE_INCREMENTAL + if (GC_should_start_incremental_collection) { + GC_should_start_incremental_collection = FALSE; + return TRUE; } +# endif + if (GC_disable_automatic_collection) return FALSE; + return(GC_adj_bytes_allocd() >= last_min_bytes_allocd || GC_heapsize >= GC_collect_at_heapsize); }
View file
_service:tar_scm:gc-8.0.6.tar.gz/backgraph.c -> _service:tar_scm:gc-8.2.2.tar.gz/backgraph.c
Changed
@@ -63,9 +63,9 @@ signed_word height; /* Longest path through unreachable nodes to this node */ /* that we found using depth first search. */ +# define HEIGHT_UNKNOWN (-2) +# define HEIGHT_IN_PROGRESS (-1) -# define HEIGHT_UNKNOWN ((signed_word)(-2)) -# define HEIGHT_IN_PROGRESS ((signed_word)(-1)) ptr_t edgesMAX_IN; struct back_edges_struct *cont; /* Pointer to continuation structure; we use only the */ @@ -90,6 +90,7 @@ size_t bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(MAX_BACK_EDGE_STRUCTS * sizeof(back_edges)); + GC_ASSERT(GC_page_size != 0); back_edge_space = (back_edges *)GET_MEM(bytes_to_get); if (NULL == back_edge_space) ABORT("Insufficient memory for back edges"); @@ -132,6 +133,7 @@ if (n_in_progress >= in_progress_size) { ptr_t * new_in_progress_space; + GC_ASSERT(GC_page_size != 0); if (NULL == in_progress_space) { in_progress_size = ROUNDUP_PAGESIZE_IF_MMAP(INITIAL_IN_PROGRESS * sizeof(ptr_t)) @@ -146,8 +148,9 @@ BCOPY(in_progress_space, new_in_progress_space, n_in_progress * sizeof(ptr_t)); } - GC_add_to_our_memory((ptr_t)new_in_progress_space, - in_progress_size * sizeof(ptr_t)); + if (EXPECT(new_in_progress_space != NULL, TRUE)) + GC_add_to_our_memory((ptr_t)new_in_progress_space, + in_progress_size * sizeof(ptr_t)); # ifndef GWW_VDB GC_scratch_recycle_no_gww(in_progress_space, n_in_progress * sizeof(ptr_t)); @@ -240,7 +243,7 @@ if (((word)pred & FLAG_MANY) != 0) { n_edges = e -> n_edges; - } else if (((word)pred & 1) == 0) { + } else if (((word)COVERT_DATAFLOW(pred) & 1) == 0) { /* A misinterpreted freelist link. */ n_edges = 1; local = -1; @@ -532,8 +535,9 @@ void GC_print_back_graph_stats(void) { GC_ASSERT(I_HOLD_LOCK()); - GC_printf("Maximum backwards height of reachable objects at GC %lu is %lu\n", - (unsigned long) GC_gc_no, (unsigned long)GC_max_height); + GC_printf("Maximum backwards height of reachable objects" + " at GC #%lu is %lu\n", + (unsigned long)GC_gc_no, (unsigned long)GC_max_height); if (GC_max_height > GC_max_max_height) { ptr_t obj = GC_deepest_obj;
View file
_service:tar_scm:gc-8.0.6.tar.gz/build/s60v3/libgc.mmp -> _service:tar_scm:gc-8.2.2.tar.gz/build/s60v3/libgc.mmp
Changed
@@ -41,6 +41,7 @@ SOURCE dyn_load.c SOURCE finalize.c SOURCE fnlz_mlc.c +//SOURCE gc_badalc.cpp //SOURCE gc_cpp.cpp SOURCE gcj_mlc.c SOURCE headers.c
View file
_service:tar_scm:gc-8.0.6.tar.gz/checksums.c -> _service:tar_scm:gc-8.2.2.tar.gz/checksums.c
Changed
@@ -127,8 +127,8 @@ GC_bytes_in_used_blocks = 0; GC_apply_to_all_blocks(GC_add_block, (word)0); - GC_COND_LOG_PRINTF("GC_bytes_in_used_blocks = %lu," - " bytes_in_free_blocks = %lu, heapsize = %lu\n", + GC_COND_LOG_PRINTF("GC_bytes_in_used_blocks= %lu," + " bytes_in_free_blocks= %lu, heapsize= %lu\n", (unsigned long)GC_bytes_in_used_blocks, (unsigned long)bytes_in_free_blocks, (unsigned long)GC_heapsize);
View file
_service:tar_scm:gc-8.0.6.tar.gz/compile -> _service:tar_scm:gc-8.2.2.tar.gz/compile
Changed
@@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey <tromey@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,7 +53,7 @@ MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) @@ -255,7 +255,8 @@ echo "compile $scriptversion" exit $? ;; - cl | */\\cl | cl.exe | */\\cl.exe ) + cl | */\\cl | cl.exe | */\\cl.exe | \ + icl | */\\icl | icl.exe | */\\icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End:
View file
_service:tar_scm:gc-8.0.6.tar.gz/config.guess -> _service:tar_scm:gc-8.2.2.tar.gz/config.guess
Changed
@@ -1,8 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2021 Free Software Foundation, Inc. -timestamp='2014-11-04' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2021-06-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +17,7 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. +# along with this program; if not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -27,11 +29,19 @@ # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to <config-patches@gnu.org>. +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ @@ -39,7 +49,7 @@ Output the configuration name of the system \`$me' is run on. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -50,7 +60,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,7 +94,8 @@ exit 1 fi -trap 'exit 1' 1 2 15 +# Just in case it came from the environment. +GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -96,66 +107,90 @@ # Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_SYSTEM}" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown - eval $set_cc_for_build - cat <<-EOF > $dummy.c + set_cc_for_build + cat <<-EOF > "$dummy.c" #include <features.h> #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #else + #include <stdarg.h> + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if "$LIBC" = unknown && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if "$LIBC" = unknown ; then + LIBC=gnu + fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -167,22 +202,32 @@ # # Note: NetBSD doesn't particularly care about the vendor
View file
_service:tar_scm:gc-8.0.6.tar.gz/config.sub -> _service:tar_scm:gc-8.2.2.tar.gz/config.sub
Changed
@@ -1,8 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2021 Free Software Foundation, Inc. -timestamp='2014-12-03' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2021-08-14' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +17,7 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. +# along with this program; if not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,7 +35,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -50,15 +52,21 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 OPTION CPU-MFR-OPSYS - $0 OPTION ALIAS +Usage: $0 OPTION CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -68,7 +76,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -90,12 +98,12 @@ - ) # Use stdin as input. break ;; -* ) - echo "$me: invalid option $1$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. - echo $1 + echo "$1" exit ;; * ) @@ -111,1228 +119,1181 @@ exit 1;; esac -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\(^-*-^-*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\(^-*-^-*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\(^-*-^-*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-^-*$//'` - if $basic_machine != $1 - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <<EOF +$1 +EOF +IFS=$saved_IFS -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun234* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c123* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.4-9*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v4-9*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178
View file
_service:tar_scm:gc-8.0.6.tar.gz/configure -> _service:tar_scm:gc-8.2.2.tar.gz/configure
Changed
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for gc 8.0.6. +# Generated by GNU Autoconf 2.69 for gc 8.2.2. # # Report bugs to <https://github.com/ivmai/bdwgc/issues>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='gc' PACKAGE_TARNAME='gc' -PACKAGE_VERSION='8.0.6' -PACKAGE_STRING='gc 8.0.6' +PACKAGE_VERSION='8.2.2' +PACKAGE_STRING='gc 8.2.2' PACKAGE_BUGREPORT='https://github.com/ivmai/bdwgc/issues' PACKAGE_URL='' @@ -664,11 +664,15 @@ KEEP_BACK_PTRS_TRUE MAKE_BACK_GRAPH_FALSE MAKE_BACK_GRAPH_TRUE +ENABLE_GCJ_SUPPORT_FALSE +ENABLE_GCJ_SUPPORT_TRUE addlibs addobjs CXXLIBS AM_CPPFLAGS AM_CFLAGS +GC_TBA_LIBRARY_FALSE +GC_TBA_LIBRARY_TRUE CPLUSPLUS_FALSE CPLUSPLUS_TRUE target_all @@ -691,6 +695,8 @@ THREADDLLIBS CFLAGS_EXTRA GC_CFLAGS +EMSCRIPTEN_FALSE +EMSCRIPTEN_TRUE CXXCPP CPP LT_SYS_LIBRARY_PATH @@ -733,7 +739,6 @@ AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE -am__quote am__include DEPDIR OBJEXT @@ -751,6 +756,9 @@ AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__untar am__tar AMTAR @@ -824,7 +832,8 @@ PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -845,6 +854,7 @@ enable_threads_discovery enable_cplusplus with_ecos +enable_throw_bad_alloc_library with_target_subdir with_cross_host enable_gcj_support @@ -1434,7 +1444,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.0.6 to adapt to many kinds of systems. +\`configure' configures gc 8.2.2 to adapt to many kinds of systems. Usage: $0 OPTION... VAR=VALUE... @@ -1506,7 +1516,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gc 8.0.6:";; + short | recursive ) echo "Configuration of gc 8.2.2:";; esac cat <<\_ACEOF @@ -1536,6 +1546,8 @@ --disable-threads-discovery disable threads discovery in GC --enable-cplusplus install C++ support + --disable-throw-bad-alloc-library + do not build C++ gctba library --disable-gcj-support disable support for gcj --enable-sigrt-signals force GC to use SIGRTMIN-based signals for thread suspend/resume @@ -1567,7 +1579,7 @@ (default: yes if static libraries are disabled) --enable-gcov turn on code coverage analysis --disable-docs do not build and install documentation - --enable-handle-fork=yes|no|auto|manual + --enable-handle-fork=yes|no|auto|manual attempt to ensure a usable collector after fork() in multi-threaded programs (default: auto; manual: GC_atfork_prepare/parent/child should be called by @@ -1589,7 +1601,7 @@ configuring with a cross compiler --with-cross-host=HOST configuring with a cross compiler --with-libatomic-ops=yes|no|check|none - Use an external libatomic_ops? (default: check; + use an external libatomic_ops? (default: check; none: use compiler intrinsics or no thread support) Some influential environment variables: @@ -1675,7 +1687,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gc configure 8.0.6 +gc configure 8.2.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2165,7 +2177,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.0.6, which was +It was created by gc $as_me 8.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2692,7 +2704,7 @@ $as_echo "major=$GC_VERSION_MAJOR minor=$GC_VERSION_MINOR \ micro=$GC_VERSION_MICRO" >&6; } -am__api_version='1.15' +am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2868,12 +2880,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -3178,7 +3185,7 @@ # Define the identity of the package. PACKAGE='gc' - VERSION='8.0.6' + VERSION='8.2.2' cat >>confdefs.h <<_ACEOF @@ -3208,8 +3215,8 @@ # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -3228,6 +3235,20 @@ +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then
View file
_service:tar_scm:gc-8.0.6.tar.gz/configure.ac -> _service:tar_scm:gc-8.2.2.tar.gz/configure.ac
Changed
@@ -1,6 +1,6 @@ # Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved. # Copyright (c) 2005-2009 Hewlett-Packard Development Company, L.P. -# Copyright (c) 2009-2019 Ivan Maidanski +# Copyright (c) 2009-2021 Ivan Maidanski # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED # OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -14,7 +14,7 @@ dnl Process this file with autoconf to produce configure. dnl Initialization. -AC_INIT(gc,8.0.6,https://github.com/ivmai/bdwgc/issues) +AC_INIT(gc,8.2.2,https://github.com/ivmai/bdwgc/issues) dnl Version must conform to: 0-9+.0-9+.0-9+ AC_CONFIG_SRCDIR(gcj_mlc.c) @@ -42,8 +42,8 @@ # Special CFLAGS to use when building gc_cflags="" -# gc_use_mmap Set to "yes" on platforms where mmap should be used instead -# of sbrk. This will define USE_MMAP. +# Set to "yes" on platforms where mmap should be used instead of sbrk. +# This will define USE_MMAP. gc_use_mmap="" # We should set -fexceptions if we are using gcc and might be used @@ -62,13 +62,6 @@ esac fi -case "${host}" in - *-linux*) - # FIXME: This seems to be no longer needed as configured in gcconfig.h - #gc_use_mmap=yes - ;; -esac - # target_optspace --enable-target-optspace ("yes", "no", "") case "${target_optspace}:${host}" in yes:*) @@ -91,6 +84,18 @@ ;; esac +AC_MSG_CHECKING(for emscripten) +AC_COMPILE_IFELSE(AC_LANG_SOURCE( +#ifdef __EMSCRIPTEN__ +#error "this is emscripten" +#endif +), emscripten=no, emscripten=yes) +# Note -s ASYNCIFY is required to scan the stack, ASYNCIFY_STACK_SIZE is +# probably needed for gctest only. +AS_IF(test "x$emscripten" = "xyes", + gc_cflags="${gc_cflags} -s ASYNCIFY -s ASYNCIFY_STACK_SIZE=128000") +AM_CONDITIONAL(EMSCRIPTEN, test x$emscripten = xyes) +AC_MSG_RESULT($emscripten) GC_CFLAGS=${gc_cflags} AC_SUBST(GC_CFLAGS) @@ -99,11 +104,11 @@ AC_SUBST(CFLAGS_EXTRA) AC_ARG_ENABLE(threads, - AC_HELP_STRING(--enable-threads=TYPE, choose threading package), + AS_HELP_STRING(--enable-threads=TYPE, choose threading package), THREADS=$enableval, AC_MSG_CHECKING(for thread model used by GCC) THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` - if test -z "$THREADS"; then + if test -z "$THREADS" -o "x$emscripten" = "xyes"; then THREADS=no fi if test "$THREADS" = "posix"; then @@ -117,28 +122,28 @@ AC_MSG_RESULT($THREADS) ) AC_ARG_ENABLE(parallel-mark, - AC_HELP_STRING(--disable-parallel-mark, + AS_HELP_STRING(--disable-parallel-mark, do not parallelize marking and free list construction), - case "$THREADS" in + case "$THREADS" in no | none | single) if test "${enable_parallel_mark}" != no; then 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, + AS_HELP_STRING(--disable-thread-local-alloc, turn off thread-local allocation optimization), - case "$THREADS" in + case "$THREADS" in no | none | single) if test "${enable_thread_local_alloc}" = yes; then AC_MSG_ERROR( Thread-local allocation requires --enable-threads=x spec) fi ;; - esac) + esac) AC_ARG_ENABLE(threads-discovery, AS_HELP_STRING(--disable-threads-discovery, @@ -149,7 +154,7 @@ fi AC_ARG_ENABLE(cplusplus, - AC_HELP_STRING(--enable-cplusplus, install C++ support)) + AS_HELP_STRING(--enable-cplusplus, install C++ support)) dnl Features which may be selected in the following thread-detection switch. AH_TEMPLATE(PARALLEL_MARK, Define to enable parallel marking.) @@ -186,6 +191,8 @@ THREADDLLIBS= need_atomic_ops_asm=false +need_lib_rt=false +compile_asm=false use_parallel_mark=no use_thread_local_alloc=no # Libraries needed to support dynamic loading and/or threads. @@ -216,8 +223,9 @@ *-*-hpux11*) AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.") AC_DEFINE(_POSIX_C_SOURCE,199506L) - THREADDLLIBS="-lpthread -lrt" + THREADDLLIBS="-lpthread" # HPUX needs REENTRANT for the _r calls. + need_lib_rt=true ;; *-*-openbsd*) AM_CFLAGS="$AM_CFLAGS -pthread" @@ -236,10 +244,12 @@ *-*-netbsd*) AC_MSG_WARN("Only on NetBSD 2.0 or later.") AC_DEFINE(_PTHREADS) - THREADDLLIBS="-lpthread -lrt" + THREADDLLIBS="-lpthread" + need_lib_rt=true ;; *-*-solaris*) - THREADDLLIBS="-lpthread -lrt" + THREADDLLIBS="-lpthread" + need_lib_rt=true ;; *-*-cygwin* | *-*-msys*) # Cygwin doesn't have a real libpthread, so Libtool can't link @@ -260,7 +270,8 @@ ;; *-*-osf*) AM_CFLAGS="$AM_CFLAGS -pthread" - THREADDLLIBS="-lpthread -lrt" + THREADDLLIBS="-lpthread" + need_lib_rt=true ;; *) AS_IF(test x$default_threadlibs != xtrue, @@ -277,7 +288,7 @@ ;; esac ;; - win32) + mcf | win32) AC_DEFINE(GC_THREADS) use_parallel_mark=$enable_parallel_mark if test "${enable_parallel_mark}" != no \ @@ -295,8 +306,6 @@ ;; dgux386) AC_DEFINE(GC_THREADS) - THREADS=dgux386 - AC_MSG_RESULT($THREADDLLIBS) # Use pthread GCC switch THREADDLLIBS=-pthread use_parallel_mark=$enable_parallel_mark @@ -325,7 +334,22 @@ AC_MSG_ERROR($THREADS is an unknown thread package) ;; esac + +# Check whether -lrt linker option is needed to use clock_gettime. +if test "x$need_lib_rt" != xtrue; then + AC_MSG_CHECKING(for clock_gettime without additional libraries) + AC_LINK_IFELSE(AC_LANG_PROGRAM(#include <time.h>, + struct timespec t; clock_gettime(CLOCK_REALTIME, &t)), + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + AC_CHECK_LIB(rt, clock_gettime, need_lib_rt=true)) +fi + +if test "x$need_lib_rt" = xtrue; then + THREADDLLIBS="$THREADDLLIBS -lrt" +fi
View file
_service:tar_scm:gc-8.0.6.tar.gz/cord/cord.am -> _service:tar_scm:gc-8.2.2.tar.gz/cord/cord.am
Changed
@@ -3,11 +3,11 @@ # 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 = 5:0:4 +LIBCORD_VER_INFO = 6:0:5 lib_LTLIBRARIES += libcord.la -libcord_la_LIBADD = $(top_builddir)/libgc.la +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.0.6.tar.gz/cord/cordbscs.c -> _service:tar_scm:gc-8.2.2.tar.gz/cord/cordbscs.c
Changed
@@ -816,20 +816,20 @@ if (cur_pos < end_pos) { /* Fill cache and return. */ size_t i; - size_t limit = cur_pos + FUNCTION_BUF_SZ; + size_t limit = FUNCTION_BUF_SZ; CORD_fn fn = f -> fn; void * client_data = f -> client_data; - if (limit > end_pos) { - limit = end_pos; + if (end_pos - cur_pos < FUNCTION_BUF_SZ) { + limit = end_pos - cur_pos; } - for (i = cur_pos; i < limit; i++) { - p0.function_bufi - cur_pos = - (*fn)(i - start_pos, client_data); + for (i = 0; i < limit; i++) { + p0.function_bufi = (*fn)(i + cur_pos - start_pos, + client_data); } p0.cur_start = cur_pos; p0.cur_leaf = p0.function_buf; - p0.cur_end = limit; + p0.cur_end = cur_pos + limit; return; } }
View file
_service:tar_scm:gc-8.0.6.tar.gz/cord/cordprnt.c -> _service:tar_scm:gc-8.2.2.tar.gz/cord/cordprnt.c
Changed
@@ -10,6 +10,7 @@ * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. */ + /* An sprintf implementation that understands cords. This is probably */ /* not terribly portable. It assumes an ANSI stdarg.h. It further */ /* assumes that I can make copies of va_list variables, and read */ @@ -43,19 +44,26 @@ #define CONV_RESULT_LEN 50 /* Maximum length of any */ /* conversion with default */ /* width and prec. */ +#if defined(CPPCHECK) +# define MACRO_BLKSTMT_BEGIN { +# define MACRO_BLKSTMT_END } +#else +# define MACRO_BLKSTMT_BEGIN do { +# define MACRO_BLKSTMT_END } while (0) +#endif -#define OUT_OF_MEMORY do { \ +#define OUT_OF_MEMORY MACRO_BLKSTMT_BEGIN \ if (CORD_oom_fn != 0) (*CORD_oom_fn)(); \ fprintf(stderr, "Out of memory\n"); \ abort(); \ - } while (0) + MACRO_BLKSTMT_END static int ec_len(CORD_ec x) { return (int)(CORD_len(x0.ec_cord) + (x0.ec_bufptr - x0.ec_buf)); } -/* Possible nonumeric precision values. */ +/* Possible non-numeric precision values. */ # define NONE -1 # define VARIABLE -2 /* Copy the conversion specification from CORD_pos into the buffer buf */ @@ -66,7 +74,7 @@ /* If width or prec is *, VARIABLE is assigned. */ /* Set *left to 1 if left adjustment flag is present. */ /* Set *long_arg to 1 if long flag ('l' or 'L') is present, or to */ -/* -1 if 'h' is present. */ +/* -1 if 'h' is present, or to 2 if 'z' is present. */ static int extract_conv_spec(CORD_pos source, char *buf, int * width, int *prec, int *left, int * long_arg) { @@ -121,6 +129,10 @@ *long_arg = 1; current_number = 0; break; + case 'z': + *long_arg = 2; + current_number = 0; + break; case 'h': *long_arg = -1; current_number = 0; @@ -225,6 +237,9 @@ int * pos_ptr; pos_ptr = va_arg(args, int *); *pos_ptr = ec_len(result); + } else if (long_arg == 2) { + size_t * pos_ptr = va_arg(args, size_t *); + *pos_ptr = (size_t)(unsigned)ec_len(result); } else if (long_arg > 0) { long * pos_ptr; pos_ptr = va_arg(args, long *); @@ -326,7 +341,9 @@ case 'c': if (long_arg <= 0) { (void) va_arg(args, int); - } else /* long_arg > 0 */ { + } else if (long_arg == 2) { + (void) va_arg(args, size_t); + } else /* long_arg == 1 */ { (void) va_arg(args, long); } break;
View file
_service:tar_scm:gc-8.0.6.tar.gz/cord/cordxtra.c -> _service:tar_scm:gc-8.2.2.tar.gz/cord/cordxtra.c
Changed
@@ -573,12 +573,14 @@ return(cl -> dataMOD_LINE_SZ(i)); } -void CORD_lf_close_proc(void * obj, void * client_data CORD_ATTR_UNUSED) -{ +#ifndef GC_NO_FINALIZATION + void CORD_lf_close_proc(void * obj, void * client_data CORD_ATTR_UNUSED) + { if (fclose(((lf_state *)obj) -> lf_file) != 0) { ABORT("CORD_lf_close_proc: fclose failed"); } -} + } +#endif CORD CORD_from_file_lazy_inner(FILE * f, size_t len) { @@ -604,7 +606,9 @@ state -> lf_cachei = 0; } state -> lf_current = 0; - GC_REGISTER_FINALIZER(state, CORD_lf_close_proc, 0, 0, 0); +# ifndef GC_NO_FINALIZATION + GC_REGISTER_FINALIZER(state, CORD_lf_close_proc, 0, 0, 0); +# endif return(CORD_from_fn(CORD_lf_func, state, len)); }
View file
_service:tar_scm:gc-8.0.6.tar.gz/cord/tests/cordtest.c -> _service:tar_scm:gc-8.2.2.tar.gz/cord/tests/cordtest.c
Changed
@@ -221,8 +221,10 @@ *(CORD volatile *)&w = CORD_EMPTY; *(CORD volatile *)&z = CORD_EMPTY; GC_gcollect(); - GC_invoke_finalizers(); +# ifndef GC_NO_FINALIZATION + GC_invoke_finalizers(); /* Of course, this does not guarantee the files are closed. */ +# endif if (remove(FNAME1) != 0) { /* On some systems, e.g. OS2, this may fail if f1 is still open. */ /* But we cannot call fclose as it might lead to double close. */ @@ -270,6 +272,8 @@ # endif #endif +/* no static */ /* no const */ char *zu_format = (char*)"%zu"; + void test_printf(void) { CORD result; @@ -277,14 +281,15 @@ long l = -1; short s = (short)-1; CORD x; + int res; if (CORD_sprintf(&result, "%7.2f%ln", 3.14159F, &l) != 7) ABORT("CORD_sprintf failed 1"); - if (CORD_cmp(result, " 3.14") != 0)ABORT("CORD_sprintf goofed 1"); + if (CORD_cmp(result, " 3.14") != 0) ABORT("CORD_sprintf goofed 1"); if (l != 7) ABORT("CORD_sprintf goofed 2"); if (CORD_sprintf(&result, "%-7.2s%hn%c%s", "abcd", &s, 'x', "yz") != 10) ABORT("CORD_sprintf failed 2"); - if (CORD_cmp(result, "ab xyz") != 0)ABORT("CORD_sprintf goofed 3"); + if (CORD_cmp(result, "ab xyz") != 0) ABORT("CORD_sprintf goofed 3"); if (s != 7) ABORT("CORD_sprintf goofed 4"); x = "abcdefghij"; x = CORD_cat(x,x); @@ -299,7 +304,26 @@ (void)sprintf(result2, "->%-120.78s!\n", CORD_to_char_star(x)); # endif result2sizeof(result2) - 1 = '\0'; - if (CORD_cmp(result, result2) != 0)ABORT("CORD_sprintf goofed 5"); + if (CORD_cmp(result, result2) != 0) ABORT("CORD_sprintf goofed 5"); + +# ifdef GC_SNPRINTF + /* Check whether "%zu" specifier is supported; pass the format */ + /* string via a variable to avoid a compiler warning if not. */ + res = GC_SNPRINTF(result2, sizeof(result2), zu_format, (size_t)0); +# else + res = sprintf(result2, zu_format, (size_t)0); +# endif + result2sizeof(result2) - 1 = '\0'; + if (res == 1) /* is "%z" supported by printf? */ { + if (CORD_sprintf(&result, "%zu %zd 0x%0zx", + (size_t)123, (size_t)4567, (size_t)0x4abc) != 15) + ABORT("CORD_sprintf failed 5"); + if (CORD_cmp(result, "123 4567 0x4abc") != 0) + ABORT("CORD_sprintf goofed 5"); + } else { + (void)CORD_printf("printf lacks support of 'z' modifier\n"); + } + /* TODO: Better test CORD_vfprintf. */ (void)CORD_printf(CORD_EMPTY); (void)wrap_vfprintf(stdout, CORD_EMPTY);
View file
_service:tar_scm:gc-8.0.6.tar.gz/cord/tests/de.c -> _service:tar_scm:gc-8.2.2.tar.gz/cord/tests/de.c
Changed
@@ -75,10 +75,18 @@ #endif #include "de_cmds.h" -#define OUT_OF_MEMORY do { \ +#if defined(CPPCHECK) +# define MACRO_BLKSTMT_BEGIN { +# define MACRO_BLKSTMT_END } +#else +# define MACRO_BLKSTMT_BEGIN do { +# define MACRO_BLKSTMT_END } while (0) +#endif + +#define OUT_OF_MEMORY MACRO_BLKSTMT_BEGIN \ fprintf(stderr, "Out of memory\n"); \ exit(3); \ - } while (0) + MACRO_BLKSTMT_END /* List of line number to position mappings, in descending order. */ /* There may be holes. */ @@ -375,7 +383,7 @@ } #if defined(WIN32) -# define beep() Beep(1000 /* Hz */, 300 /* msecs */) +# define beep() Beep(1000 /* Hz */, 300 /* ms */) #elif defined(MACINTOSH) # define beep() SysBeep(1) #else
View file
_service:tar_scm:gc-8.0.6.tar.gz/cord/tests/de_win.rc -> _service:tar_scm:gc-8.2.2.tar.gz/cord/tests/de_win.rc
Changed
@@ -4,8 +4,11 @@ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * - * Permission is hereby granted to copy this garbage collector for any purpose, - * provided the above notices are retained on all copies. + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ #include "windows.h"
View file
_service:tar_scm:gc-8.0.6.tar.gz/darwin_stop_world.c -> _service:tar_scm:gc-8.2.2.tar.gz/darwin_stop_world.c
Changed
@@ -73,12 +73,15 @@ __asm__ __volatile__ ("mov %0, x29\n" : "=r" (sp_reg)); frame = (StackFrame *)sp_reg; # else +# if defined(CPPCHECK) + GC_noop1((word)&frame); +# endif ABORT("GC_FindTopOfStack(0) is not implemented"); # endif } # ifdef DEBUG_THREADS_EXTRA - GC_log_printf("FindTopOfStack start at sp = %p\n", (void *)frame); + GC_log_printf("FindTopOfStack start at sp= %p\n", (void *)frame); # endif while (frame->savedSP != 0) { /* if there are no more stack frames, stop */ @@ -92,7 +95,7 @@ break; /* if the next LR is bogus, stop */ } # ifdef DEBUG_THREADS_EXTRA - GC_log_printf("FindTopOfStack finish at sp = %p\n", (void *)frame); + GC_log_printf("FindTopOfStack finish at sp= %p\n", (void *)frame); # endif return (ptr_t)frame; } @@ -204,7 +207,7 @@ } while (kern_result == KERN_ABORTED); } # ifdef DEBUG_THREADS - GC_log_printf("thread_get_state returns value = %d\n", kern_result); + GC_log_printf("thread_get_state returns %d\n", kern_result); # endif if (kern_result != KERN_SUCCESS) ABORT("thread_get_state failed"); @@ -234,7 +237,7 @@ GC_push_one(state.THREAD_FLD(rdi)); GC_push_one(state.THREAD_FLD(rsi)); GC_push_one(state.THREAD_FLD(rbp)); - /* GC_push_one(state.THREAD_FLD(rsp)); */ + /* rsp is skipped. */ GC_push_one(state.THREAD_FLD(r8)); GC_push_one(state.THREAD_FLD(r9)); GC_push_one(state.THREAD_FLD(r10)); @@ -250,6 +253,7 @@ *phi = GC_FindTopOfStack(state.THREAD_FLD(r1)); # endif GC_push_one(state.THREAD_FLD(r0)); + /* r1 is skipped. */ GC_push_one(state.THREAD_FLD(r2)); GC_push_one(state.THREAD_FLD(r3)); GC_push_one(state.THREAD_FLD(r4)); @@ -337,7 +341,7 @@ *paltstack_lo = NULL; } # ifdef DEBUG_THREADS - GC_log_printf("Darwin: Stack for thread %p = %p,%p)\n", + GC_log_printf("Darwin: Stack for thread %p is %p,%p)\n", (void *)(word)thread, (void *)lo, (void *)(*phi)); # endif return lo; @@ -660,6 +664,9 @@ struct thread_basic_info info; mach_msg_type_number_t outCount = THREAD_BASIC_INFO_COUNT; +# ifdef CPPCHECK + info.run_state = 0; +# endif kern_result = thread_info(thread, THREAD_BASIC_INFO, (thread_info_t)&info, &outCount); if (kern_result != KERN_SUCCESS)
View file
_service:tar_scm:gc-8.0.6.tar.gz/dbg_mlc.c -> _service:tar_scm:gc-8.2.2.tar.gz/dbg_mlc.c
Changed
@@ -247,24 +247,23 @@ out:; } - /* Force a garbage collection and generate/print a backtrace */ - /* from a random heap address. */ - GC_INNER void GC_generate_random_backtrace_no_gc(void) - { - void * current; - current = GC_generate_random_valid_address(); - GC_printf("\n****Chosen address %p in object\n", current); - GC_print_backtrace(current); - } - GC_API void GC_CALL GC_generate_random_backtrace(void) { + void *current; + DCL_LOCK_STATE; + if (GC_try_to_collect(GC_never_stop_func) == 0) { GC_err_printf("Cannot generate a backtrace: " "garbage collection is disabled!\n"); return; } - GC_generate_random_backtrace_no_gc(); + + /* Generate/print a backtrace from a random heap address. */ + LOCK(); + current = GC_generate_random_valid_address(); + UNLOCK(); + GC_printf("\n****Chosen address %p in object\n", current); + GC_print_backtrace(current); } #endif /* KEEP_BACK_PTRS */ @@ -414,14 +413,14 @@ } if (NULL != kind_str) { - GC_err_printf("%p (%s:%d," IF_NOT_SHORTDBG_HDRS(" sz=%lu,") " %s)\n", + GC_err_printf("%p (%s:%d," IF_NOT_SHORTDBG_HDRS(" sz= %lu,") " %s)\n", (void *)((ptr_t)ohdr + sizeof(oh)), ohdr->oh_string, GET_OH_LINENUM(ohdr) /*, */ COMMA_IFNOT_SHORTDBG_HDRS((unsigned long)ohdr->oh_sz), kind_str); } else { - GC_err_printf("%p (%s:%d," IF_NOT_SHORTDBG_HDRS(" sz=%lu,") - " kind=%d descr=0x%lx)\n", + GC_err_printf("%p (%s:%d," IF_NOT_SHORTDBG_HDRS(" sz= %lu,") + " kind= %d, descr= 0x%lx)\n", (void *)((ptr_t)ohdr + sizeof(oh)), ohdr->oh_string, GET_OH_LINENUM(ohdr) /*, */ COMMA_IFNOT_SHORTDBG_HDRS((unsigned long)ohdr->oh_sz), @@ -456,11 +455,11 @@ if ((word)clobbered_addr <= (word)(&ohdr->oh_sz) || ohdr -> oh_string == 0) { GC_err_printf( - "%s %p in or near object at %p(<smashed>, appr. sz = %lu)\n", + "%s %p in or near object at %p(<smashed>, appr. sz= %lu)\n", msg, (void *)clobbered_addr, p, (unsigned long)(GC_size((ptr_t)ohdr) - DEBUG_BYTES)); } else { - GC_err_printf("%s %p in or near object at %p (%s:%d, sz=%lu)\n", + GC_err_printf("%s %p in or near object at %p (%s:%d, sz= %lu)\n", msg, (void *)clobbered_addr, p, (word)(ohdr -> oh_string) < HBLKSIZE ? "(smashed string)" : ohdr -> oh_string0 == '\0' ? "EMPTY(smashed?)" : @@ -489,9 +488,16 @@ GC_print_heap_obj = GC_debug_print_heap_obj_proc; GC_debugging_started = TRUE; GC_register_displacement_inner((word)sizeof(oh)); +# if defined(CPPCHECK) + GC_noop1(GC_debug_header_size); +# endif } -size_t GC_debug_header_size = sizeof(oh); +const size_t GC_debug_header_size = sizeof(oh); + +GC_API size_t GC_CALL GC_get_debug_header_size(void) { + return sizeof(oh); +} GC_API void GC_CALL GC_debug_register_displacement(size_t offset) { @@ -532,7 +538,13 @@ /* Note that according to malloc() specification, if size is 0 then */ /* malloc() returns either NULL, or a unique pointer value that can */ /* later be successfully passed to free(). We always do the latter. */ - result = GC_malloc(SIZET_SAT_ADD(lb, DEBUG_BYTES)); +# if defined(_FORTIFY_SOURCE) && !defined(__clang__) + /* Workaround to avoid "exceeds maximum object size" gcc warning. */ + result = GC_malloc(lb < GC_SIZE_MAX - DEBUG_BYTES ? lb + DEBUG_BYTES + : GC_SIZE_MAX >> 1); +# else + result = GC_malloc(SIZET_SAT_ADD(lb, DEBUG_BYTES)); +# endif # ifdef GC_ADD_CALLER if (s == NULL) { GC_caller_func_offset(ra, &s, &i); @@ -612,13 +624,15 @@ } #endif /* DBG_HDRS_ALL */ -GC_API void * GC_CALL GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS) -{ +#ifndef CPPCHECK + GC_API void * GC_CALL GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS) + { return GC_debug_malloc(lb, OPT_RA s, i); -} + } -GC_API void GC_CALL GC_debug_change_stubborn( + GC_API void GC_CALL GC_debug_change_stubborn( const void * p GC_ATTR_UNUSED) {} +#endif /* !CPPCHECK */ GC_API void GC_CALL GC_debug_end_stubborn_change(const void *p) { @@ -768,7 +782,7 @@ ptr_t clobbered = GC_check_annotated_obj((oh *)base); word sz = GC_size(base); if (clobbered != 0) { - GC_have_errors = TRUE; + GC_SET_HAVE_ERRORS(); /* no "release" barrier is needed */ if (((oh *)base) -> oh_sz == sz) { GC_print_smashed_obj( "GC_debug_free: found previously deallocated (?) object at", @@ -781,7 +795,7 @@ } /* Invalidate size (mark the object as deallocated) */ ((oh *)base) -> oh_sz = sz; -# endif /* SHORT_DBG_HDRS */ +# endif /* !SHORT_DBG_HDRS */ } if (GC_find_leak # ifndef SHORT_DBG_HDRS @@ -933,7 +947,7 @@ if (GC_n_smashed < MAX_SMASHED - 1) ++GC_n_smashed; /* In case of overflow, we keep the first MAX_SMASHED-1 */ /* entries plus the last one. */ - GC_have_errors = TRUE; + GC_SET_HAVE_ERRORS(); } /* Print all objects on the list. Clear the list. */ @@ -1084,7 +1098,7 @@ void * *ocd) { GC_finalization_proc my_old_fn = OFN_UNSET; - void * my_old_cd; + void * my_old_cd = NULL; /* to avoid "might be uninitialized" warning */ ptr_t base = (ptr_t)GC_base(obj); if (NULL == base) { /* We won't collect it, hence finalizer wouldn't be run. */ @@ -1100,7 +1114,7 @@ GC_register_finalizer(base, 0, 0, &my_old_fn, &my_old_cd); } else { cd = GC_make_closure(fn, cd); - if (cd == 0) return; /* out of memory */ + if (cd == 0) return; /* out of memory; *ofn and *ocd are unchanged */ GC_register_finalizer(base, GC_debug_invoke_finalizer, cd, &my_old_fn, &my_old_cd); } @@ -1113,7 +1127,7 @@ void * *ocd) { GC_finalization_proc my_old_fn = OFN_UNSET; - void * my_old_cd; + void * my_old_cd = NULL; ptr_t base = (ptr_t)GC_base(obj); if (NULL == base) { /* We won't collect it, hence finalizer wouldn't be run. */ @@ -1142,7 +1156,7 @@ void * *ocd) { GC_finalization_proc my_old_fn = OFN_UNSET; - void * my_old_cd; + void * my_old_cd = NULL; ptr_t base = (ptr_t)GC_base(obj); if (NULL == base) { /* We won't collect it, hence finalizer wouldn't be run. */ @@ -1171,7 +1185,7 @@ void * *ocd) { GC_finalization_proc my_old_fn = OFN_UNSET; - void * my_old_cd; + void * my_old_cd = NULL; ptr_t base = (ptr_t)GC_base(obj); if (NULL == base) { /* We won't collect it, hence finalizer wouldn't be run. */
View file
_service:tar_scm:gc-8.0.6.tar.gz/depcomp -> _service:tar_scm:gc-8.2.2.tar.gz/depcomp
Changed
@@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2013-05-30.07; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -783,9 +783,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End:
View file
_service:tar_scm:gc-8.0.6.tar.gz/digimars.mak -> _service:tar_scm:gc-8.2.2.tar.gz/digimars.mak
Changed
@@ -22,6 +22,7 @@ fnlz_mlc.obj\ dyn_load.obj\ finalize.obj\ + gc_badalc.obj\ gc_cpp.obj\ gcj_mlc.obj\ headers.obj\ @@ -39,7 +40,13 @@ typd_mlc.obj\ win32_threads.obj -targets: gc.dll gc.lib gctest.exe test_cpp.exe +targets: gc.dll gc.lib + +check: gctest.exe test_cpp.exe + gctest.exe + test_cpp.exe + +gc.lib: gc.dll gc.dll: $(OBJS) gc.def digimars.mak $(CC) -ogc.dll $(OBJS) -L$(LFLAGS) gc.def kernel32.lib user32.lib @@ -77,6 +84,7 @@ dyn_load.obj: dyn_load.c finalize.obj: finalize.c fnlz_mlc.obj: fnlz_mlc.c +gc_badalc.obj: gc_badalc.cc gc_badalc.cpp gc_cpp.obj: gc_cpp.cc gc_cpp.cpp headers.obj: headers.c mach_dep.obj: mach_dep.c
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.Mac -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.Mac
Changed
@@ -3,7 +3,7 @@ --------------------------------------------- -Patrick Beard's Notes for building GC v4.12 with CodeWarrior Pro 2: +Patrick Beard's Notes for building GC with CodeWarrior Pro 2: ---------------------------------------------------------------------------- The current build environment for the collector is CodeWarrior Pro 2. Projects for CodeWarrior Pro 2 (and for quite a few older versions) @@ -24,15 +24,10 @@ porting instructions in pure TEXT form to avoid those problems. A manual 'makefile' if you like. - GC version: 4.12a2 Codewarrior: CWPro1 date: 18 July 1997 -The notes may or may not apply to earlier or later versions of the -GC/CWPro. Actually, they do apply to earlier versions of both except that -until recently a project could only build one target so each target was a -separate project. The notes will most likely apply to future versions too. -Possibly with minor tweaks. +The notes may or may not apply to earlier or later versions of the CWPro. This is just to record my experiences. These notes do not mean I now provide a supported port of the GC to MacOS. It works for me. If it works @@ -204,9 +199,10 @@ checksums.c dbg_mlc.c finalize.c + fnlz_mlc.c headers.c mach_dep.c - MacOS.c -- contains MacOS code + extra/MacOS.c -- contains MacOS code malloc.c mallocx.c mark.c @@ -218,9 +214,8 @@ ptr_chck.c reclaim.c typd_mlc.c - gc++.cc -- this is 'gc_cpp.cc' with less 'inline' and - -- throw std::bad_alloc when out of memory - -- gc_cpp.cc works just fine too + gc_badalc.cc + gc_cpp.cc == 2. Test that the library works with 'test.c' == @@ -291,7 +286,7 @@ Patrick Beard's instructions (may be dated): -v4.3 of the collector now runs under Symantec C++/THINK C v7.0.4, and +The collector should run under Symantec C++/THINK C v7.0.4, and Metrowerks C/C++ v4.5 both 68K and PowerPC. Project files are provided to build and test the collector under both development systems. @@ -315,7 +310,7 @@ systems are provided. For Symantec C++/THINK C, you must build the two projects gclib-1 and -gclib-2. It has to be split up because the collector has more than 32k +gclib-2. It has to be split up because the collector has more than 32 KB of static data and no library can have more than this in the Symantec environment. (Future versions will probably fix this.)
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.amiga -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.amiga
Changed
@@ -24,7 +24,7 @@ Programs using more time actually using the memory allocated (instead of just allocate and free rapidly) have the most to earn on this, but even gctest now normally runs twice - as fast and uses less memory, on my poor 8MB machine. + as fast and uses less memory, on my poor 8 MB machine. The changes have only effect when there is no more fast-mem left. But with the way GC works, it @@ -187,18 +187,16 @@ In addition to Jesper's notes, I have the following to say: -- Starting with version 4.3, gctest checks to see if the code segment is - added to the root set or not, and complains if it is. Previous versions - of this Amiga port added the code segment to the root set, so I tried to - fix that. The only problem is that, as far as I know, it is impossible to - know which segments are code segments and which are data segments (there - are indeed solutions to this problem, like scanning the program on disk - or patch the LoadSeg functions, but they are rather complicated). The - solution I have chosen (see os_dep.c) is to test whether the program - counter is in the segment we are about to add to the root set, and if it - is, to skip the segment. The problems are that this solution is rather - awkward and that it works only for one code segment. This means that if - your program has more than one code segment, all of them but one will be +- gctest checks to see if the code segment is added to the root set or not, + and complains if it is. The only problem is that, as far as I know, it is + impossible to know which segments are code segments and which are data + segments (there are indeed solutions to this problem, like scanning the + program on disk or patch the LoadSeg functions, but they are rather + complicated). The solution I have chosen (see os_dep.c) is to test whether + the program counter is in the segment we are about to add to the root set, + and if it is, to skip the segment. The problems are that this solution is + rather awkward and that it works only for one code segment. This means that + if your program has more than one code segment, all of them but one will be added to the root set. This isn't a big problem in fact, since the collector will continue to work correctly, but it may be slower. @@ -281,8 +279,6 @@ The library as it stands is compatible with the GigaMem commercial virtual memory software, and probably similar PD software. -The performance of "gctest" on an Amiga 2630 (68030 @ 25Mhz) +The performance of "gctest" on an Amiga 2630 (68030 @ 25 MHz) compares favorably with an HP9000 with similar architecture (a 325 with a 68030 I think). - ------------------------------------------------------------------------
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.arm.cross -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.arm.cross
Changed
@@ -7,21 +7,21 @@ The badge4 has a StrongArm-1110 processor and a StrongArm-1111 coprocessor. -Assume that the garbage collector distribution is unpacked into /home/arm/gc6.0, +Assume that the garbage collector distribution is unpacked into /home/arm/gc, which is visible to both the ARM machine and a linux desktop (e.g. via NFS mounting). Assume that you have a file /home/arm/config.site with contents something like the example attached below. Notice that our local ARM toolchain lives in /skiff/local. -Go to /home/arm/gc6.0 directory. Do +Go to /home/arm/gc directory. Do CONFIG_SITE=/home/arm/config.site ./configure --target=arm-linux ---prefix=/home/arm/gc6.0 +--prefix=/home/arm/gc On your desktop, do: make make install -The main garbage collector library should now be in ../gc6.0/lib/libgc.so. +The main garbage collector library should now be in ../gc/lib/libgc.so. To test the garbage collector, first do the following on your desktop make gctest @@ -30,7 +30,7 @@ cd .libs ./lt-gctest -Do not try to do "make test" (the usual way of running the test +Do not try to do "make check" (the usual way of running the test program). This does not work and seems to erase some of the important files.
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.autoconf -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.autoconf
Changed
@@ -1,6 +1,5 @@ -Starting from GC v6.0, we support GNU-style builds based on automake, -autoconf and libtool. This is based almost entirely on Tom Tromey's work -with gcj. +We support GNU-style builds based on automake, autoconf and libtool. +This is based almost entirely on Tom Tromey's work with gcj. To build and install libraries use @@ -52,8 +51,9 @@ Unless --prefix is set (or --exec-prefix or one of the more obscure options), -make install will install libgc.a and libgc.so in /usr/local/bin, which -would typically require the "make install" to be run as root. +"make install" will install libgc.a and libgc.so in /usr/local/lib and +/usr/local/bin, respectively, which would typically require the "make install" +to be run as root. It is not recommended to turn off parallel marking for multiprocessors unless a poor support of the feature on the platform.
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.cmake -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.cmake
Changed
@@ -2,27 +2,22 @@ CMAKE ----- -Win32 binaries (both 32- and 64-bit) can be built using CMake. CMake is an -open-source tool like automake - it generates makefiles. - -Some preliminary work has been done to make this work on other platforms, but -the support is not yet complete. - -CMake will generate: +Unix and Win32 binaries (both 32- and 64-bit) can be built using CMake. +CMake is an open-source tool like automake - it generates makefiles. +CMake v3.14.5 is able to generate: Borland Makefiles MSYS Makefiles MinGW Makefiles NMake Makefiles Unix Makefiles - . Visual Studio project files - Visual Studio 6 - Visual Studio 7 - Visual Studio 7 .NET 2003 - Visual Studio 8 2005 - Visual Studio 8 2005 Win64 - Visual Studio 9 2008 - Visual Studio 9 2008 Win64 + Visual Studio 16 2019 + Visual Studio 15 2017 + Visual Studio 14 2015 + Visual Studio 12 2013 + Visual Studio 11 2012 + Visual Studio 10 2010 + Visual Studio 9 2008 Watcom WMake @@ -33,18 +28,35 @@ . add directory containing cmake.exe to %PATH% . run cmake from the gc root directory, passing the target with -G: e.g., - > cmake -G "Visual Studio 8 2005" + > cmake -G "Visual Studio 9 2008" . use the gc.sln file generated by cmake to build gc + . specify -Denable_cplusplus=ON option to build gccpp (GC C++ support) + . specify -Dbuild_tests=ON option to the tests (and run them by "ctest -V") . you can also run cmake from a build directory to build outside of the source tree. Just specify the path to the source tree: e.g., - > mkdir build - > cd build - > cmake .. -G "Visual Studio 8 2005" + > mkdir out + > cd out + > cmake -G "Visual Studio 9 2008" .. + > cmake --build . --config Release + > ctest --build-config Release -V INPUT ----- -The main input to cmake are the CMakeLists.txt files in each directory. For +The main input to cmake is CMakeLists.txt file in the GC root directory. For help, go to cmake.org. + + +HOW TO IMPORT BDWGC +------------------- + +Another project could add bdwgc as one of its dependencies with something like +this in their CMakeLists.txt: + +find_package(BDWgc 8.2.2 REQUIRED) +add_executable(Foo foo.c) +target_link_libraries(Foo BDWgc::gc) + +Other exported libraries are: cord, gccpp, gctba.
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.cords -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.cords
Changed
@@ -36,7 +36,7 @@ arguments. Note that ^R^N and ^R^P move the cursor by almost a screen. It does not understand tabs, which will show up as highlighted "I"s. Use the UNIX "expand" program first.) -To build the editor, type "make cord/de" in the gc directory. +To build the editor, type "make de" in the gc directory. Note that CORD_printf and friends use C functions with variable numbers of arguments in non-standard-conforming ways. This code is known to
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.darwin -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.darwin
Changed
@@ -11,18 +11,18 @@ == Important Usage Notes == -GC_init() MUST be called before calling any other GC functions. This +GC_INIT() MUST be called before calling any other GC functions. This is necessary to properly register segments in dynamic libraries. This call is required even if you code does not use dynamic libraries as the dyld code handles registering all data segments. When your use of the garbage collector is confined to dylibs and you -cannot call GC_init() before your libraries' static initializers have +cannot call GC_INIT() before your libraries' static initializers have run and perhaps called GC_malloc(), create an initialization routine -for each library to call GC_init(): +for each library to call GC_INIT(), e.g.: #include "gc.h" -extern "C" void my_library_init() { GC_init(); } +extern "C" void my_library_init() { GC_INIT(); } Compile this code into a my_library_init.o, and link it into your dylib. When you link the dylib, pass the -init argument with @@ -31,10 +31,10 @@ my_library_init() to be called before any static initializers, and will initialize the garbage collector properly. -Note: It doesn't hurt to call GC_init() more than once, so it's best, +Note: It doesn't hurt to call GC_INIT() more than once, so it's best, if you have an application or set of libraries that all use the garbage collector, to create an initialization routine for each of -them that calls GC_init(). Better safe than sorry. +them that calls GC_INIT(). Better safe than sorry. Thread-local GC allocation will not work with threads that are not created using the GC-provided override of pthread_create(). Threads
View file
_service:tar_scm:gc-8.2.2.tar.gz/doc/README.emscripten
Added
@@ -0,0 +1,15 @@ + +The build system (at least autotools-based) should detect and configure +emscripten correctly. + +As of now, gctest almost passes, except for the tests that involve a_get(). + +No thread support for now. No idea how to stop other threads (perhaps we need +support from JS side). + +How to build: + + # source EMSDK first + emconfigure ./configure + emmake make gctest.html + # point your browser at .libs/gctest.html
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.environment -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.environment
Changed
@@ -104,13 +104,13 @@ was turned into a runtime flag to enable last-minute work-arounds. "0" value means "do not retry signals". -GC_USE_GETWRITEWATCH=<n> - Only if MPROTECT_VDB and GWW_VDB are both defined - (Win32 only). Explicitly specify which strategy of - keeping track of dirtied pages should be used. - If n=0 then GetWriteWatch() is not used (falling back to - protecting pages and catching memory faults strategy) - else the collector tries to use GetWriteWatch-based - strategy (GWW_VDB) first if available. +GC_USE_GETWRITEWATCH=<n> - Only if MPROTECT_VDB and (GWW_VDB or SOFT_VDB) are + both defined (Win32 and Linux only). Explicitly specify + which strategy of keeping track of dirtied pages should + be used. If n=0, then fall back to protecting pages and + catching memory faults strategy), else the collector + tries to use GetWriteWatch-based strategy (GWW_VDB) or + soft-dirty bits strategy (SOFT_VDB) first if available. GC_DISABLE_INCREMENTAL - Ignore runtime requests to enable incremental GC. Useful for debugging. @@ -127,17 +127,17 @@ to be transparent, it may cause unintended system call failures. Use with caution. -GC_PAUSE_TIME_TARGET - Set the desired garbage collector pause time in msecs. - This only has an effect if incremental collection is - enabled. If a collection requires appreciably more time - than this, the client will be restarted, and the collector - will need to do additional work to compensate. The - special value "999999" indicates that pause time is - unlimited, and the incremental collector will behave - completely like a simple generational collector. If - the collector is configured for parallel marking, and - run on a multiprocessor, incremental collection should - only be used with unlimited pause time. +GC_PAUSE_TIME_TARGET - Set the desired garbage collector pause time in + milliseconds (ms). This only has an effect if incremental + collection is enabled. If a collection requires + appreciably more time than this, the client will be + restarted, and the collector will need to do additional + work to compensate. The special value "999999" indicates + that pause time is unlimited, and the incremental + collector will behave completely like a simple + generational collector. Any value, except for the given + special one, disables parallel marker (almost fully) for + now. GC_FULL_FREQUENCY - Set the desired number of partial collections between full collections. Matters only if GC_incremental is set.
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.hp -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.hp
Changed
@@ -15,4 +15,4 @@ work in combination with it. The stack finding code can be confused by putenv calls before collector -initialization. Call GC_malloc or GC_init before any putenv calls. +initialization. Call GC_malloc() or GC_INIT() before any putenv() calls.
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.linux -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.linux
Changed
@@ -1,7 +1,7 @@ See README.alpha for Linux on DEC AXP info. -This file applies mostly to Linux/Intel IA32. Ports to Linux on an M68K, -IA64, SPARC, MIPS, Alpha and PowerPC are integrated too. They should behave +This file applies mostly to Linux/Intel IA-32. Ports to Linux on an M68K, +IA-64, SPARC, MIPS, Alpha and PowerPC are integrated too. They should behave similarly, except that the PowerPC port lacks incremental GC support, and it is unknown to what extent the Linux threads code is functional. See below for M68K specific notes. @@ -26,11 +26,11 @@ MIT pthreads). 2) You must compile the collector with "-DGC_THREADS -D_REENTRANT" specified - in the Makefile. + in the Makefile.direct file. 3a) Every file that makes thread calls should define GC_THREADS, and then - include gc.h. Gc.h redefines some of the pthread primitives as macros - which also provide the collector with information it requires. + include gc.h. The latter redefines some of the pthread primitives as + macros which also provide the collector with information it requires. 3b) A new alternative to (3a) is to build the collector and compile GC clients with -DGC_USE_LD_WRAP, and to link the final program with @@ -60,9 +60,9 @@ collector. This probably depends on the linuxthreads version. For the time being, any collectible memory referenced by thread local storage should also be referenced from elsewhere, or be allocated as uncollectible. - (This is really a bug that should be fixed somehow. The current GC - version probably gets things right if there are not too many tls locations - and if dlopen is not used.) + (This is really a bug that should be fixed somehow. Actually, the + collector probably gets things right, on Linux at least, if there are not + too many tls locations and if dlopen is not used.) M68K LINUX:
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.macros -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.macros
Changed
@@ -87,12 +87,17 @@ dynamic libraries are used, but the collector is in a static library. Tested by gc_config_macros.h. -GC_REQUIRE_WCSDUP Force GC to export GC_wcsdup() (the Unicode version - of GC_strdup); could be useful in the leak-finding mode. +GC_MARKERS=<n> Set the desired number of marker threads. If not defined or + defined to zero, then the collector decides based on the + number of CPU cores. Only if compiled with PARALLEL_MARK. These define arguments influence the collector configuration: +GC_REQUIRE_WCSDUP Force GC to export GC_wcsdup() (the Unicode version + of GC_strdup); could be useful in the leak-finding mode. Clients should + define it before including gc.h if the function is needed. + FIND_LEAK Causes GC_find_leak to be initially set. This causes the collector to assume that all inaccessible objects should have been explicitly deallocated, and reports exceptions. Finalization and the test @@ -109,19 +114,18 @@ SUNOS5SIGS Solaris-like signal handling. This is probably misnamed, since it really doesn't guarantee much more than POSIX. Currently set only - for Solaris2.X, HPUX, and DRSNX. Should probably be set for some other - platforms. + for DRSNX, FreeBSD, HP/UX and Solaris. PCR Set if the collector is being built as part of the Xerox Portable Common Runtime. -IMPORTANT: Any of the _THREADS options must normally also be defined in - the client before including gc.h. This redefines thread primitives to - invoke the GC_ versions instead. Alternatively, linker-based symbol - interception can be used on a few platforms. - GC_THREADS Should set the appropriate one of the below macros, except GC_WIN32_PTHREADS, which must be set explicitly. Tested by gc.h. + IMPORTANT: GC_THREADS macro (or the relevant platform-specific deprecated + one) must normally also be defined by the client before including gc.h. + This redefines thread primitives to invoke the GC_ wrappers instead. + Alternatively, linker-based symbol interception can be used on a few + platforms. GC_SOLARIS_THREADS Enables support for Solaris pthreads. Must also define _REENTRANT. Deprecated, use GC_THREADS instead. @@ -159,8 +163,7 @@ See README.DGUX386. (Probably has not been tested recently.) Deprecated, use GC_THREADS instead. -GC_WIN32_THREADS Enables support for Win32 threads. That makes sense - for Makefile (and Makefile.direct) only under Cygwin or MinGW. Deprecated, +GC_WIN32_THREADS Enables support for Win32 threads. Deprecated, use GC_THREADS instead. GC_WIN32_PTHREADS Enables support for pthreads-win32 (or other @@ -187,9 +190,9 @@ GC_DISABLE_INCREMENTAL Turn off the incremental collection support. -NO_INCREMENTAL Causes the gctest program to not invoke the incremental - collector. This has no impact on the generated library, only on the test - program. (This is often useful for debugging failures unrelated to +NO_INCREMENTAL Causes the GC test programs to not invoke the incremental mode + of the collector. This has no impact on the generated library, only on the + test programs. (This is often useful for debugging failures unrelated to incremental GC.) LARGE_CONFIG Tunes the collector for unusually large heaps. @@ -215,7 +218,7 @@ execute permission is required. GC_NO_OPERATOR_NEW_ARRAY Declares that the C++ compiler does not - support the new syntax "operator new" for allocating and deleting arrays. + support the new syntax "operator new" for allocating and deleting arrays. See gc_cpp.h for details. No effect on the C part of the collector. This is defined implicitly in a few environments. Must also be defined by clients that use gc_cpp.h. @@ -262,17 +265,16 @@ (Might be useful for application debugging or in find-leak mode.) JAVA_FINALIZATION Makes it somewhat safer to finalize objects out of - order by specifying a nonstandard finalization mark procedure (see + order by specifying a nonstandard finalization mark procedure (see finalize.c). Objects reachable from finalizable objects will be marked in a separate post-pass, and hence their memory won't be reclaimed. Not recommended unless you are implementing a language that specifies - these semantics. Since 5.0, determines only the initial value + these semantics. Actually, the macro determines only the initial value of GC_java_finalization variable. FINALIZE_ON_DEMAND Causes finalizers to be run only in response - to explicit GC_invoke_finalizers() calls. - In 5.0 this became runtime adjustable, and this only determines the - initial value of GC_finalize_on_demand. + to explicit GC_invoke_finalizers() calls. Actually, the macro only + determines the initial value of GC_finalize_on_demand. GC_NO_FINALIZATION Exclude finalization support (for smaller code size). @@ -302,9 +304,7 @@ Works for Linux, FreeBSD, Cygwin, Solaris and Irix. USE_MUNMAP Causes memory to be returned to the OS under the right - circumstances. This currently disables VM-based incremental collection - (except for Win32 with GetWriteWatch() available). - Works under some Unix, Linux and Windows versions. + circumstances. Works under some Unix, Linux and Windows versions. Requires USE_MMAP except for Windows. USE_WINALLOC (Cygwin only) Use Win32 VirtualAlloc (instead of sbrk or mmap) @@ -332,9 +332,9 @@ for debugging/profiling purposes. The gc_backptr.h interface is implemented only if this is defined. -GC_ASSERTIONS Enable some internal GC assertion checking. Currently - this facility is only used in a few places. It is intended primarily - for debugging of the garbage collector itself, but could also... +GC_ASSERTIONS Enable some internal GC assertion checking. It is intended + primarily for debugging of the garbage collector itself, but could also + help to identify cases of incorrect GC usage by a client. DBG_HDRS_ALL Make sure that all objects have debug headers. Increases the reliability (from 99.9999% to 100% mod. bugs) of some of the debugging @@ -355,10 +355,10 @@ SAVE_CALL_COUNT=<n> Set the number of call frames saved with objects allocated through the debugging interface. Affects the amount of information generated in leak reports. Only matters on platforms - on which we can quickly generate call stacks, currently Linux/(X86 & SPARC) - and Solaris/SPARC and platforms that provide execinfo.h. - Default is zero. On X86, client - code should NOT be compiled with -fomit-frame-pointer. + on which we can quickly generate call stacks, currently Linux/X86, + Linux/SPARC, Solaris/SPARC, and platforms that provide execinfo.h. + Default is zero. On X86, client code should NOT be compiled with + -fomit-frame-pointer. SAVE_CALL_NARGS=<n> Set the number of functions arguments to be saved with each call frame. Default is zero. Ignored if we don't know how to @@ -372,13 +372,11 @@ that include a pointer to a type descriptor in each allocated object). USE_I686_PREFETCH Causes the collector to issue Pentium III style - prefetch instructions. No effect except on X86 Linux platforms. - Assumes a very recent gcc-compatible compiler and assembler. - (Gas prefetcht0 support was added around May 1999.) + prefetch instructions. No effect except on Linux/X86 platforms. Empirically the code appears to still run correctly on Pentium II processors, though with no performance benefit. May not run on other - X86 processors? In some cases this improves performance by - 15% or so. + X86 processors probably. In some cases this improves performance by 15% + or so. USE_3DNOW_PREFETCH Causes the collector to issue AMD 3DNow style prefetch instructions. Same restrictions as USE_I686_PREFETCH. @@ -401,8 +399,7 @@ THREAD_LOCAL_ALLOC Defines GC_malloc(), GC_malloc_atomic() and GC_gcj_malloc() to use a per-thread set of free-lists. These then allocate in a way that usually does not involve acquisition of a global lock. - Recommended for multiprocessors. Requires explicit GC_INIT() call, unless - REDIRECT_MALLOC is defined and GC_malloc is used first. + Recommended for multiprocessors. USE_COMPILER_TLS Causes thread local allocation to use the compiler-supported "__thread" thread-local variables. This is the @@ -415,11 +412,10 @@ PARALLEL_MARK Allows the marker to run in multiple threads. Recommended for multiprocessors. -GC_BUILTIN_ATOMIC Use C11 (GCC) atomic intrinsics instead of - libatomic_ops primitives. +GC_BUILTIN_ATOMIC Use GCC atomic intrinsics instead of libatomic_ops + primitives. GC_ALWAYS_MULTITHREADED Force multi-threaded mode at GC initialization. - (Turns GC_allow_register_threads into a no-op routine.) GC_ENABLE_SUSPEND_THREAD (Linux only) Turn on thread suspend/resume API support. @@ -534,13 +530,18 @@ causes the exported symbols to have 'default' visibility (ignored unless GCC v4+) and the internal ones to have 'hidden' visibility. +NO_MSGBOX_ON_ERROR (Win32 only) Do not show Windows message box with + "OK" button on a GC fatal error. Otherwise the client application is + terminated only once the user clicks "OK" button. Useful for non-GUI (or + non-interactive) applications. + DONT_USE_USER32_DLL (Win32 only) Don't use "user32" DLL import library (containing MessageBox() entry); useful for a static GC library. GC_PREFER_MPROTECT_VDB Choose MPROTECT_VDB manually in case of multiple - virtual dirty bit strategies are implemented (at present useful on Win32 and - Solaris to force MPROTECT_VDB strategy instead of the default GWW_VDB or - PROC_VDB ones). + virtual dirty bit strategies are implemented (at present useful on Win32, + Solaris and Linux to force MPROTECT_VDB strategy instead of the default + GWW_VDB, PROC_VDB or SOFT_VDB ones, respectively).
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.sgi -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.sgi
Changed
@@ -2,18 +2,17 @@ -DNO_EXECUTE_PERMISSION. The collector should run with all of the -32, -n32 and -64 ABIs. Remember to -define the AS macro in the Makefile to be "as -64", or "as -n32". +define the AS macro in the Makefile.direct to be "as -64", or "as -n32". If you use -DREDIRECT_MALLOC=GC_malloc with C++ code, your code should make at least one explicit call to malloc instead of new to ensure that the proper version of malloc is linked in. -Sproc threads are not supported in this version, though there may exist other -ports. +Sproc threads are not supported. Pthreads support is provided. This requires that: -1) You compile the collector with -DGC_THREADS specified in the Makefile. +1) You compile the collector with -DGC_THREADS specified in Makefile.direct. 2) You have the latest pthreads patches installed.
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.solaris2 -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.solaris2
Changed
@@ -10,7 +10,7 @@ to expect that this is not safe if the client program also calls the system malloc, or especially realloc. The sbrk man page strongly suggests this is not safe: "Many library routines use malloc() internally, so use brk() -and sbrk() only when you know that malloc() definitely will not be used by +and sbrk() only when you know that malloc() definitely will not be used by any library routine." This doesn't make a lot of sense to me, since there seems to be no documentation as to which routines can transitively call malloc. Nonetheless, under Solaris2, the collector now allocates @@ -27,32 +27,30 @@ Unless --disable-threads option is given, threads support is on by default in configure. This causes the collector to be compiled with -D GC_THREADS ensuring thread safety. This assumes use of the pthread_ interface; old-style -Solaris threads are no longer supported. -Thread-local allocation is now on by default. Parallel marking is on by -default starting from GC v7.3 but it could be disabled manually -by configure --disable-parallel-mark option. +Solaris threads are no longer supported. Thread-local allocation is on by +default. Parallel marking is on by default (it could be disabled manually +by configure --disable-parallel-mark option). It is also essential that gc.h be included in files that call pthread_create, pthread_join, pthread_detach, or dlopen. gc.h macro defines these to also do -GC bookkeeping, etc. gc.h must be included with one or both of these macros -defined, otherwise these replacements are not visible. A collector built in -this way way only be used by programs that are linked with the threads library. +GC bookkeeping, etc. gc.h must be included with GC_THREADS macro defined +first, otherwise these replacements are not visible. A collector built in +this way may only be used by programs that are linked with the threads library. -Since 5.0 alpha5, dlopen disables collection temporarily, -unless USE_PROC_FOR_LIBRARIES is defined. In some unlikely cases, this -can result in unpleasant heap growth. But it seems better than the -race/deadlock issues we had before. +Unless USE_PROC_FOR_LIBRARIES is defined, dlopen disables collection +temporarily. In some unlikely cases, this can result in unpleasant heap +growth. But it seems better than the race/deadlock issues we had before. If threads are used on an X86 processor with malloc redirected to GC_malloc, it is necessary to call GC_INIT explicitly before forking the first thread. (This avoids a deadlock arising from calling GC_thr_init with the allocation lock held.) -It appears that there is a problem in using gc_cpp.h in conjunction with -Solaris threads and Sun's C++ runtime. Apparently the overloaded new operator -is invoked by some iostream initialization code before threads are correctly -initialized. As a result, call to thr_self() in garbage collector -initialization SEGV faults. Currently the only known workaround is to not +There could be an issue when using gc_cpp.h in conjunction with Solaris +threads and Sun's C++ runtime. Apparently the overloaded new operator +may be invoked by some iostream initialization code before threads are +correctly initialized. This may cause a SIGSEGV during initialization +of the garbage collector. Currently the only known workaround is to not invoke the garbage collector from a user defined global operator new, or to have it invoke the garbage-collector's allocators only after main has started. (Note that the latter requires a moderately expensive test in operator
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.symbian -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.symbian
Changed
@@ -1,10 +1,8 @@ Instructions for Symbian: -1. base version: libgc 7.1 -2. Build: use libgc.mmp -3. Limitations -3.1.No multi-threaded support - -3.2. Be careful with limitation that emulator introduces: Static roots are not +1. Build: use libgc.mmp +2. Limitations +2.1. No multi-threaded support yet +2.2. Be careful with limitation that emulator introduces: Static roots are not dynamically accessible (there are Symbian APIs for this purpose but are just stubs, returning irrelevant values). Consequently, on emulator, you can only use dlls or exe, and retrieve static
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.win32 -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.win32
Changed
@@ -1,8 +1,7 @@ -The collector has at various times been compiled under Windows 95 & later, NT, -and XP, with the original Microsoft SDK, with Visual C++ 2.0, 4.0, and 6, with -the GNU win32 tools, with Borland C++ Builder, with Watcom C, and -with the Digital Mars compiler. It is likely that some of these have been -broken in the meantime. Patches are appreciated. +The collector has at various times been compiled under Windows 95 and later, +NT, and XP, with the original Microsoft SDK, with Visual C++ 2.0, 4.0, and 6, +with the GNU win32 tools, with Borland C++ Builder, with Watcom C, with EMX, +and with the Digital Mars compiler (DMC). For historical reasons, the collector test program "gctest" is linked as a GUI application, @@ -11,10 +10,10 @@ cursor may appear as long as it's running. If it is started from the command line, it will usually run in the background. Wait a few minutes (a few seconds on a modern machine) before you check the output. -You should see either a failure indication or a "Collector appears to -work" message. +You should see either a failure indication or a "Collector appears to work" +message. -A toy editor (cord/de.exe) based on cords (heavyweight +A toy editor (de.exe) based on cords (heavyweight strings represented as trees) has been ported and is included. It runs fine under either win32 or win32S. It serves as an example of a true Windows application, except that it was written by a @@ -40,8 +39,9 @@ Microsoft Tools --------------- + For Microsoft development tools, type -"nmake -f NT_MAKEFILE cpu=i386 make_as_lib=1 nothreads=1 nodebug=1" +"nmake -f NT_MAKEFILE cpu=i386 disable_threads=1 enable_static=1 nodebug=1" to build the release variant of the collector as a static library without threads support. @@ -61,6 +61,7 @@ GNU Tools --------- + The collector should be buildable under Cygwin with the "./configure; make check" machinery. @@ -68,8 +69,8 @@ host) and via cross-compilation, e.g. "./configure --host=i686-pc-mingw32; make check" -To build the collector as a DLL, pass "--enable-shared --disable-static" to -configure (this will instruct make to compile with -D GC_DLL). +By default, configure instructs make to build the collector as a DLL (shared +library), adding -D GC_DLL to CFLAGS. Parallel marker is enabled by default; it could be disabled by "--disable-parallel-mark" option. @@ -78,8 +79,8 @@ Borland Tools ------------- -Rarely tested. -For Borland tools, use BCC_MAKEFILE. Note that + +For Borland tools, use `cmake -G "Borland Makefiles"`. Note that Borland's compiler defaults to 1 byte alignment in structures (-a1), whereas Visual C++ appears to default to 8 byte alignment (/Zp8). The garbage collector in its default configuration EXPECTS AT @@ -89,8 +90,6 @@ 486 or Pentium.) Note that this changes structure layouts. (As a last resort, gcconfig.h can be changed to allow 1 byte alignment. But this has significant negative performance implications.) -The Makefile is set up to assume Borland 5.5. If you have another -version, change the line near the top. Digital Mars compiler --------------------- @@ -104,7 +103,7 @@ Ivan V. Demakov's README for the Watcom port: -The collector has been compiled with Watcom C 10.6 and 11.0. +The collector has been tested with Watcom C 10.6, 11.0 and OpenWatcom 2.0. It runs under win32, win32s, and even under msdos with dos4gw dos-extender. It should also run under OS/2, though this isn't tested. Under win32 the collector can be built either as dll @@ -116,13 +115,11 @@ Incremental collection is supported (except for MSDOS and OS/2). -cord is not ported. - Before compiling you may need to edit WCC_MAKEFILE to set target platform, library type (dynamic or static), calling conventions, and optimization options. -To compile the collector and testing programs use the command: +To compile the collector use the command: wmake -f WCC_MAKEFILE All programs using gc should be compiled with 4-byte alignment. @@ -132,6 +129,9 @@ including "gc.h" (for example, with -DGC_DLL compiler option). It's important, otherwise resulting programs will not run. +The alternate way to compile the collector is to use cmake build system: + cmake -G "Watcom WMake" . + cmake --build . Special note for OpenWatcom users: the C (unlike the C++) compiler (of the latest stable release, not sure for older ones) doesn't force pointer global @@ -141,9 +141,9 @@ a feature (see an old report of same kind - http://bugzilla.openwatcom.org/show_bug.cgi?id=664), so You are warned. - Incremental Collection ---------------------- + There is some support for incremental collection. By default, the collector chooses between explicit page protection, and GetWriteWatch-based write tracking automatically, depending on the platform. @@ -165,9 +165,9 @@ Threads ------- -This version of the collector by default handles threads similarly -to other platforms. James Clark's code which tracks threads attached -to the collector DLL still exists, but requires that both +The collector by default handles threads similarly to other platforms. +James Clark's code which tracks threads attached to the collector DLL still +exists, but requires that both - the collector is built in a DLL with GC_DLL defined, and - GC_use_threads_discovery() is called before GC initialization, which in turn must happen before creating additional threads. @@ -180,26 +180,17 @@ tracking) is needed then delete "-DTHREAD_LOCAL_ALLOC" from NT_MAKEFILE manually before the build. -The alternate way (not well tested) to build the dynamic library that supports -both kinds of thread tracking is to use gc.mak instead of NT_MAKEFILE. -To build the garbage collector test with VC++ from the command line, use - -nmake /F ".\gc.mak" CFG="gctest - Win32 Release" - -This requires that the subdirectory gctest\Release exist. -The test program and DLL will reside in the Release directory. +The incremental collection is supported only if it is enabled before any +additional threads are created. -This version currently supports incremental collection only if it is -enabled before any additional threads are created. - -Since 6.3alpha2, threads are also better supported in static library builds -with Microsoft tools (e.g., NT_MAKEFILE) and with the GNU -tools. The collector must be built with GC_THREADS defined (this is the -default in NT_MAKEFILE, ./configure and CMakeLists.txt). +Threads are also supported in static library builds with Microsoft tools +(e.g., NT_MAKEFILE), as well as with the CMake and GNU tools. The collector +must be built with GC_THREADS defined (this is the default in NT_MAKEFILE, +CMakeLists.txt and configure). For the normal, non-dll-based thread tracking to work properly, threads should be created with GC_CreateThread or GC_beginthreadex, -and exit normally or call GC_endthreadex or GC_ExitThread. (For Cygwin, the +and exit normally, or call GC_endthreadex or GC_ExitThread. (For Cygwin, the standard pthread_create/exit calls could be used instead.) As in the pthread case, including gc.h will redefine CreateThread, _beginthreadex, _endthreadex, and ExitThread to call the GC_ versions instead. @@ -219,3 +210,6 @@ implementation for Windows), use Makefile.direct and explicitly set GC_WIN32_PTHREADS (or pass --enable-threads=pthreads to configure). Use -DPTW32_STATIC_LIB for the static threads library. + +The alternate (better) way to build the library is to use CMake script; +please see README.cmake for the details.
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/README.win64 -> _service:tar_scm:gc-8.2.2.tar.gz/doc/README.win64
Changed
@@ -1,13 +1,13 @@ -64-bit Windows on AMD64/Intel EM64T is somewhat supported in the 7.0 -and later release. A collector can be built with Microsoft Visual C++ 2005 -or with mingw-w64 gcc. +64-bit Windows on AMD64/Intel EM64T is supported. A collector can be built +with Microsoft Visual C++ 2005 or with mingw-w64 gcc. NT_MAKEFILE has been used in this environment. Type "nmake -f NT_MAKEFILE cpu=AMD64 nodebug=1" in a Visual C++ command line window to build the release variant of the dynamic library with threads -support and the usual test programs. -To verify that the collector is at least somewhat functional, run gctest.exe. -This should create gctest.gc.log after a few seconds. +support. +To verify that the collector is at least somewhat functional, +type "nmake -f NT_MAKEFILE cpu=AMD64 check" to build and run the usual test +programs. This should create gctest.gc.log after a few seconds. Test_cpp.exe might not run correctly in case of dynamic GC linking. (It seems that we're getting wrong instances of operator new/delete in some cases.) @@ -16,9 +16,9 @@ for the 32-bit library version. A similar procedure using NT_MAKEFILE is applicable to build the static -library - just pass "make_as_lib=1" as an extra argument to nmake. +library - just pass "enable_static=1" as an extra argument to nmake. If needed, it is also possible to build the library without threads -support - this could be done by passing "nothreads=1" argument to nmake. +support - this could be done by passing "disable_threads=1" argument to nmake. Note that some warnings have been explicitly turned off in the makefile.
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/debugging.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/debugging.md
Changed
@@ -43,13 +43,8 @@ The garbage collector generates warning messages of the form: - Needed to allocate blacklisted block at 0x... - - -or - - Repeated allocation of very large block ... + May lead to memory leak and poor performance when it needs to allocate a block at a location that it knows to be referenced @@ -88,7 +83,7 @@ } - 4. In the unlikely case that even relatively small object (<20KB) + 4. In the unlikely case that even relatively small object (<20 KB) allocations are triggering these warnings, then your address space contains lots of "bogus pointers", i.e. values that appear to be pointers but aren't. Usually this can be solved by using `GC_malloc_atomic` or the routines @@ -133,11 +128,11 @@ (`-DDONT_ADD_BYTE_AT_END`). The collector rounds up object sizes so the result fits well into the chunk -size (`HBLKSIZE`, normally 4K on 32 bit machines, 8K on 64 bit machines) used -by the collector. Thus it may be worth avoiding objects of size 2K + 1 (or 2K -if a byte is being added at the end.) The last two cases can often -be identified by looking at the output of a call to `GC_dump`. Among other -things, it will print the list of free heap blocks, and a very brief +size (`HBLKSIZE`, normally 4 KB on 32-bit machines, 8 KB on 64-bit ones) used +by the collector. Thus it may be worth avoiding objects of size 2K + 1 bytes +(or exactly 2 KB if a byte is being added at the end.) The last two cases can +often be identified by looking at the output of a call to `GC_dump`. Among +other things, it will print the list of free heap blocks, and a very brief description of all chunks in the heap, the object sizes they correspond to, and how many live objects were found in the chunk at the last collection. @@ -169,11 +164,12 @@ pseudo-random numbers, and the like. It is also likely to improve GC performance, perhaps drastically so if the application is paging. 2. If you allocate large objects containing only one or two pointers at the - beginning, either try the typed allocation primitives is`gc_typed.h`, + beginning, either try the typed allocation primitives in `gc_typed.h`, or separate out the pointer-free component. 3. Consider using `GC_malloc_ignore_off_page` to allocate large objects. - (See `gc.h` and above for details. Large means >100K in most environments.) - 4. If your heap size is larger than 100MB or so, build the collector with + (See `gc.h` and above for details. Large means more than 100 KB in most + environments.) + 4. If your heap size is larger than 100 MB or so, build the collector with `-DLARGE_CONFIG`. This allows the collector to keep more precise black-list information. 5. If you are using heaps close to, or larger than, a gigabyte on a 32-bit
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/doc.am -> _service:tar_scm:gc-8.2.2.tar.gz/doc/doc.am
Changed
@@ -24,6 +24,7 @@ doc/README.cmake \ doc/README.cords \ doc/README.darwin \ + doc/README.emscripten \ doc/README.environment \ doc/README.ews4800 \ doc/README.hp \
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/finalization.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/finalization.md
Changed
@@ -37,19 +37,18 @@ recently used logically open files. Any other needed files would be closed after saving their state. They would then be reopened on demand. Finalization would logically close the file, closing the real descriptor - only if it happened to be cached.) Note that most modern systems (e.g. Irix) - allow hundreds or thousands of open files, and this is typically not - an issue. + only if it happened to be cached.) Note that most modern systems allow + thousands of open files, and this is typically not an issue. * Finalization code may be run anyplace an allocation or other call to the collector takes place. In multi-threaded programs, finalizers have to obey the normal locking conventions to ensure safety. Code run directly from finalizers should not acquire locks that may be held during allocation. - This restriction can be easily circumvented by registering a finalizer which - enqueues the real action for execution in a separate thread. + This restriction can be easily circumvented by calling + `GC_set_finalize_on_demand(1)` at program start and creating a separate + thread dedicated to periodic invocation of `GC_invoke_finalizers()`. -In single-threaded code, it is also often easiest to have finalizers queue -actions, which are then explicitly run during an explicit call by the user's -program. +In single-threaded code, it is also often easiest to have finalizers queued +and, then to have them explicitly executed by `GC_invoke_finalizers()`. ## Topologically ordered finalization
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/gc.man -> _service:tar_scm:gc-8.2.2.tar.gz/doc/gc.man
Changed
@@ -1,15 +1,28 @@ -.TH BDWGC 3 "15 Aug 2018" +.TH BDWGC 3 "26 Mar 2019" .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 +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> .br void * GC_malloc(size_t size); .br +void * GC_malloc_atomic(size_t size); +.br void GC_free(void *ptr); .br void * GC_realloc(void *ptr, size_t size); .br +void GC_enable_incremental(void); +.br +void * GC_malloc_ignore_off_page(size_t size); +.br +void * GC_malloc_atomic_ignore_off_page(size_t size); +.br +void GC_set_warn_proc(void (*proc)(char *, GC_word)); +.br .sp cc ... -lgc .LP @@ -20,7 +33,12 @@ are plug-in replacements for standard malloc and free. However, .I GC_malloc -will attempt to reclaim inaccessible space automatically by invoking a conservative garbage collector at appropriate points. The collector traverses all data structures accessible by following pointers from the machines registers, stack(s), data, and bss segments. Inaccessible structures will be reclaimed. A machine word is considered to be a valid pointer if it is an address inside an object allocated by +will attempt to reclaim inaccessible space automatically by invoking +a conservative garbage collector at appropriate points. The collector +traverses all data structures accessible by following pointers from the +machines registers, stack(s), data, and bss segments. Inaccessible structures +will be reclaimed. A machine word is considered to be a valid pointer if +it is an address inside an object allocated by .I GC_malloc or friends. @@ -44,30 +62,49 @@ clears the newly allocated storage. .I GC_malloc_atomic -does not. Furthermore, it informs the collector that the resulting object will never contain any pointers, and should therefore not be scanned by the collector. +does not. Furthermore, it informs the collector that the resulting object +will never contain any pointers, and should therefore not be scanned by the +collector. .LP .I GC_free -can be used to deallocate objects, but its use is optional, and generally discouraged. +can be used to deallocate objects, but its use is optional, and generally +discouraged. .I GC_realloc has the standard realloc semantics. It preserves pointer-free-ness. .I GC_register_finalizer -allows for registration of functions that are invoked when an object becomes inaccessible. +allows for registration of functions that are invoked when an object becomes +inaccessible. .LP -The garbage collector tries to avoid allocating memory at locations that already appear to be referenced before allocation. (Such apparent ``pointers'' are usually large integers and the like that just happen to look like an address.) This may make it hard to allocate very large objects. An attempt to do so may generate a warning. +The garbage collector tries to avoid allocating memory at locations that +already appear to be referenced before allocation. (Such apparent +``pointers'' are usually large integers and the like that just happen to look +like an address.) This may make it hard to allocate very large objects. +An attempt to do so may generate a warning. .LP .I GC_malloc_ignore_off_page and .I GC_malloc_atomic_ignore_off_page -inform the collector that the client code will always maintain a pointer to near the beginning of the object (within the first 512 bytes), and that pointers beyond that can be ignored by the collector. This makes it much easier for the collector to place large objects. These are recommended for large object allocation. (Objects expected to be larger than about 100KBytes should be allocated this way.) -.LP -It is also possible to use the collector to find storage leaks in programs destined to be run with standard malloc/free. The collector can be compiled for thread-safe operation. Unlike standard malloc, it is safe to call malloc after a previous malloc call was interrupted by a signal, provided the original malloc call is not resumed. -.LP -The collector may, on rare occasion produce warning messages. On UNIX machines these appear on stderr. Warning messages can be filtered, redirected, or ignored with +inform the collector that the client code will always maintain a pointer to +near the beginning of the object (within the first 512 bytes), and that +pointers beyond that can be ignored by the collector. This makes it much +easier for the collector to place large objects. These are recommended for +large object allocation. (Objects expected to be > ~100 KB should be +allocated this way.) +.LP +It is also possible to use the collector to find storage leaks in programs +destined to be run with standard malloc/free. The collector can be compiled +for thread-safe operation. Unlike standard malloc, it is safe to call malloc +after a previous malloc call was interrupted by a signal, provided the +original malloc call is not resumed. +.LP +The collector may, on rare occasion, produce warning messages. On UNIX +machines these appear on stderr. Warning messages can be filtered, +redirected, or ignored with .I GC_set_warn_proc This is recommended for production code. See gc.h for details. @@ -75,21 +112,35 @@ Fully portable code should call .I GC_INIT -from the main program before making any other GC calls. -On most platforms this does nothing and the collector is initialized on first use. -On a few platforms explicit initialization is necessary. And it can never hurt. -.LP -Debugging versions of many of the above routines are provided as macros. Their names are identical to the above, but consist of all capital letters. If GC_DEBUG is defined before gc.h is included, these routines do additional checking, and allow the leak detecting version of the collector to produce slightly more useful output. Without GC_DEBUG defined, they behave exactly like the lower-case versions. +from the primordial thread of the main program before making any other +GC calls. On most platforms this does nothing and the collector is +initialized on first use. On a few platforms explicit initialization is +necessary. And it can never hurt. +.LP +Debugging versions of many of the above routines are provided as macros. +Their names are identical to the above, but consist of all capital letters. +If GC_DEBUG is defined before gc.h is included, these routines do additional +checking, and allow the leak detecting version of the collector to produce +slightly more useful output. Without GC_DEBUG defined, they behave exactly +like the lower-case versions. .LP On some machines, collection will be performed incrementally after a call to .I GC_enable_incremental. -This may temporarily write protect pages in the heap. See the README file for more information on how this interacts with system calls that write to the heap. +This may temporarily write protect pages in the heap. See the README file for +more information on how this interacts with system calls that write to the +heap. .LP -Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc. +Other facilities not discussed here include limited facilities to support +incremental collection on machines without appropriate VM support, provisions +for providing more explicit object layout information to the garbage +collector, more direct support for ``weak'' pointers, support for +``abortable'' garbage collections during idle time, etc. .LP .SH "SEE ALSO" -The README and gc.h files in the distribution. More detailed definitions of the functions exported by the collector are given there. (The above list is not complete.) +The README and gc.h files in the distribution. More detailed definitions of +the functions exported by the collector are given there. (The above list is +not complete.) .LP The web site at http://www.hboehm.info/gc/ (or https://github.com/ivmai/bdwgc/). .LP @@ -100,4 +151,5 @@ .LP .SH AUTHOR Hans-J. Boehm (boehm@acm.org). -Some of the code was written by others (see the AUTHORS file for the details), most notably by Alan Demers, and, recently, Ivan Maidanski. +Some of the code was written by others (see the AUTHORS file for the details), +most notably by Alan Demers, and, recently, Ivan Maidanski.
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/gcdescr.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/gcdescr.md
Changed
@@ -18,30 +18,52 @@ be apparent in the design. We assume the default finalization model, but the code affected by that is very localized. +Table of Contents + * Introduction(#introduction) + * Allocation(#allocation) + * Mark phase(#mark-phase) + * Sweep phase(#sweep-phase) + * Finalization(#finalization) + * Generational Collection and Dirty Bits(#generational-collection-and-dirty-bits) + * Black-listing(#black-listing) + * Thread support(#thread-support) + * Thread-local allocation(#thread-local-allocation) + ## Introduction The garbage collector uses a modified mark-sweep algorithm. Conceptually it operates roughly in four phases, which are performed occasionally as part of a memory allocation: - 1. _Preparation_ Each object has an associated mark bit. Clear all mark - bits, indicating that all objects are potentially unreachable. - 2. _Mark phase_ Marks all objects that can be reachable via chains - of pointers from variables. Often the collector has no real information - about the location of pointer variables in the heap, so it views all static - data areas, stacks and registers as potentially containing pointers. Any bit - patterns that represent addresses inside heap objects managed by the - collector are viewed as pointers. Unless the client program has made heap - object layout information available to the collector, any heap objects found - to be reachable from variables are again scanned similarly. - 3. _Sweep phase_ Scans the heap for inaccessible, and hence unmarked, - objects, and returns them to an appropriate free list for reuse. This is not - really a separate phase; even in non-incremental mode this operation - is usually performed on demand during an allocation that discovers an empty - free list. Thus the sweep phase is very unlikely to touch a page that would - not have been touched shortly thereafter anyway. - 4. _Finalization phase_ Unreachable objects which had been registered for - finalization are enqueued for finalization outside the collector. + 1. _Preparation phase_ + + Each object has an associated mark bit. Clear all mark + bits, indicating that all objects are potentially unreachable. + + 2. _Mark phase_ + + Marks all objects that can be reachable via chains of pointers from + variables. Often the collector has no real information about the location + of pointer variables in the heap, so it views all static data areas, + stacks and registers as potentially containing pointers. Any bit + patterns that represent addresses inside heap objects managed by the + collector are viewed as pointers. Unless the client program has made heap + object layout information available to the collector, any heap objects + found to be reachable from variables are again scanned similarly. + + 3. _Sweep phase_ + + Scans the heap for inaccessible, and hence unmarked, + objects, and returns them to an appropriate free list for reuse. This is + not really a separate phase; even in non-incremental mode this operation + is usually performed on demand during an allocation that discovers an + empty free list. Thus the sweep phase is very unlikely to touch a page + that would not have been touched shortly thereafter anyway. + + 4. _Finalization phase_ + + Unreachable objects which had been registered for + finalization are enqueued for finalization outside the collector. The remaining sections describe the memory allocation data structures, and then the last 3 collection phases in more detail. We conclude by outlining @@ -58,17 +80,16 @@ allows the garbage collector to easily ignore the collectors own data structures when it searches for root pointers. Other allocator and collector internal data structures are allocated dynamically with `GC_scratch_alloc`. -`GC_scratch_alloc` does not allow for deallocation, and is therefore used only -for permanent data structures. +The latter does not allow for deallocation, and is therefore used only for +permanent data structures. -The allocator allocates objects of different _kinds_. Different kinds are +The allocator returns objects of different _kinds_. Different _kinds_ are handled somewhat differently by certain parts of the garbage collector. Certain kinds are scanned for pointers, others are not. Some may have per-object type descriptors that determine pointer locations. Or a specific kind may correspond to one specific object layout. Two built-in kinds are -uncollectible. -In spite of that, it is very likely that most C clients of the collector -currently use at most two kinds: `NORMAL` and `PTRFREE` objects. The +uncollectible. In spite of that, it is very likely that most C clients of the +collector currently use at most two kinds: `NORMAL` and `PTRFREE` objects. The GCJ(https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcj/) runtime also makes heavy use of a kind (allocated with `GC_gcj_malloc`) that stores type information at a known offset in method tables. @@ -78,20 +99,20 @@ of the page size. Large block sizes are rounded up to the next multiple of `HBLKSIZE` and then -allocated by `GC_allochblk`. Recent versions of the collector use an -approximate best fit algorithm by keeping free lists for several large block -sizes. The actual implementation of `GC_allochblk` is significantly -complicated by black-listing issues (see below). +allocated by `GC_allochblk`. The collector use an approximate best fit +algorithm by keeping free lists for several large block sizes. The actual +implementation of `GC_allochblk` is significantly complicated by black-listing +issues (see below). Small blocks are allocated in chunks of size `HBLKSIZE`. Each chunk is dedicated to only one object size and kind. The allocator maintains separate free lists for each size and kind of object. Associated with each kind is an array of free list pointers, with entry -`freelisti` pointing to a free list of size 'i' objects. In recent versions -of the collector, index `i` is expressed in granules, which are the minimum -allocatable unit, typically 8 or 16 bytes. The free lists themselves are -linked through the first word in each object (see `obj_link` macro). +`freelisti` pointing to a free list of size 'i' objects. Index `i` is +expressed in granules, which are the minimum allocatable unit, typically 8 or +16 bytes. The free lists themselves are linked through the first word in each +object (see `obj_link` macro). Once a large block is split for use in smaller objects, it can only be used for objects of that size, unless the collector discovers a completely empty @@ -132,14 +153,13 @@ * Programs with a large root set size and little live heap memory will expand the heap to amortize the cost of scanning the roots. - * GC v5 actually collects more frequently in non-incremental mode. The large + * GC actually collects more frequently in non-incremental mode. The large block allocator usually refuses to split large heap blocks once the garbage collection threshold is reached. This often has the effect of collecting well before the heap fills up, thus reducing fragmentation and working set - size at the expense of GC time. GC v6 chooses an intermediate strategy - depending on how much large object allocation has taken place in the past. - (If the collector is configured to unmap unused pages, GC v6 uses the - strategy of GC v5.) + size at the expense of GC time. (If the collector is configured not to unmap + unused pages, GC chooses an intermediate strategy depending on how much + large object allocation has taken place in the past.) * In calculating the amount of allocation since the last collection we give partial credit for objects we expect to be explicitly deallocated. Even if all objects are explicitly managed, it is often desirable to collect @@ -182,7 +202,7 @@ a length. (For other possibilities, see `gc_mark.h`.) At the beginning of the mark phase, all root segments (as described above) are -pushed on the stack by `GC_push_roots`. (Registers and eagerly processed stack +pushed on the stack by `GC_push_roots`. (Registers and eagerly scanned stack sections are processed by pushing the referenced objects instead of the stack section itself.) If `ALL_INTERIOR_POINTERS` is not defined, then stack roots require special treatment. In this case, the normal marking code ignores @@ -200,7 +220,7 @@ In this case `GC_objects_are_marked` will simultaneously be false, so the mark state is advanced to 2. `MS_PUSH_UNCOLLECTABLE` indicating that it suffices to push uncollectible - objects, roots, and then mark everything reachable from them. `scan_ptr` + objects, roots, and then mark everything reachable from them. `GC_scan_ptr` is advanced through the heap until all uncollectible objects are pushed, and objects reachable from them are marked. At that point, the next call to `GC_mark_some` calls `GC_push_roots` to push the roots. It, then, @@ -234,9 +254,9 @@ attempt results in additional marked objects. Each mark stack entry is processed by examining all candidate pointers in the -range described by the entry. If the region has no associated type -information, then this typically requires that each 4-byte aligned quantity -(8-byte aligned with 64-bit pointers) be considered a candidate pointer. +range described by the entry. If the region has no associated type information +then this typically requires that each 4-byte aligned quantity (8-byte aligned +if 64-bit pointers) be considered a candidate pointer. We determine whether a candidate pointer is actually the address of a heap block. This is done in the following steps: @@ -249,8 +269,10 @@ * The candidate pointer is divided into two pieces; the most significant bits identify a `HBLKSIZE`-sized page in the address space, and the least significant bits specify an offset within that page. (A hardware page may - actually consist of multiple such pages. HBLKSIZE is usually the page size - divided by a small power of two.) + actually consist of multiple such pages. Normally, HBLKSIZE is usually the + page size divided by a small power of two. Alternatively, if the collector + is built with `-DLARGE_CONFIG`, such a page may consist of multiple hardware + pages.) * The page address part of the candidate pointer is looked up in a table(tree.md). Each table entry contains either 0, indicating that the page is not part of the garbage collected heap, a small integer _n_, @@ -269,8 +291,8 @@ operation in computing the object start address. * The mark bit for the target object is checked and set. If the object was previously unmarked, the object is pushed on the mark stack. The descriptor - is read from the page descriptor. (This is computed from information - `GC_obj_kinds` when the page is first allocated.) + is read from the page descriptor. (This is computed from information stored + in `GC_obj_kinds` when the page is first allocated.) At the end of the mark phase, mark bits for left-over free lists are cleared, in case a free list was accidentally marked due to a stray pointer. @@ -373,12 +395,12 @@ In incremental mode, the heap is always expanded when we encounter
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/gcinterface.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/gcinterface.md
Changed
@@ -15,7 +15,8 @@ The following describes the standard C interface to the garbage collector. It is not a complete definition of the interface. It describes only the most commonly used functionality, approximately in decreasing order of frequency -of use. The full interface is described in `gc.h` file. +of use. This somewhat duplicates the information in `gc.man` file. The full +interface is described in `gc.h` file. Clients should include `gc.h` (i.e., not `gc_config_macros.h`, `gc_pthread_redirects.h`, `gc_version.h`). In the case of multi-threaded code, @@ -27,11 +28,11 @@ Thread users should also be aware that on many platforms objects reachable only from thread-local variables may be prematurely reclaimed. Thus objects pointed to by thread-local variables should also be pointed to by a globally -visible data structure. (This is viewed as a bug, but as one that -is exceedingly hard to fix without some `libc` hooks.) +visible data area, e.g. thread's stack. (This behavior is viewed as a bug, but +as one that is exceedingly hard to fix without some `libc` hooks.) -**void * `GC_MALLOC`(size_t _nbytes_)** - Allocates and clears _nbytes_ -of storage. Requires (amortized) time proportional to _nbytes_. The resulting +`void * GC_MALLOC(size_t _bytes_)` - Allocates and clears _bytes_ +of storage. Requires (amortized) time proportional to _bytes_. The resulting object will be automatically deallocated when unreferenced. References from objects allocated with the system malloc are usually not considered by the collector. (See `GC_MALLOC_UNCOLLECTABLE`, however. Building the collector @@ -40,33 +41,33 @@ is defined before `gc.h` is included, a debugging version that checks occasionally for overwrite errors, and the like. -**void * `GC_MALLOC_ATOMIC`(size_t _nbytes_)** - Allocates _nbytes_ -of storage. Requires (amortized) time proportional to _nbytes_. The resulting +`void * GC_MALLOC_ATOMIC(size_t _bytes_)` - Allocates _bytes_ +of storage. Requires (amortized) time proportional to _bytes_. The resulting object will be automatically deallocated when unreferenced. The client promises that the resulting object will never contain any pointers. The memory is not cleared. This is the preferred way to allocate strings, floating point arrays, bitmaps, etc. More precise information about pointer locations can be communicated to the collector using the interface in `gc_typed.h`. -**void * `GC_MALLOC_UNCOLLECTABLE`(size_t _nbytes_)** - Identical +`void * GC_MALLOC_UNCOLLECTABLE(size_t _bytes_)` - Identical to `GC_MALLOC`, except that the resulting object is not automatically deallocated. Unlike the system-provided `malloc`, the collector does scan the object for pointers to garbage-collectible memory, even if the block itself does not appear to be reachable. (Objects allocated in this way are effectively treated as roots by the collector.) -**void * `GC_REALLOC`(void * _old_, size_t _new_size_)** - Allocates a new -object of the indicated size and copy (a prefix of) the old object into the +`void * GC_REALLOC(void * _old_object_, size_t _new_bytes_)` - Allocates +a new object of the indicated size and copy the old object's content into the new object. The old object is reused in place if convenient. If the original object was allocated with `GC_MALLOC_ATOMIC`, the new object is subject to the same constraints. If it was allocated as an uncollectible object, then the new object is uncollectible, and the old object (if different) is deallocated. -**void `GC_FREE`(void * _dead_)** - Explicitly deallocates an object. +`void GC_FREE(void * _object_)` - Explicitly deallocates an _object_. Typically not useful for small collectible objects. -**void * `GC_MALLOC_IGNORE_OFF_PAGE`(size_t _nbytes_)** and -**void * `GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE`(size_t _nbytes_)** - Analogous +`void * GC_MALLOC_IGNORE_OFF_PAGE(size_t _bytes_)` and +`void * GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(size_t _bytes_)` - Analogous to `GC_MALLOC` and `GC_MALLOC_ATOMIC`, respectively, except that the client guarantees that as long as the resulting object is of use, a pointer is maintained to someplace inside the first 512 bytes of the object. This @@ -75,51 +76,49 @@ This is the preferred way to allocate objects that are likely to be more than 100 KB in size. It greatly reduces the risk that such objects will be accidentally retained when they are no longer needed. Thus space usage may -be significantly reduced. +be significantly reduced. Another way is `GC_set_all_interior_pointers(0)` +called at program start (this, however, is generally not suitable for C++ code +because of multiple inheritance). -**void `GC_INIT()`** - On some platforms, it is necessary to invoke this _from +`void GC_INIT()` - On some platforms, it is necessary to invoke this _from the main executable_, _not from a dynamic library_, before the initial invocation of a GC routine. It is recommended that this be done in portable code, though we try to ensure that it expands to a no-op on as many platforms -as possible. In GC v7.0, it was required if thread-local allocation is enabled -in the collector build, and `malloc` is not redirected to `GC_malloc`. +as possible. -**void `GC_gcollect`(void)** - Explicitly forces a garbage collection. +`void GC_gcollect(void)` - Explicitly forces a garbage collection. -**void `GC_enable_incremental`(void)** - Causes the garbage collector +`void GC_enable_incremental(void)` - Causes the garbage collector to perform a small amount of work every few invocations of `GC_MALLOC` or the like, instead of performing an entire collection at once. This is likely to increase total running time. It will improve response on a platform that -either has suitable support in the garbage collector (Linux and most Unix -versions, Win32 if the collector was suitably built). On many platforms this -interacts poorly with system calls that write to the garbage collected heap. +has suitable support in the garbage collector (Linux and most Unix versions, +Win32 if the collector was suitably built). On many platforms this interacts +poorly with system calls that write to the garbage collected heap. -**void `GC_set_warn_proc`(GC_warn_proc)** - Replaces the default procedure +`void GC_set_warn_proc(GC_warn_proc)` - Replaces the default procedure used by the collector to print warnings. The collector may otherwise write to `stderr`, most commonly because `GC_malloc` was used in a situation in which `GC_malloc_ignore_off_page` would have been more appropriate. See `gc.h` for details. -**void `GC_REGISTER_FINALIZER`(...)** - Registers a function to be called when +`void GC_REGISTER_FINALIZER(...)` - Registers a function to be called when an object becomes inaccessible. This is often useful as a backup method for releasing system resources (e.g. closing files) when the object referencing them becomes inaccessible. It is not an acceptable method to perform actions that must be performed in a timely fashion. See `gc.h` for details of the interface. See also here(finalization.md) for a more detailed discussion -of the design. - -Note that an object may become inaccessible before client code is done -operating on objects referenced by its fields. Suitable synchronization -is usually required. See -here(http://portal.acm.org/citation.cfm?doid=604131.604153) -or here(http://www.hpl.hp.com/techreports/2002/HPL-2002-335.html) for -details. +of the design. Note that an object may become inaccessible before client code +is done operating on objects referenced by its fields. Suitable +synchronization is usually required. See +here(http://portal.acm.org/citation.cfm?doid=604131.604153) or +here(http://www.hpl.hp.com/techreports/2002/HPL-2002-335.html) for details. If you are concerned with multiprocessor performance and scalability, you should consider enabling and using thread local allocation. -If your platform supports it, you should build the collector with parallel -marking support (`-DPARALLEL_MARK`); configure has it on by default. +If your platform supports it, you should also build the collector with +parallel marking support (`-DPARALLEL_MARK`); configure has it on by default. If the collector is used in an environment in which pointer location information for heap objects is easily available, this can be passed on to the @@ -134,11 +133,11 @@ Unfortunately, this thin layer appears to be very sensitive to variations in C++ implementations, particularly since it tries to replace the global `::new` operator, something that appears to not be well-standardized. Your -platform may need minor adjustments in this layer (`gc_cpp.cc`, `gc_cpp.h`, -and possibly `gc_allocator.h`). Such changes do not require understanding -of collector internals, though they may require a good understanding of your -platform. (Patches enhancing portability are welcome. But it is easy to break -one platform by fixing another.) +platform may need minor adjustments in this layer (`gc_badalc.cc`, +`gc_cpp.cc`, `gc_cpp.h`, and possibly `gc_allocator.h`). Such changes do not +require understanding of collector internals, though they may require a good +understanding of your platform. (Patches enhancing portability are welcome. +But it is easy to break one platform by fixing another.) Usage of the collector from C++ is also complicated by the fact that there are many _standard_ ways to allocate memory in C++. The default `::new` operator, @@ -182,24 +181,6 @@ These should work with any fully standard-conforming C++ compiler. -Users of the SGI extended STL(http://www.sgi.com/tech/stl) or its -derivatives (including most g++ versions) may instead be able to include -`new_gc_alloc.h` before including STL header files. This is increasingly -discouraged. - -This defines SGI-style allocators - - * `traceable_alloc` - * `single_client_traceable_alloc` - * `gc_alloc` - * `single_client_gc_alloc` - -The first two allocate uncollectible but traced memory, while the second two -allocate collectible memory. The `single_client_...` versions are not safe for -concurrent access by multiple threads, but are faster. - -See sample code here(http://www.hboehm.info/gc/gc_alloc_exC.txt). - ### Class inheritance based interface for new-based allocation Users may include `gc_cpp.h` and then cause members of classes to be allocated @@ -210,6 +191,15 @@ (and friends) to allocate traceable but uncollectible memory, making it safe to refer to collectible objects from the resulting memory. +If the user includes `gc_cpp.h` but `::new` should not be overridden then +`libgctba` (in addition to the `gc`) library should be linked with to provide +the definition of `GC_throw_bad_alloc` C++ function used by operator `new` of +class `gc`. Alternatively, the client may define `GC_NEW_ABORTS_ON_OOM` macro +before include of `gc_cpp.h` (this instructs `::new` to issue an abort instead +of throwing an exception), or may define `GC_INCLUDE_NEW` one before include +of `gc_cpp.h` (however, this might not compile or work as expected on some +platforms). + ## C interface It is also possible to use the C interface from `gc.h` directly. On platforms
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/leak.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/leak.md
Changed
@@ -16,32 +16,29 @@ exit time, a potentially useless activity that often triggers large amounts of paging. -All non-ancient versions of the garbage collector provide leak detection -support. Version 5.3 adds the following features: +The garbage collector provides leak detection support. This includes the +following features: - 1. Leak detection mode can be initiated at run-time by setting - `GC_find_leak` instead of building the collector with `FIND_LEAK` defined. - This variable should be set to a nonzero value at program startup. + 1. Leak detection mode can be initiated at run-time by `GC_set_find_leak(1)` + call at program startup instead of building the collector with `FIND_LEAK` + macro defined. 2. Leaked objects should be reported and then correctly garbage collected. - Prior versions either reported leaks or functioned as a garbage collector. - For the rest of this description we will give instructions that work with - any reasonable version of the collector. -To use the collector as a leak detector, follow the following steps: +To use the collector as a leak detector, do the following steps: - 1. Build the collector with `-DFIND_LEAK`. Otherwise use default build - options. + 1. Activate the leak detection mode as described above. 2. Change the program so that all allocation and deallocation goes through the garbage collector. - 3. Arrange to call `GC_gcollect` at appropriate points to check for leaks. - (For sufficiently long running programs, this will happen implicitly, but - probably not with sufficient frequency.) + 3. Arrange to call `GC_gcollect` (or `CHECK_LEAKS()`) at appropriate points + to check for leaks. (This happens implicitly but probably not with + a sufficient frequency for long running programs.) The second step can usually be accomplished with the `-DREDIRECT_MALLOC=GC_malloc` option when the collector is built, or by -defining `malloc`, `calloc`, `realloc` and `free` to call the corresponding +defining `malloc`, `calloc`, `realloc`, `free` (as well as `strdup`, +`strndup`, `wcsdup`, `memalign`, `posix_memalign`) to call the corresponding garbage collector functions. But this, by itself, will not yield very -informative diagnostics, since the collector does not keep track of +informative diagnostics, since the collector does not keep track of the information about how objects were allocated. The error reports will include only object addresses. @@ -56,11 +53,11 @@ generate additional bogus leak reports, since the collector itself drops some associated objects. -The same is generally true of thread support. However, as of 6.0alpha4, -correct leak reports should be generated with linuxthreads. +The same is generally true of thread support. However, the correct leak +reports should be generated with linuxthreads, at least. On a few platforms (currently Solaris/SPARC, Irix, and, with --DSAVE_CALL_CHAIN, Linux/X86), `GC_MALLOC` also causes some more information +`-DSAVE_CALL_CHAIN`, Linux/X86), `GC_MALLOC` also causes some more information about its call stack to be saved in the object. Such information is reproduced in the error reports in very non-symbolic form, but it can be very useful with the aid of a debugger. @@ -70,17 +67,17 @@ The `leak_detector.h` file is included in the "include" subdirectory of the distribution. -Assume the collector has been built with `-DFIND_LEAK`. (For newer versions -of the collector, we could instead add the statement `GC_set_find_leak(1)` as -the first statement in `main`. +Assume the collector has been built with `-DFIND_LEAK` or +`GC_set_find_leak(1)` exists as the first statement in `main`. -The program to be tested for leaks can then look like "leak_test.c" file -in the "tests" subdirectory of the distribution. +The program to be tested for leaks could look like `tests/leak_test.c` file +of the distribution. On an Intel X86 Linux system this produces on the stderr stream: - Leaked composite object at 0x806dff0 (leak_test.c:8, sz=4) + Found 1 leaked objects: + 0x806dff0 (tests/leak_test.c:19, sz=4, NORMAL) (On most unmentioned operating systems, the output is similar to this. If the @@ -91,7 +88,8 @@ On Irix it reports: - Leaked composite object at 0x10040fe0 (leak_test.c:8, sz=4) + Found 1 leaked objects: + 0x10040fe0 (tests/leak_test.c:19, sz=4, NORMAL) Caller at allocation: ##PC##= 0x10004910 @@ -99,7 +97,8 @@ and on Solaris the error report is: - Leaked composite object at 0xef621fc8 (leak_test.c:8, sz=4) + Found 1 leaked objects: + 0xef621fc8 (tests/leak_test.c:19, sz=4, NORMAL) Call chain at allocation: args: 4 (0x4), 200656 (0x30FD0) ##PC##= 0x14ADC @@ -110,27 +109,24 @@ In the latter two cases some additional information is given about how malloc was called when the leaked object was allocated. For Solaris, the first line specifies the arguments to `GC_debug_malloc` (the actual allocation routine), -The second the program counter inside main, the third the arguments to `main`, -and finally the program counter inside the caller to main (i.e. in the -C startup code). - -In the Irix case, only the address inside the caller to main is given. +The second one specifies the program counter inside `main`, the third one +specifies the arguments to `main`, and, finally, the program counter inside +the caller to `main` (i.e. in the C startup code). In the Irix case, only the +address inside the caller to `main` is given. In many cases, a debugger is needed to interpret the additional information. -On systems supporting the "adb" debugger, the `tools/callprocs.sh` script can -be used to replace program counter values with symbolic names. As of version -6.1, the collector tries to generate symbolic names for call stacks if it -knows how to do so on the platform. This is true on Linux/X86, but not on most -other platforms. +On systems supporting the `adb` debugger, the `tools/callprocs.sh` script can +be used to replace program counter values with symbolic names. The collector +tries to generate symbolic names for call stacks if it knows how to do so on +the platform. This is true on Linux/X86, but not on most other platforms. ## Simplified leak detection under Linux -Since version 6.1, it should be possible to run the collector in leak -detection mode on a program a.out under Linux/X86 as follows: +It should be possible to run the collector in the leak detection mode on +a program a.out under Linux/X86 as follows: - 1. _Ensure that a.out is a single-threaded executable, or you are using - a very recent (7.0alpha7+) collector version on Linux._ On most platforms - this does not work at all for the multi-threaded programs. + 1. If possible, ensure that a.out is a single-threaded executable. On some + platforms this does not work at all for the multi-threaded programs. 2. If possible, ensure that the `addr2line` program is installed in `/usr/bin`. (It comes with most Linux distributions.) 3. If possible, compile your program, which we'll call `a.out`, with full
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/overview.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/overview.md
Changed
@@ -4,13 +4,11 @@ # A garbage collector for C and C++ * Platforms - * Scalable multiprocessor versions * Some collector details * Further reading - * Current users - * Local Links for this collector - * Local Background Links - * Contacts and Mailing List + * Information provided on the BDWGC site + * More background information + * Contacts and new release announcements This is an updated version of the page formerly at `www.hpl.hp.com/personal/Hans_Boehm/gc/`, before that at @@ -41,6 +39,8 @@ Preview versions may contain additional features, platform support, but are likely to be less well tested. The list of changes for each version is specified on the releases(https://github.com/ivmai/bdwgc/releases) page. +The development version (snapshot) is available in the master branch of +bdwgc git(https://github.com/ivmai/bdwgc) repository on GitHub. The arguments for and against conservative garbage collection in C and C++ are briefly discussed here(http://www.hboehm.info/gc/issues.html). The @@ -50,51 +50,30 @@ The garbage collector code is copyrighted by Hans-J. Boehm(http://www.hboehm.info), Alan J. Demers, Xerox Corporation(http://www.xerox.com/), -Silicon Graphics(http://www.sgi.com/), and -Hewlett-Packard Company(http://www.hp.com/). It may be used and copied -without payment of a fee under minimal restrictions. See the README.md file -in the distribution or the license(http://www.hboehm.info/gc/license.txt) -for more details. **IT IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY -EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK**. +Silicon Graphics(http://www.sgi.com/), +Hewlett-Packard Company(http://www.hp.com/), +Ivan Maidanski(https://github.com/ivmai), and partially by some others. +It may be used and copied without payment of a fee under minimal restrictions. +See the README.md file in the distribution or the +license(http://www.hboehm.info/gc/license.txt) for more details. +**IT IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR IMPLIED. +ANY USE IS AT YOUR OWN RISK.** Empirically, this collector works with most unmodified C programs, simply -by replacing `malloc` with `GC_malloc` calls, replacing `realloc` with -`GC_realloc` calls, and removing free calls. Exceptions are discussed +by replacing `malloc` and `calloc` with `GC_malloc` calls, replacing `realloc` +with `GC_realloc` calls, and removing `free` calls. Exceptions are discussed here(http://www.hboehm.info/gc/issues.html). ## Platforms The collector is not completely portable, but the distribution includes ports to most standard PC and UNIX/Linux platforms. The collector should work -on Linux, *BSD, recent Windows versions, MacOS X, HP/UX, Solaris, Tru64, Irix -and a few other operating systems. Some ports are more polished than others. +on Linux, Android, BSD variants, OS/2, Windows (Win32 and Win64), MacOS X, +iOS, HP/UX, Solaris, Tru64, Irix, Symbian and other operating systems. Some +platforms are more polished (better supported) than others. -Irix pthreads, Linux threads, Win32 threads, Solaris threads (pthreads only), -HP/UX 11 pthreads, Tru64 pthreads, and MacOS X threads are supported in recent -versions. - -### Separately distributed ports - -For MacOS 9/Classic use, Patrick Beard's latest port is available from -`http://homepage.mac.com/pcbeard/gc/`. (Unfortunately, that's now quite dated. -I'm not in a position to test under MacOS. Although I try to incorporate -changes, it is impossible for me to update the project file.) - -Precompiled versions of the collector for NetBSD are available -here(ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/devel/boehm-gc/README.html). - - -Debian Linux(http://www.debian.org/) includes prepackaged versions of the -collector. - -## Scalable multiprocessor versions - -Kenjiro Taura, Toshio Endo, and Akinori Yonezawa have made available -a parallel collector(http://ieeexplore.ieee.org/abstract/document/1592629/) -based on this one. Their collector takes advantage of multiple processors -during a collection. Starting with GC v6.0alpha1 we also do this, though with -more modest processor scalability goals. Our approach is discussed briefly -in this document(scale.md). +Irix pthreads, Linux threads, Windows threads, Solaris threads (pthreads +only), HP/UX 11 pthreads, Tru64 pthreads, and MacOS X threads are supported. ## Some Collector Details @@ -102,7 +81,7 @@ algorithm. It provides incremental and generational collection under operating systems which provide the right kind of virtual memory support. (Currently this includes SunOS45, IRIX, OSF/1, Linux, and Windows, with varying -restrictions.) It allows _finalization_(finalization.md) code to be invoked +restrictions.) It allows finalization(finalization.md) code to be invoked when an object is collected. It can take advantage of type information to locate pointers if such information is provided, but it is usually used without such information. See the README and `gc.h` files in the distribution @@ -127,16 +106,18 @@ `malloc`/`free` allocation in time. We also expect that in many cases any additional overhead will be more than -compensated for by decreased copying etc. if programs are written and tuned +compensated for by e.g. decreased copying if programs are written and tuned for garbage collection. ## Further reading **The beginnings of a frequently asked questions list for this collector are -here(http://www.hboehm.info/gc/faq.html)**. +here(http://www.hboehm.info/gc/faq.html).** + +**The following provide information on garbage collection in general:** -**The following provide information on garbage collection in general**: Paul -Wilson's garbage collection ftp archive(ftp://ftp.cs.utexas.edu/pub/garbage) +Paul Wilson's +garbage collection ftp archive(ftp://ftp.cs.utexas.edu/pub/garbage) and GC survey(ftp://ftp.cs.utexas.edu/pub/garbage/gcsurvey.ps). The Ravenbrook @@ -149,7 +130,7 @@ and his book(http://www.cs.kent.ac.uk/people/staff/rej/gcbook/gcbook.html). **The following papers describe the collector algorithms we use and the -underlying design decisions at a higher level.** +underlying design decisions at a higher level:** (Some of the lower level details can be found here(gcdescr.md).) @@ -206,7 +187,7 @@ test for the potential of unbounded heap growth. **The following papers discuss language and compiler restrictions necessary -to guaranteed safety of conservative garbage collection.** +to guaranteed safety of conservative garbage collection:** We thank John Levine and JCLT for allowing us to make the second paper available electronically, and providing PostScript for the final version. @@ -239,69 +220,11 @@ Slides for Hans Boehm's Allocation and GC Myths(http://www.hboehm.info/gc/myths.ps) talk. -## Current users - -Known current users of some variant of this collector include: - -The runtime system for GCJ(https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcj/), -the static GNU java compiler. - -W3m(http://w3m.sourceforge.net/), a text-based web browser. - -Some versions of the Xerox DocuPrint printer software. - -The Mozilla(http://www.mozilla.org/) project, as leak detector. - -The Mono(http://www.mono-project.com) project, an open source implementation -of the .NET development framework. - -The DotGNU Portable.NET project(http://www.gnu.org/projects/dotgnu/), -another open source .NET implementation. - -The Irssi IRC client(http://irssi.org/). - -The Berkeley Titanium project(http://titanium.cs.berkeley.edu/). - -The NAGWare f90 Fortran 90 compiler(http://www.nag.co.uk/nagware/NP/NP_desc.asp). - -Elwood Corporation's Eclipse Common Lisp system, C library, and translator. - -The Bigloo Scheme(http://www-sop.inria.fr/mimosa/fp/Bigloo/) and -Camloo ML compilers(https://github.com/samoht/camloo) written by Manuel -Serrano and others. - -Brent Benson's -libscheme(http://www.cs.indiana.edu/scheme-repository/libscheme-vhll/final.html). - -The MzScheme scheme implementation. - -The -University of Washington Cecil Implementation(http://www.cs.washington.edu/research/projects/cecil/www/cecil-home.html). - -The Berkeley Sather implementation(http://www1.icsi.berkeley.edu/~sather/). - -The Berkeley Harmonia Project(http://www.cs.berkeley.edu/~harmonia/harmonia/index.html). - -The -Toba(http://www.cs.arizona.edu/projects/sumatra/toba/) Java Virtual Machine -to C translator. - -The Gwydion Dylan compiler(http://www.gwydiondylan.org/). - -The -GNU Objective C runtime(http://gcc.gnu.org/onlinedocs/gcc/Objective-C.html). - -Macaulay 2(http://www.math.uiuc.edu/Macaulay2), a system to support research
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/porting.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/porting.md
Changed
@@ -6,8 +6,7 @@ All of the following assumes that the collector is being ported to a byte-addressable 32- or 64-bit machine. Currently all successful ports -to 64-bit machines involve LP64 targets. The code base includes some -provisions for P64 targets (notably Win64), but that has not been tested. You +to 64-bit machines involve LP64 and LLP64 targets (notably Win64). You are hereby discouraged from attempting a port to non-byte-addressable, or 8-bit, or 16-bit machines. @@ -96,7 +95,7 @@ is found. This often works on Posix-like platforms. It makes it harder to debug client programs, since startup involves generating and catching a segmentation fault, which tends to confuse users. - * `DATAEND` - Set to the end of the main data segment. Defaults to `end`, + * `DATAEND` - Set to the end of the main data segment. Defaults to `_end`, where that is declared as an array. This works in some cases, since the linker introduces a suitable symbol. * `DATASTART2`, `DATAEND2` - Some platforms have two discontiguous main data @@ -107,20 +106,21 @@ architecture has more than one stack per thread, and is not supported yet, you will need to do more work. Grep for "IA64" in the source for an example.) - * `STACKBOTTOM` - Defined to be the cool end of the stack, which is usually - the highest address in the stack. It must bound the region of the stack that - contains pointers into the GC heap. With thread support, this must be the - cold end of the main stack, which typically cannot be found in the same way - as the other thread stacks. If this is not defined and none of the following - three macros is defined, client code must explicitly set `GC_stackbottom` - to an appropriate value before calling `GC_INIT` or any other `GC_` routine. + * `STACKBOTTOM` - Defined to be the cold end of the stack, which is usually + (i.e. when the stacks grow down) the highest address in the stack. It must + bound the region of the stack that contains pointers into the GC heap. With + thread support, this must be the cold end of the main stack, which typically + cannot be found in the same way as the other thread stacks. If this is not + defined and none of the following three macros is defined, client code must + explicitly set `GC_stackbottom` to an appropriate value before calling + `GC_INIT` or any other `GC_` routine. * `LINUX_STACKBOTTOM` - May be defined instead of `STACKBOTTOM`. If defined, then the cold end of the stack will be determined, we usually read it from `/proc`. * `HEURISTIC1` - May be defined instead of `STACKBOTTOM`. `STACK_GRAN` should generally also be redefined. The cold end of the stack is determined by taking an address inside `GC_init`s frame, and rounding it up to the next - multiple of `STACK_GRAN`. This works well if the stack base is always + multiple of `STACK_GRAN`. This works well if the stack bottom is always aligned to a large power of two. (`STACK_GRAN` is predefined to 0x1000000, which is rarely optimal.) * `HEURISTIC2` - May be defined instead of `STACKBOTTOM`. The cold end @@ -128,14 +128,16 @@ incrementing it repeatedly in small steps (decrement if `STACK_GROWS_UP`), and reading the value at each location. We remember the value when the first Segmentation violation or Bus error is signaled, round that to the nearest - plausible page boundary, and use that as the stack base. + plausible page boundary, and use that as the stack bottom. * `DYNAMIC_LOADING` - Should be defined if `dyn_load.c` has been updated for this platform and tracing of dynamic library roots is supported. - * `MPROTECT_VDB`, `PROC_VDB` - May be defined if the corresponding - _virtual dirty bit_ implementation in `os_dep.c` is usable on this platform. - This allows incremental/generational garbage collection. `MPROTECT_VDB` - identifies modified pages by write protecting the heap and catching faults. - `PROC_VDB` uses the /proc primitives to read dirty bits. + * `GWW_VDB`, `MPROTECT_VDB`, `PROC_VDB`, `SOFT_VDB` - May be defined if the + corresponding _virtual dirty bit_ implementation in `os_dep.c` is usable on + this platform. This allows incremental/generational garbage collection. + (`GWW_VDB` uses the Win32 `GetWriteWatch` function to read dirty bits, + `MPROTECT_VDB` identifies modified pages by write protecting the heap and + catching faults. `PROC_VDB` and `SOFT_VDB` use the /proc pseudo-files to + read dirty bits.) * `PREFETCH`, `GC_PREFETCH_FOR_WRITE` - The collector uses `PREFETCH(x)` to preload the cache with the data at _x_ address. This defaults to a no-op. * `CLEAR_DOUBLE` - If `CLEAR_DOUBLE` is defined, then `CLEAR_DOUBLE(x)` @@ -153,7 +155,7 @@ this can be done portably, but on some platforms it may require assembly code, or just tweaking of conditional compilation tests. -For GC v7, if your platform supports `getcontext`, then defining the macro +If your platform supports `getcontext` then defining the macro `UNIX_LIKE` for your OS in `gcconfig.h` (if it is not defined there yet) is likely to solve the problem. Otherwise, if you are using gcc, `_builtin_unwind_init` will be used, and should work fine. If that is not @@ -161,10 +163,8 @@ if your `setjmp` implementation saves all possibly pointer-valued registers into the buffer, as opposed to trying to unwind the stack at `longjmp` time. The `setjmp_test` test tries to determine this, but often does not get it -right. - -In GC v6.x versions of the collector, tracing of registers was more commonly -handled with assembly code. In GC v7, this is generally to be avoided. +right. Registers tracing handled with an assembly code is generally to be +avoided. Most commonly `os_dep.c` will not require attention, but see below. @@ -198,7 +198,7 @@ be automatically defined by `gc_config_macros.h` in the right cases. It should also result in a definition of `GC_PTHREADS`, as for the existing cases. - 2. For GC v7, ensuring that the `atomic_ops` package at least minimally + 2. Ensuring that the `atomic_ops` package at least minimally supports the platform. If incremental GC is needed, or if pthread locks do not perform adequately as the allocation lock, you will probably need to ensure that a sufficient `atomic_ops` port exists for the platform @@ -211,7 +211,7 @@ workarounds are common. Non-preemptive threads packages will probably require further work. Similarly thread-local allocation and parallel marking requires further work in `pthread_support.c`, and may require better - `atomic_ops` support. + `atomic_ops` support for the designed platform. ## Dynamic library support
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/scale.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/scale.md
Changed
@@ -1,12 +1,14 @@ # Garbage collector scalability -In its default configuration, the Boehm-Demers-Weiser garbage collector is not -thread-safe. It can be made thread-safe for a number of environments -by building the collector with `-DGC_THREADS` compilation flag. This has -primarily two effects: +If Makefile.direct is used, in its default configuration the +Boehm-Demers-Weiser garbage collector is not thread-safe. Generally, it can be +made thread-safe by building the collector with `-DGC_THREADS` compilation +flag. This has primarily the following effects: 1. It causes the garbage collector to stop all other threads when it needs - to see a consistent memory state. + to see a consistent memory state. It intercepts thread creation and + termination events to maintain a list of client threads to be stopped when + needed. 2. It causes the collector to acquire a lock around essentially all allocation and garbage collection activity. Since a single lock is used for all allocation-related activity, only one thread can be allocating @@ -16,36 +18,35 @@ On most platforms, the allocator/collector lock is implemented as a spin lock with exponential back-off. Longer wait times are implemented by yielding and/or sleeping. If a collection is in progress, the pure spinning stage -is skipped. This has the advantage that uncontested and thus most uniprocessor -lock acquisitions are very cheap. It has the disadvantage that the application -may sleep for small periods of time even when there is work to be done. And +is skipped. This has the uncontested advantage that most uniprocessor lock +acquisitions are very cheap. It has the disadvantage that the application may +sleep for small periods of time even when there is work to be done. And threads may be unnecessarily woken up for short periods. Nonetheless, this scheme empirically outperforms native queue-based mutual exclusion implementations in most cases, sometimes drastically so. ## Options for enhanced scalability -Version 6.0 of the collector adds two facilities to enhance collector -scalability on multiprocessors. As of 6.0alpha1, these are supported only -under Linux on X86 and IA64 processors, though ports to other otherwise -supported Pthreads platforms should be straightforward. They are intended -to be used together. +The collector uses two facilities to enhance collector scalability on +multiprocessors. They are intended to be used together. (The following refers +to Makefile.direct again.) * Building the collector with `-DPARALLEL_MARK` allows the collector to run the mark phase in parallel in multiple threads, and thus on multiple - processors. The mark phase typically consumes the large majority of the - collection time. Thus this largely parallelizes the garbage collector - itself, though not the allocation process. Currently the marking + processors (or processor cores). The mark phase typically consumes the large + majority of the collection time. Thus, this largely parallelizes the garbage + collector itself, though not the allocation process. Currently the marking is performed by the thread that triggered the collection, together with - _N_ - 1 dedicated threads, where _N_ is the number of processors detected - by the collector. The dedicated threads are created once at initialization - time (and optionally recreated in child processes after forking). - A second effect of this flag is to switch to a more concurrent - implementation of `GC_malloc_many`, so that free lists can be built, and - memory can be cleared, by more than one thread concurrently. + _N_ - 1 dedicated threads, where _N_ is the number of processors (cores) + detected by the collector. The dedicated marker threads are created when the + client calls `GC_start_mark_threads()` or when the client starts the first + non-main thread after the GC initialization (or after fork operation in + a child process). Another effect of this flag is to switch to a more + concurrent implementation of `GC_malloc_many`, so that free lists can be + built and memory can be cleared by more than one thread concurrently. * Building the collector with `-DTHREAD_LOCAL_ALLOC` adds support for - thread-local allocation. This causes `GC_malloc`, `GC_malloc_atomic`, and - `GC_gcj_malloc` to be redefined to perform thread-local allocation. + thread-local allocation. This causes `GC_malloc` (actually `GC_malloc_kind`) + and `GC_gcj_malloc` to be redefined to perform thread-local allocation. Memory returned from thread-local allocators is completely interchangeable with that returned by the standard allocators. It may be used by other @@ -58,7 +59,7 @@ spin-then-sleep lock to be replaced by a spin-then-queue based implementation. This _reduces performance_ for the standard allocation functions, though it usually improves performance when thread-local allocation is used heavily, -and thus the number of short-duration lock acquisitions is greatly reduced. +and, thus, the number of short-duration lock acquisitions is greatly reduced. ## The Parallel Marking Algorithm @@ -86,18 +87,19 @@ The sequential marking code is reused to process local mark stacks. Hence the amount of additional code required for parallel marking is minimal. -It should be possible to use generational collection in the presence of the -parallel collector, by calling `GC_enable_incremental`. This does not result -in fully incremental collection, since parallel mark phases cannot currently -be interrupted, and doing so may be too expensive. +It should be possible to use incremental/generational collection in the +presence of the parallel collector by calling `GC_enable_incremental`, but +the current implementation does not allow interruption of the parallel marker, +so the latter is mostly avoided if the client sets the collection time limit. Gcj-style mark descriptors do not currently mix with the combination of local allocation and incremental collection. They should work correctly with one or the other, but not both. The number of marker threads is set on startup to the number of available -processors (or to the value of the `GC_NPROCS` environment variable). If only -a single processor is detected, parallel marking is disabled. +processor cores (or to the value of either `GC_MARKERS` or `GC_NPROCS` +environment variable, if provided). If only a single processor is detected, +parallel marking is disabled. Note that setting `GC_NPROCS` to 1 also causes some lock acquisitions inside the collector to immediately yield the processor instead of busy waiting @@ -112,15 +114,15 @@ modified to run multiple concurrent client threads in the same address space. Each client thread does the same work as the original benchmark, but they share a heap. This benchmark involves very little work outside of memory -allocation. This was run with GC 6.0alpha3 on a dual processor Pentium III/500 -machine under Linux 2.2.12. +allocation. This was run with an ancient GC (released in 2000) on a dual +processor Pentium III/500 machine under Linux 2.2.12. Running with a thread-unsafe collector, the benchmark ran in 9 seconds. With the simple thread-safe collector, built with `-DGC_THREADS`, the execution time increased to 10.3 seconds, or 23.5 elapsed seconds with two clients. (The times for the `malloc`/`free` version with glibc `malloc` are 10.51 (standard library, pthreads not linked), 20.90 (one thread, pthreads linked), and 24.55 -seconds respectively. The benchmark favors a garbage collector, since most +seconds, respectively. The benchmark favors a garbage collector, since most objects are small.) The following table gives execution times for the collector built with @@ -164,7 +166,7 @@ kind of hardware even with such a small number of processors, since the memory system is a major constraint for the garbage collector, the processors usually share a single memory bus, and thus the aggregate memory bandwidth does not -increase in proportion to the number of processors. +increase in proportion to the number of processors (cores). These results are likely to be very sensitive to both hardware and OS issues. Preliminary experiments with an older Pentium Pro machine running an older
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/simple_example.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/simple_example.md
Changed
@@ -137,8 +137,8 @@ Additional debug checks can be performed by defining `GC_DEBUG` before including `gc.h`. Additional options are available if the collector is also -built with `--enable-gc-debug` (`--enable-full-debug` in some older versions) -and all allocations are performed with `GC_DEBUG` defined. +built with `--enable-gc-debug` and all allocations are performed with +`GC_DEBUG` defined. ### What if I can't rewrite/recompile my program?
View file
_service:tar_scm:gc-8.0.6.tar.gz/doc/tree.md -> _service:tar_scm:gc-8.2.2.tar.gz/doc/tree.md
Changed
@@ -77,99 +77,101 @@ ## A picture -The following is an _ASCII_ diagram of the data structure used by GC_base (as -of GC v3.7, Apr 21, 1994). This was contributed by Dave Barrett. - - - 63 LOG_TOP_SZ11 LOG_BOTTOM_SZ10 LOG_HBLKSIZE13 - +------------------+----------------+------------------+------------------+ - p:| | TL_HASH(hi) | | HBLKDISPL(p) | - +------------------+----------------+------------------+------------------+ - \-----------------------HBLKPTR(p)-------------------/ - \------------hi-------------------/ - \______ ________/ \________ _______/ \________ _______/ - V V V - | | | - GC_top_index | | | - --- +--------------+ | | | - ^ | | | | | - | | | | | | - TOP +--------------+<--+ | | - _SZ +-<| | * | | - (items)| +--------------+ if 0 < bi< HBLKSIZE | | - | | | | then large object | | - | | | | starts at the bi'th | | - v | | | HBLK before p. | i | - --- | +--------------+ | (word- | - v | aligned) | - bi= |GET_BI(p){->hash_link}->key==hi | | - v | | - | (bottom_index) \ scratch_alloc'd | | - | ( struct bi ) / by get_index() | | - --- +->+--------------+ | | - ^ | | | | - ^ | | | | - BOTTOM | | ha=GET_HDR_ADDR(p) | | - _SZ(items)+--------------+<----------------------+ +-------+ - | +--<| index | | - | | +--------------+ GC_obj_map: v - | | | | from / +-+-+-----+-+-+-+-+ --- - v | | | GC_add < 0| | | | | | | | ^ - --- | +--------------+ _map_entry \ +-+-+-----+-+-+-+-+ | - | | asc_link | +-+-+-----+-+-+-+-+ MAXOBJSZ - | +--------------+ +-->| | | j | | | | | +1 - | | key | | +-+-+-----+-+-+-+-+ | - | +--------------+ | +-+-+-----+-+-+-+-+ | - | | hash_link | | | | | | | | | | v - | +--------------+ | +-+-+-----+-+-+-+-+ --- - | | |<--MAX_OFFSET--->| - | | (bytes) - HDR(p)| GC_find_header(p) | |<--MAP_ENTRIES-->| - | \ from | =HBLKSIZE/WORDSZ - | (hdr) (struct hblkhdr) / alloc_hdr() | (1024 on Alpha) - +-->+----------------------+ | (8/16 bits each) - GET_HDR(p)| word hb_sz (words) | | - +----------------------+ | - | struct hblk *hb_next | | - +----------------------+ | - |mark_proc hb_mark_proc| | - +----------------------+ | - | char * hb_map |>-------------+ - +----------------------+ - | ushort hb_obj_kind | - +----------------------+ - | hb_last_reclaimed | - --- +----------------------+ - ^ | | - MARK_BITS| hb_marks | * if hdr is free, hb_sz is the size of - _SZ(words)| | a heap chunk (struct hblk) of at least - v | | MININCR*HBLKSIZE bytes (below), - --- +----------------------+ otherwise, size of each object in chunk. +The following is an _ASCII_ diagram of the data structure used by GC_base. This was +contributed originally by Dave Barrett. + + + 63 LOG_TOP_SZ11 LOG_BOTTOM_SZ10 LOG_HBLKSIZE13 + +------------------+----------------+------------------+------------------+ + p:| | TL_HASH(hi) | | HBLKDISPL(p) | + +------------------+----------------+------------------+------------------+ + \-----------------------HBLKPTR(p)-------------------/ + \------------hi-------------------/ + \______ ________/ \________ _______/ \________ _______/ + V V V + | | | + GC_top_index | | | + --- +--------------+ | | | + ^ | | | | | + | | | | | | + TOP_SZ +--------------+<--+ | | + (items)+-<| | * | | + | | +--------------+ if 0 < bi< HBLKSIZE | | + | | | | then large object | | + | | | | starts at the bi'th | | + v | | | hblk before p. | i | + --- | +--------------+ | (word- | + v | aligned) | + bi= |GET_BI(p){->hash_link}->key==hi | | + v | | + | (bottom_index) \ scratch_alloc'd | | + | ( struct bi ) / by get_index() | | + --- +->+--------------+ | | + ^ | | | | + | | | | | + BOTTOM_SZ | | ha=GET_HDR_ADDR(p) | | + (items) +--------------+<----------------------+ +-------+ + | +--<| index | | + | | +--------------+ GC_obj_map: v + | | | | from / +-+-+-----+-+-+-+-+ --- + v | | | GC_add_map_entry <0| | | | | | | | ^ + --- | +--------------+ \ +-+-+-----+-+-+-+-+ | + | | asc_link | +-+-+-----+-+-+-+-+ MAXOBJGRANULES + | +--------------+ +-->| | | j | | | | | +1 + | | key | | +-+-+-----+-+-+-+-+ | + | +--------------+ | +-+-+-----+-+-+-+-+ | + | | hash_link | | | | | | | | | | v + | +--------------+ | +-+-+-----+-+-+-+-+ --- + | | |<----MAP_LEN---->| + | | =HBLKSIZE/GRANULE_BYTES + HDR(p)| GC_find_header(p) | (1024 on Alpha) + | \ from | (8/16 bits each) + | (hdr) (struct hblkhdr) / alloc_hdr() | + +--->+----------------------+ | + GET_HDR(p)| word hb_sz (words) | | + +----------------------+ | + | struct hblk *hb_next | | + +----------------------+ | + | word hb_descr | | + +----------------------+ | + | char * hb_map |>------------+ + +----------------------+ + | uchar hb_obj_kind | + +----------------------+ + | uchar hb_flags | + +----------------------+ + | hb_last_reclaimed | + --- +----------------------+ + ^ | | + MARK_BITS_SZ| hb_marks | * if hdr is free, hb_sz is the size of + (words) | | a heap chunk (struct hblk) of at least + v | | MININCR*HBLKSIZE bytes (below), + --- +----------------------+ otherwise, size of each object in chunk. Dynamic data structures above are interleaved throughout the heap in blocks of size `MININCR * HBLKSIZE` bytes as done by `gc_scratch_alloc` which cannot -be freed; free lists are used (e.g. `alloc_hdr`). `HBLK`'s below are +be freed; free lists are used (e.g. `alloc_hdr`). `hblk`'s below are collected. - (struct hblk) HDR_BYTES - --- +----------------------+ < HBLKSIZE --- (bytes) - ^ +-----hb_body----------+ (and WORDSZ) ^ --- --- - | | | aligned | ^ ^ - | | | | hb_sz | - | | | | (words) | - | | Object 0 | | | | - | | | i |(word- v | - | + - - - - - - - - - - -+ --- (bytes)|aligned) --- | - | | | ^ | ^ | - | | | j (words) | | | - n * | Object 1 | v v hb_sz BODY_SZ - HBLKSIZE | |--------------- | (words) - (bytes) | | v MAX_OFFSET - | + - - - - - - - - - - -+ --- (bytes) - | | | !ALL_INTERIOR_POINTERS ^ | - | | | sets j only for hb_sz | - | | Object N | valid object offsets. | | - v | | All objects WORDSZ v v - --- +----------------------+ aligned. --- --- + (struct hblk) + --- +----------------------+ < HBLKSIZE --- + ^ +-----hb_body----------+ (and WORDSZ) ^ --- --- + | | | aligned | ^ ^ + | | | | hb_sz | + | | | | (words) | + | | Object 0 | | | | + | | | i |(word- v | + | + - - - - - - - - - - -+ --- (bytes)|aligned) --- | + | | | ^ | ^ | + | | | j (words) | | | + n * | Object 1 | v v hb_sz HBLKSIZE/BYTES_PER_WORD + HBLKSIZE | |--------------- | (words) + (bytes) | | v | + | + - - - - - - - - - - -+ --- | + | | | !ALL_INTERIOR_POINTERS ^ | + | | | sets j only for hb_sz | + | | Object N | valid object offsets. | | + v | | All objects WORDSZ- v v + --- +----------------------+ aligned. --- ---
View file
_service:tar_scm:gc-8.0.6.tar.gz/dyn_load.c -> _service:tar_scm:gc-8.2.2.tar.gz/dyn_load.c
Changed
@@ -1,6 +1,7 @@ /* * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1997 by Silicon Graphics. All rights reserved. + * Copyright (c) 2009-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -26,7 +27,7 @@ * But then not much of anything is safe in the presence of dlclose. */ -#if !defined(MACOS) && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) \ +#if !defined(MACOS) && !defined(GC_NO_TYPES) && !defined(SN_TARGET_PSP2) \ && !defined(_WIN32_WCE) && !defined(__CC_ARM) # include <sys/types.h> #endif @@ -58,10 +59,10 @@ && !defined(CYGWIN32) && !defined(MSWIN32) && !defined(MSWINCE) \ && !(defined(ALPHA) && defined(OSF1)) \ && !(defined(FREEBSD) && defined(__ELF__)) \ - && !((defined(LINUX) || defined(NACL)) && defined(__ELF__)) \ + && !(defined(LINUX) && defined(__ELF__)) \ && !(defined(NETBSD) && defined(__ELF__)) \ - && !defined(HAIKU) && !defined(HURD) \ && !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) \ + && !defined(HAIKU) && !defined(HURD) && !defined(NACL) \ && !defined(CPPCHECK) # error We only know how to find data segments of dynamic libraries for above. # error Additional SVR4 variants might not be too hard to add. @@ -88,10 +89,9 @@ # endif #endif /* OPENBSD */ -#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) \ +#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(NACL) \ || (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \ - || defined(NACL) || defined(NETBSD) \ - || defined(OPENBSD))) + || defined(NETBSD) || defined(OPENBSD))) # include <stddef.h> # if !defined(OPENBSD) && !defined(HOST_ANDROID) /* OpenBSD does not have elf.h file; link.h below is sufficient. */ @@ -150,8 +150,10 @@ # elif defined(NETBSD) || defined(OPENBSD) # if ELFSIZE == 32 # define ElfW(type) Elf32_##type -# else +# elif ELFSIZE == 64 # define ElfW(type) Elf64_##type +# else +# error Missing ELFSIZE define # endif # else # if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32 @@ -259,10 +261,9 @@ # endif /* !USE_PROC ... */ # endif /* SOLARISDL */ -#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) \ +#if defined(SCO_ELF) || defined(DGUX) || defined(HURD) || defined(NACL) \ || (defined(__ELF__) && (defined(LINUX) || defined(FREEBSD) \ - || defined(NACL) || defined(NETBSD) \ - || defined(OPENBSD))) + || defined(NETBSD) || defined(OPENBSD))) #ifdef USE_PROC_FOR_LIBRARIES @@ -305,10 +306,9 @@ } } -STATIC void GC_register_map_entries(char *maps) +STATIC void GC_register_map_entries(const char *maps) { - char *prot; - char *buf_ptr = maps; + const char *prot; ptr_t start, end; unsigned int maj_dev; ptr_t least_ha, greatest_ha; @@ -321,10 +321,9 @@ + GC_our_memoryGC_n_memory-1.hs_bytes; for (;;) { - buf_ptr = GC_parse_map_entry(buf_ptr, &start, &end, &prot, - &maj_dev, 0); - if (NULL == buf_ptr) - break; + maps = GC_parse_map_entry(maps, &start, &end, &prot, &maj_dev, 0); + if (NULL == maps) break; + if (prot1 == 'w') { /* This is a writable mapping. Add it to */ /* the root set unless it is already otherwise */ @@ -399,11 +398,7 @@ GC_INNER void GC_register_dynamic_libraries(void) { - char *maps = GC_get_maps(); - - if (NULL == maps) - ABORT("Failed to read /proc for library registration"); - GC_register_map_entries(maps); + GC_register_map_entries(GC_get_maps()); } /* We now take care of the main data segment ourselves: */ @@ -841,7 +836,7 @@ } if (ioctl(fd, PIOCNMAP, &needed_sz) < 0) { ABORT_ARG2("/proc PIOCNMAP ioctl failed", - ": fd = %d, errno = %d", fd, errno); + ": fd= %d, errno= %d", fd, errno); } if (needed_sz >= current_sz) { GC_scratch_recycle_no_gww(addr_map, @@ -857,7 +852,7 @@ ABORT_ARG3("/proc PIOCMAP ioctl failed", ": errcode= %d, needed_sz= %d, addr_map= %p", errno, needed_sz, (void *)addr_map); - }; + } if (GC_n_heap_sects > 0) { heap_end = GC_heap_sectsGC_n_heap_sects-1.hs_start + GC_heap_sectsGC_n_heap_sects-1.hs_bytes; @@ -919,6 +914,8 @@ } /* Don't keep cached descriptor, for now. Some kernels don't like us */ /* to keep a /proc file descriptor around during kill -9. */ + /* Otherwise, it should also require FD_CLOEXEC and proper handling */ + /* at fork (i.e. close because of the pid change). */ if (close(fd) < 0) ABORT("Couldn't close /proc file"); fd = -1; } @@ -927,11 +924,6 @@ # if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE -# include <windows.h> # include <stdlib.h> /* We traverse the entire address space and register all segments */ @@ -985,11 +977,12 @@ # ifdef DEBUG_VIRTUALQUERY void GC_dump_meminfo(MEMORY_BASIC_INFORMATION *buf) { - GC_printf("BaseAddress = 0x%lx, AllocationBase = 0x%lx," - " RegionSize = 0x%lx(%lu)\n", buf -> BaseAddress, - buf -> AllocationBase, buf -> RegionSize, buf -> RegionSize); - GC_printf("\tAllocationProtect = 0x%lx, State = 0x%lx, Protect = 0x%lx, " - "Type = 0x%lx\n", buf -> AllocationProtect, buf -> State, + GC_printf("BaseAddress= 0x%lx, AllocationBase= 0x%lx," + " RegionSize= 0x%lx(%lu)\n", + buf -> BaseAddress, buf -> AllocationBase, + buf -> RegionSize, buf -> RegionSize); + GC_printf("\tAllocationProtect= 0x%lx, State= 0x%lx, Protect= 0x%lx, " + "Type= 0x%lx\n", buf -> AllocationProtect, buf -> State, buf -> Protect, buf -> Type); } # endif /* DEBUG_VIRTUALQUERY */ @@ -1118,10 +1111,10 @@ # ifdef DL_VERBOSE GC_log_printf("---Module---\n"); - GC_log_printf("Module ID\t = %16ld\n", moduleinfo.lmi_modid); - GC_log_printf("Count of regions = %16d\n", moduleinfo.lmi_nregion); - GC_log_printf("flags for module = %16lx\n", moduleinfo.lmi_flags); - GC_log_printf("module pathname\t = \"%s\"\n", moduleinfo.lmi_name); + GC_log_printf("Module ID: %ld\n", moduleinfo.lmi_modid); + GC_log_printf("Count of regions: %d\n", moduleinfo.lmi_nregion); + GC_log_printf("Flags for module: %016lx\n", moduleinfo.lmi_flags); + GC_log_printf("Module pathname: \"%s\"\n", moduleinfo.lmi_name); # endif /* For each region in this module */ @@ -1138,14 +1131,12 @@ # ifdef DL_VERBOSE GC_log_printf("--- Region ---\n"); - GC_log_printf("Region number\t = %16ld\n", - regioninfo.lri_region_no); - GC_log_printf("Protection flags = %016x\n", regioninfo.lri_prot); - GC_log_printf("Virtual address\t = %16p\n", regioninfo.lri_vaddr); - GC_log_printf("Mapped address\t = %16p\n", - regioninfo.lri_mapaddr); - GC_log_printf("Region size\t = %16ld\n", regioninfo.lri_size); - GC_log_printf("Region name\t = \"%s\"\n", regioninfo.lri_name); + GC_log_printf("Region number: %ld\n", regioninfo.lri_region_no); + GC_log_printf("Protection flags: %016x\n", regioninfo.lri_prot); + GC_log_printf("Virtual address: %p\n", regioninfo.lri_vaddr); + GC_log_printf("Mapped address: %p\n", regioninfo.lri_mapaddr); + GC_log_printf("Region size: %ld\n", regioninfo.lri_size); + GC_log_printf("Region name: \"%s\"\n", regioninfo.lri_name); # endif
View file
_service:tar_scm:gc-8.0.6.tar.gz/extra/AmigaOS.c -> _service:tar_scm:gc-8.2.2.tar.gz/extra/AmigaOS.c
Changed
@@ -425,6 +425,9 @@ #endif } +# if defined(CPPCHECK) + if (GC_amiga_dontalloc) /* variable is actually used by AllocFunction */ +# endif GC_amiga_dontalloc=FALSE; return ret;
View file
_service:tar_scm:gc-8.0.6.tar.gz/extra/MacOS.c -> _service:tar_scm:gc-8.2.2.tar.gz/extra/MacOS.c
Changed
@@ -45,7 +45,9 @@ } fprintf(stderr, "Couldn't load the jump table."); exit(-1); - return 0; +# if !defined(CPPCHECK) + return 0; /* to avoid compiler complain about missing return */ +# endif } #ifdef USE_TEMPORARY_MEMORY @@ -95,8 +97,6 @@ return tempPtr; } -extern word GC_fo_entries; - static void perform_final_collection(void) { unsigned i; @@ -126,7 +126,7 @@ long totalMemoryUsed = 0; # endif TemporaryMemoryHandle tempMemBlock = theTemporaryMemory; - while (tempMemBlock != NULL) { + while (tempMemBlock /* != NULL */) { TemporaryMemoryHandle nextBlock = (**tempMemBlock).nextBlock; # if !defined(SHARED_LIBRARY_BUILD) totalMemoryUsed += GetHandleSize((Handle)tempMemBlock); @@ -161,7 +161,9 @@ } fprintf(stderr, "Couldn't load the jump table."); exit(-1); +# if !defined(CPPCHECK) return 0; +# endif } #endif /* __option(far_data) */
View file
_service:tar_scm:gc-8.0.6.tar.gz/extra/gc.c -> _service:tar_scm:gc-8.2.2.tar.gz/extra/gc.c
Changed
@@ -67,8 +67,12 @@ #include "../darwin_stop_world.c" #include "../dyn_load.c" #include "../gc_dlopen.c" -#include "../mach_dep.c" -#include "../pthread_stop_world.c" +#if !defined(PLATFORM_MACH_DEP) +# include "../mach_dep.c" +#endif +#if !defined(PLATFORM_STOP_WORLD) +# include "../pthread_stop_world.c" +#endif #include "../pthread_support.c" #include "../specific.c" #include "../win32_threads.c"
View file
_service:tar_scm:gc-8.0.6.tar.gz/extra/msvc_dbg.c -> _service:tar_scm:gc-8.2.2.tar.gz/extra/msvc_dbg.c
Changed
@@ -20,14 +20,18 @@ THE SOFTWARE. */ -#if !defined(_M_AMD64) && defined(_MSC_VER) +#if !defined(_M_ARM) && !defined(_M_ARM64) \ + && !defined(_M_X64) && defined(_MSC_VER) -/* X86_64 is currently missing some machine-dependent code below. */ +/* TODO: arm64, x86_64 currently miss some machine-dependent code below. */ +/* See also GC_HAVE_BUILTIN_BACKTRACE in gc_config_macros.h. */ #define GC_BUILD #include "private/msvc_dbg.h" #include "gc.h" +#include <stdio.h> + #ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN 1 #endif @@ -41,6 +45,10 @@ #pragma comment(lib, "dbghelp.lib") #pragma optimize("gy", off) +/* Disable a warning that /GS can not protect parameters and local */ +/* variables from local buffer overrun because optimizations are off. */ +#pragma warning(disable:4748) + typedef GC_word word; #define GC_ULONG_PTR word @@ -75,7 +83,7 @@ { MEMORY_BASIC_INFORMATION memoryInfo; ULONG_ADDR dwAddrBase = SymGetModuleBase(hProcess, dwAddress); - if (dwAddrBase) { + if (dwAddrBase != 0) { return dwAddrBase; } if (VirtualQueryEx(hProcess, (void*)(GC_ULONG_PTR)dwAddress, &memoryInfo, @@ -90,12 +98,11 @@ /* article Q189780. */ GetCurrentDirectoryA(sizeof(curDir), curDir); GetModuleFileNameA(NULL, exePath, sizeof(exePath)); -#if defined(_MSC_VER) && _MSC_VER == 1200 - /* use strcat for VC6 */ - strcat(exePath, "\\.."); -#else +#if _MSC_VER > 1200 strcat_s(exePath, sizeof(exePath), "\\.."); -#endif /* _MSC_VER >= 1200 */ +#else /* VC6 or earlier */ + strcat(exePath, "\\.."); +#endif SetCurrentDirectoryA(exePath); #ifdef _DEBUG GetCurrentDirectoryA(sizeof(exePath), exePath); @@ -308,11 +315,13 @@ return 0; } +#define GC_SNPRINTF _snprintf + size_t GetDescriptionFromAddress(void* address, const char* format, char* buffer, size_t size) { - char*const begin = buffer; - char*const end = buffer + size; + char* const begin = buffer; + char* const end = buffer + size; size_t line_number = 0; (void)format; @@ -323,9 +332,10 @@ size = (GC_ULONG_PTR)end < (GC_ULONG_PTR)buffer ? 0 : end - buffer; if (line_number) { - char str128; + char str20; - wsprintf(str, "(%d) : ", (int)line_number); + (void)GC_SNPRINTF(str, sizeof(str), "(%d) : ", (int)line_number); + strsizeof(str) - 1 = '\0'; if (size) { strncpy(buffer, str, size)size - 1 = 0; } @@ -393,4 +403,4 @@ extern int GC_quiet; /* ANSI C does not allow translation units to be empty. */ -#endif /* _M_AMD64 */ +#endif
View file
_service:tar_scm:gc-8.0.6.tar.gz/finalize.c -> _service:tar_scm:gc-8.2.2.tar.gz/finalize.c
Changed
@@ -3,7 +3,8 @@ * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (C) 2007 Free Software Foundation, Inc - + * Copyright (c) 2008-2020 Ivan Maidanski + * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * @@ -44,18 +45,6 @@ word dl_hidden_obj; /* Pointer to object base */ }; -struct dl_hashtbl_s { - struct disappearing_link **head; - signed_word log_size; - word entries; -}; - -STATIC struct dl_hashtbl_s GC_dl_hashtbl = { - /* head */ NULL, /* log_size */ -1, /* entries */ 0 }; -#ifndef GC_LONG_REFS_NOT_NEEDED - STATIC struct dl_hashtbl_s GC_ll_hashtbl = { NULL, -1, 0 }; -#endif - struct finalizable_object { struct hash_chain_entry prolog; # define fo_hidden_base prolog.hidden_key @@ -70,14 +59,6 @@ finalization_mark_proc fo_mark_proc; /* Mark-through procedure */ }; -static signed_word log_fo_table_size = -1; - -STATIC struct fnlz_roots_s { - struct finalizable_object **fo_head; - /* List of objects that should be finalized now: */ - struct finalizable_object *finalize_now; -} GC_fnlz_roots = { NULL, NULL }; - #ifdef AO_HAVE_store /* Update finalize_now atomically as GC_should_invoke_finalizers does */ /* not acquire the allocation lock. */ @@ -97,6 +78,7 @@ # endif GC_PUSH_ALL_SYM(GC_dl_hashtbl.head); GC_PUSH_ALL_SYM(GC_fnlz_roots); + /* GC_toggleref_arr is pushed specially by GC_mark_togglerefs. */ } /* Threshold of log_size to initiate full collection before growing */ @@ -110,13 +92,13 @@ /* *table is a pointer to an array of hash headers. If we succeed, we */ /* update both *table and *log_size_ptr. Lock is held. */ STATIC void GC_grow_table(struct hash_chain_entry ***table, - signed_word *log_size_ptr, word *entries_ptr) + unsigned *log_size_ptr, word *entries_ptr) { word i; struct hash_chain_entry *p; - signed_word log_old_size = *log_size_ptr; - signed_word log_new_size = log_old_size + 1; - word old_size = log_old_size == -1 ? 0 : (word)1 << log_old_size; + unsigned log_old_size = *log_size_ptr; + unsigned log_new_size = log_old_size + 1; + word old_size = *table == NULL ? 0 : (word)1 << log_old_size; word new_size = (word)1 << log_new_size; /* FIXME: Power of 2 size often gets rounded up to one more page. */ struct hash_chain_entry **new_table; @@ -188,15 +170,13 @@ if (EXPECT(GC_find_leak, FALSE)) return GC_UNIMPLEMENTED; LOCK(); GC_ASSERT(obj != NULL && GC_base_C(obj) == obj); - if (dl_hashtbl -> log_size == -1 - || dl_hashtbl -> entries > ((word)1 << dl_hashtbl -> log_size)) { + if (EXPECT(NULL == dl_hashtbl -> head, FALSE) + || EXPECT(dl_hashtbl -> entries + > ((word)1 << dl_hashtbl -> log_size), FALSE)) { GC_grow_table((struct hash_chain_entry ***)&dl_hashtbl -> head, &dl_hashtbl -> log_size, &dl_hashtbl -> entries); -# ifdef LINT2 - if (dl_hashtbl->log_size < 0) ABORT("log_size is negative"); -# endif GC_COND_LOG_PRINTF("Grew %s table to %u entries\n", tbl_log_name, - 1 << (unsigned)dl_hashtbl -> log_size); + 1U << dl_hashtbl -> log_size); } index = HASH2(link, dl_hashtbl -> log_size); for (curr_dl = dl_hashtbl -> headindex; curr_dl != 0; @@ -270,10 +250,9 @@ size_t index; GC_ASSERT(I_HOLD_LOCK()); - if (dl_hashtbl->log_size == -1) - return NULL; /* prevent integer shift by a negative amount */ + if (EXPECT(NULL == dl_hashtbl -> head, FALSE)) return NULL; - index = HASH2(link, dl_hashtbl->log_size); + index = HASH2(link, dl_hashtbl -> log_size); for (curr_dl = dl_hashtbl -> headindex; curr_dl; curr_dl = dl_next(curr_dl)) { if (curr_dl -> dl_hidden_link == GC_HIDE_POINTER(link)) { @@ -310,21 +289,14 @@ /* Toggle-ref support. */ #ifndef GC_TOGGLE_REFS_NOT_NEEDED - typedef union { - /* Lowest bit is used to distinguish between choices. */ - void *strong_ref; - GC_hidden_pointer weak_ref; - } GCToggleRef; + typedef union toggle_ref_u GCToggleRef; STATIC GC_toggleref_func GC_toggleref_callback = 0; - STATIC GCToggleRef *GC_toggleref_arr = NULL; - STATIC int GC_toggleref_array_size = 0; - STATIC int GC_toggleref_array_capacity = 0; GC_INNER void GC_process_togglerefs(void) { - int i; - int new_size = 0; + size_t i; + size_t new_size = 0; GC_bool needs_barrier = FALSE; GC_ASSERT(I_HOLD_LOCK()); @@ -380,11 +352,10 @@ STATIC void GC_mark_togglerefs(void) { - int i; + size_t i; if (NULL == GC_toggleref_arr) return; - /* TODO: Hide GC_toggleref_arr to avoid its marking from roots. */ GC_set_mark_bit(GC_toggleref_arr); for (i = 0; i < GC_toggleref_array_size; ++i) { void *obj = GC_toggleref_arri.strong_ref; @@ -396,7 +367,7 @@ STATIC void GC_clear_togglerefs(void) { - int i; + size_t i; for (i = 0; i < GC_toggleref_array_size; ++i) { if ((GC_toggleref_arri.weak_ref & 1) != 0) { if (!GC_is_marked(GC_REVEAL_POINTER(GC_toggleref_arri.weak_ref))) { @@ -428,9 +399,8 @@ return fn; } - static GC_bool ensure_toggleref_capacity(int capacity_inc) + static GC_bool ensure_toggleref_capacity(size_t capacity_inc) { - GC_ASSERT(capacity_inc >= 0); GC_ASSERT(I_HOLD_LOCK()); if (NULL == GC_toggleref_arr) { GC_toggleref_array_capacity = 32; /* initial capacity */ @@ -440,14 +410,15 @@ if (NULL == GC_toggleref_arr) return FALSE; } - if ((unsigned)GC_toggleref_array_size + (unsigned)capacity_inc - >= (unsigned)GC_toggleref_array_capacity) { + if (GC_toggleref_array_size + capacity_inc + >= GC_toggleref_array_capacity) { GCToggleRef *new_array; - while ((unsigned)GC_toggleref_array_capacity - < (unsigned)GC_toggleref_array_size + (unsigned)capacity_inc) { + while (GC_toggleref_array_capacity + < GC_toggleref_array_size + capacity_inc) { GC_toggleref_array_capacity *= 2; - if (GC_toggleref_array_capacity < 0) /* overflow */ - return FALSE; + if ((GC_toggleref_array_capacity + & ((size_t)1 << (sizeof(size_t) * 8 - 1))) != 0) + return FALSE; /* overflow */ } new_array = (GCToggleRef *)GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE( @@ -541,31 +512,26 @@ struct dl_hashtbl_s *dl_hashtbl, void **link, void **new_link) { - struct disappearing_link *curr_dl, *prev_dl, *new_dl; + struct disappearing_link *curr_dl, *new_dl; + struct disappearing_link *prev_dl = NULL; size_t curr_index, new_index; - word curr_hidden_link; - word new_hidden_link; + word curr_hidden_link, new_hidden_link; GC_ASSERT(I_HOLD_LOCK()); - if (dl_hashtbl->log_size == -1) - return GC_NOT_FOUND; /* prevent integer shift by a negative amount */ + if (EXPECT(NULL == dl_hashtbl -> head, FALSE)) return GC_NOT_FOUND;
View file
_service:tar_scm:gc-8.0.6.tar.gz/fnlz_mlc.c -> _service:tar_scm:gc-8.2.2.tar.gz/fnlz_mlc.c
Changed
@@ -20,8 +20,6 @@ #include "gc_inline.h" /* for GC_malloc_kind */ #include "private/dbg_mlc.h" /* for oh type */ -STATIC int GC_finalized_kind = 0; - #if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH) /* The first bit is already used for a debug purpose. */ # define FINALIZER_CLOSURE_FLAG 0x2 @@ -31,7 +29,11 @@ STATIC int GC_CALLBACK GC_finalized_disclaim(void *obj) { - word fc_word = *(word *)obj; +# ifdef AO_HAVE_load + word fc_word = (word)AO_load((volatile AO_t *)obj); +# else + word fc_word = *(word *)obj; +# endif if ((fc_word & FINALIZER_CLOSURE_FLAG) != 0) { /* The disclaim function may be passed fragments from the */ @@ -96,19 +98,22 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_finalized_malloc(size_t lb, const struct GC_finalizer_closure *fclos) { - word *op; + void *op; GC_ASSERT(GC_finalized_kind != 0); GC_ASSERT(NONNULL_ARG_NOT_NULL(fclos)); GC_ASSERT(((word)fclos & FINALIZER_CLOSURE_FLAG) == 0); - op = (word *)GC_malloc_kind(SIZET_SAT_ADD(lb, sizeof(word)), - GC_finalized_kind); + op = GC_malloc_kind(SIZET_SAT_ADD(lb, sizeof(word)), GC_finalized_kind); if (EXPECT(NULL == op, FALSE)) return NULL; - *op = (word)fclos | FINALIZER_CLOSURE_FLAG; +# ifdef AO_HAVE_store + AO_store((volatile AO_t *)op, (AO_t)fclos | FINALIZER_CLOSURE_FLAG); +# else + *(word *)op = (word)fclos | FINALIZER_CLOSURE_FLAG; +# endif GC_dirty(op); REACHABLE_AFTER_DIRTY(fclos); - return op + 1; + return (word *)op + 1; } #endif /* ENABLE_DISCLAIM */
View file
_service:tar_scm:gc-8.2.2.tar.gz/gc_badalc.cc
Added
@@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018-2020 Ivan Maidanski + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +// This file provides the implementation of GC_throw_bad_alloc() which +// is invoked by GC operator "new" in case of an out-of-memory event. + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifndef GC_BUILD +# define GC_BUILD +#endif + +#define GC_DONT_INCL_WINDOWS_H +#include "gc.h" + +#include <new> // for bad_alloc, precedes include of gc_cpp.h + +#if defined(GC_NEW_ABORTS_ON_OOM) || defined(_LIBCPP_NO_EXCEPTIONS) +# define GC_ALLOCATOR_THROW_OR_ABORT() GC_abort_on_oom() +#else +# define GC_ALLOCATOR_THROW_OR_ABORT() throw std::bad_alloc() +#endif + +GC_API void GC_CALL GC_throw_bad_alloc() { + GC_ALLOCATOR_THROW_OR_ABORT(); +}
View file
_service:tar_scm:gc-8.2.2.tar.gz/gc_badalc.cpp
Added
@@ -0,0 +1,2 @@ +// Visual C++ seems to prefer a .cpp extension to .cc one. +#include "gc_badalc.cc"
View file
_service:tar_scm:gc-8.0.6.tar.gz/gc_cpp.cc -> _service:tar_scm:gc-8.2.2.tar.gz/gc_cpp.cc
Changed
@@ -4,8 +4,11 @@ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * - * Permission is hereby granted to copy this code for any purpose, - * provided the above notices are retained on all copies. + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ /************************************************************************* @@ -32,20 +35,17 @@ #include <new> // for bad_alloc, precedes include of gc_cpp.h -#include "gc_cpp.h" // for GC_OPERATOR_NEW_ARRAY, GC_NOEXCEPT +#include "gc_cpp.h" // for GC_OPERATOR_NEW_ARRAY + +#if !(defined(_MSC_VER) || defined(__DMC__)) || defined(GC_NO_INLINE_STD_NEW) #if defined(GC_NEW_ABORTS_ON_OOM) || defined(_LIBCPP_NO_EXCEPTIONS) # define GC_ALLOCATOR_THROW_OR_ABORT() GC_abort_on_oom() #else +// Use bad_alloc() directly instead of GC_throw_bad_alloc() call. # define GC_ALLOCATOR_THROW_OR_ABORT() throw std::bad_alloc() #endif -GC_API void GC_CALL GC_throw_bad_alloc() { - GC_ALLOCATOR_THROW_OR_ABORT(); -} - -#if !(defined(_MSC_VER) || defined(__DMC__)) || defined(GC_NO_INLINE_STD_NEW) - # if !defined(GC_NEW_DELETE_THROW_NOT_NEEDED) \ && !defined(GC_NEW_DELETE_NEED_THROW) && GC_GNUC_PREREQ(4, 2) \ && (__cplusplus < 201103L || defined(__clang__))
View file
_service:tar_scm:gc-8.0.6.tar.gz/gc_dlopen.c -> _service:tar_scm:gc-8.2.2.tar.gz/gc_dlopen.c
Changed
@@ -46,7 +46,9 @@ DCL_LOCK_STATE; LOCK(); while (GC_incremental && GC_collection_in_progress()) { + ENTER_GC(); GC_collect_a_little_inner(1000); + EXIT_GC(); } ++GC_dont_gc; UNLOCK();
View file
_service:tar_scm:gc-8.0.6.tar.gz/gcj_mlc.c -> _service:tar_scm:gc-8.2.2.tar.gz/gcj_mlc.c
Changed
@@ -39,21 +39,12 @@ #include "gc_gcj.h" #include "private/dbg_mlc.h" -#ifdef GC_ASSERTIONS - GC_INNER /* variable is also used in thread_local_alloc.c */ -#else - STATIC -#endif -GC_bool GC_gcj_malloc_initialized = FALSE; - int GC_gcj_kind = 0; /* Object kind for objects with descriptors */ /* in "vtable". */ int GC_gcj_debug_kind = 0; /* The kind of objects that is always marked */ /* with a mark proc call. */ -GC_INNER ptr_t * GC_gcjobjfreelist = NULL; - STATIC struct GC_ms_entry * GC_gcj_fake_mark_proc(word * addr GC_ATTR_UNUSED, struct GC_ms_entry *mark_stack_ptr, struct GC_ms_entry * mark_stack_limit GC_ATTR_UNUSED, @@ -77,11 +68,11 @@ GC_init(); /* In case it's not already done. */ LOCK(); - if (GC_gcj_malloc_initialized) { + if (GC_gcjobjfreelist != NULL) { + /* Already initialized. */ UNLOCK(); return; } - GC_gcj_malloc_initialized = TRUE; # ifdef GC_IGNORE_GCJ_INFO /* This is useful for debugging on platforms with missing getenv(). */ # define ignore_gcj_info TRUE @@ -96,30 +87,27 @@ if ((unsigned)mp_index >= GC_n_mark_procs) ABORT("GC_init_gcj_malloc: bad index"); /* Set up object kind gcj-style indirect descriptor. */ - GC_gcjobjfreelist = (ptr_t *)GC_new_free_list_inner(); - if (ignore_gcj_info) { + GC_gcjobjfreelist = (ptr_t *)GC_new_free_list_inner(); + if (ignore_gcj_info) { /* Use a simple length-based descriptor, thus forcing a fully */ /* conservative scan. */ GC_gcj_kind = GC_new_kind_inner((void **)GC_gcjobjfreelist, /* 0 | */ GC_DS_LENGTH, TRUE, TRUE); - } else { + GC_gcj_debug_kind = GC_gcj_kind; + } else { GC_gcj_kind = GC_new_kind_inner( (void **)GC_gcjobjfreelist, (((word)(-(signed_word)MARK_DESCR_OFFSET - GC_INDIR_PER_OBJ_BIAS)) | GC_DS_PER_OBJECT), FALSE, TRUE); - } - /* Set up object kind for objects that require mark proc call. */ - if (ignore_gcj_info) { - GC_gcj_debug_kind = GC_gcj_kind; - } else { + /* Set up object kind for objects that require mark proc call. */ GC_gcj_debug_kind = GC_new_kind_inner(GC_new_free_list_inner(), GC_MAKE_PROC(mp_index, 1 /* allocated with debug info */), FALSE, TRUE); - } + } UNLOCK(); # undef ignore_gcj_info }
View file
_service:tar_scm:gc-8.0.6.tar.gz/headers.c -> _service:tar_scm:gc-8.2.2.tar.gz/headers.c
Changed
@@ -24,14 +24,6 @@ * level tree. */ -STATIC bottom_index * GC_all_bottom_indices = 0; - /* Pointer to the first (lowest address) */ - /* bottom_index. Assumes the lock is held. */ - -STATIC bottom_index * GC_all_bottom_indices_end = 0; - /* Pointer to the last (highest address) */ - /* bottom_index. Assumes the lock is held. */ - /* Non-macro version of header location routine */ GC_INNER hdr * GC_find_header(ptr_t h) { @@ -110,14 +102,9 @@ /* Routines to dynamically allocate collector data structures that will */ /* never be freed. */ -static ptr_t scratch_free_ptr = 0; - -/* GC_scratch_last_end_ptr is end point of last obtained scratch area. */ -/* GC_scratch_end_ptr is end point of current scratch area. */ - GC_INNER ptr_t GC_scratch_alloc(size_t bytes) { - ptr_t result = scratch_free_ptr; + ptr_t result = GC_scratch_free_ptr; size_t bytes_to_get; bytes = ROUNDUP_GRANULE_SIZE(bytes); @@ -125,19 +112,23 @@ GC_ASSERT((word)GC_scratch_end_ptr >= (word)result); if (bytes <= (word)GC_scratch_end_ptr - (word)result) { /* Unallocated space of scratch buffer has enough size. */ - scratch_free_ptr = result + bytes; + GC_scratch_free_ptr = result + bytes; return result; } + GC_ASSERT(GC_page_size != 0); if (bytes >= MINHINCR * HBLKSIZE) { bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(bytes); result = (ptr_t)GET_MEM(bytes_to_get); - GC_add_to_our_memory(result, bytes_to_get); - /* No update of scratch free area pointer; get memory directly. */ if (result != NULL) { + GC_add_to_our_memory(result, bytes_to_get); + /* No update of scratch free area pointer; */ + /* get memory directly. */ +# ifdef USE_SCRATCH_LAST_END_PTR /* Update end point of last obtained area (needed only */ /* by GC_register_dynamic_libraries for some targets). */ GC_scratch_last_end_ptr = result + bytes; +# endif } return result; } @@ -145,44 +136,49 @@ bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(MINHINCR * HBLKSIZE); /* round up for safety */ result = (ptr_t)GET_MEM(bytes_to_get); - GC_add_to_our_memory(result, bytes_to_get); - if (NULL == result) { + if (EXPECT(NULL == result, FALSE)) { WARN("Out of memory - trying to allocate requested amount" " (%" WARN_PRIdPTR " bytes)...\n", (word)bytes); bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(bytes); result = (ptr_t)GET_MEM(bytes_to_get); - GC_add_to_our_memory(result, bytes_to_get); - if (result != NULL) + if (result != NULL) { + GC_add_to_our_memory(result, bytes_to_get); +# ifdef USE_SCRATCH_LAST_END_PTR GC_scratch_last_end_ptr = result + bytes; +# endif + } return result; } + + GC_add_to_our_memory(result, bytes_to_get); + /* TODO: some amount of unallocated space may remain unused forever */ /* Update scratch area pointers and retry. */ - scratch_free_ptr = result; - GC_scratch_end_ptr = scratch_free_ptr + bytes_to_get; - GC_scratch_last_end_ptr = GC_scratch_end_ptr; + GC_scratch_free_ptr = result; + GC_scratch_end_ptr = GC_scratch_free_ptr + bytes_to_get; +# ifdef USE_SCRATCH_LAST_END_PTR + GC_scratch_last_end_ptr = GC_scratch_end_ptr; +# endif } } -static hdr * hdr_free_list = 0; - /* Return an uninitialized header */ static hdr * alloc_hdr(void) { hdr * result; - if (NULL == hdr_free_list) { + if (NULL == GC_hdr_free_list) { result = (hdr *)GC_scratch_alloc(sizeof(hdr)); } else { - result = hdr_free_list; - hdr_free_list = (hdr *) (result -> hb_next); + result = GC_hdr_free_list; + GC_hdr_free_list = (hdr *) result -> hb_next; } return(result); } GC_INLINE void free_hdr(hdr * hhdr) { - hhdr -> hb_next = (struct hblk *) hdr_free_list; - hdr_free_list = hhdr; + hhdr -> hb_next = (struct hblk *) GC_hdr_free_list; + GC_hdr_free_list = hhdr; } #ifdef COUNT_HDR_CACHE_HITS @@ -195,6 +191,7 @@ { unsigned i; + GC_ASSERT(NULL == GC_all_nils); GC_all_nils = (bottom_index *)GC_scratch_alloc(sizeof(bottom_index)); if (GC_all_nils == NULL) { GC_err_printf("Insufficient memory for GC_all_nils\n"); @@ -313,6 +310,15 @@ { struct hblk * hbp; + if (sz <= HBLKSIZE) return; + if (HDR(h+1) == 0) { +# ifdef GC_ASSERTIONS + for (hbp = h+2; (word)hbp < (word)h + sz; hbp++) + GC_ASSERT(HDR(hbp) == 0); +# endif + return; + } + for (hbp = h+1; (word)hbp < (word)h + sz; hbp += 1) { SET_HDR(hbp, 0); }
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/config.h.in -> _service:tar_scm:gc-8.2.2.tar.gz/include/config.h.in
Changed
@@ -17,6 +17,9 @@ /* Define to force debug headers on all objects. */ #undef DBG_HDRS_ALL +/* Do not use user32.dll import library (Win32). */ +#undef DONT_USE_USER32_DLL + /* Define to enable eCos target support. */ #undef ECOS @@ -32,7 +35,7 @@ /* Define to enable atomic uncollectible allocation. */ #undef GC_ATOMIC_UNCOLLECTABLE -/* Use C11 (GCC) atomic intrinsics instead of libatomic_ops primitives. */ +/* Use GCC atomic intrinsics instead of libatomic_ops primitives. */ #undef GC_BUILTIN_ATOMIC /* Define to build dynamic libraries with only API symbols exposed. */ @@ -110,6 +113,16 @@ /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H +/* Define to use 'pthread_setname_np(const char*)' function. */ +#undef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID + +/* Define to use 'pthread_setname_np(pthread_t, const char*)' function. */ +#undef HAVE_PTHREAD_SETNAME_NP_WITH_TID + +/* Define to use 'pthread_setname_np(pthread_t, const char*, void *)' + function. */ +#undef HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/cord.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/cord.h
Changed
@@ -26,7 +26,7 @@ * - A text editor that converts the input file to a cord, and then * performs editing operations by producing a new cord representing * the file after each character change (and keeping the old ones in an - * edit history) + * edit history). * * For optimal performance, cords should be built by * concatenating short sections. @@ -44,14 +44,15 @@ * CORD_cat(cord1,cord2) - concatenation of two cords; * CORD_substr(cord, start, len) - substring (or subcord); * CORD_pos i; CORD_FOR(i, cord) { ... CORD_pos_fetch(i) ... } - - * examine each character in a cord. CORD_pos_fetch(i) is the char. - * CORD_fetch(int i) - Retrieve i'th character (slowly). - * CORD_cmp(cord1, cord2) - compare two cords. - * CORD_from_file(FILE * f) - turn a read-only file into a cord. - * CORD_to_char_star(cord) - convert to C string. - * (Non-NULL C constant strings are cords.) - * CORD_printf (etc.) - cord version of printf. Use %r for cords. + * examine each character in a cord (CORD_pos_fetch(i) is the char); + * CORD_fetch(int i) - Retrieve i'th character (slowly); + * CORD_cmp(cord1, cord2) - compare two cords; + * CORD_from_file(FILE * f) - turn a read-only file into a cord; + * CORD_to_char_star(cord) - convert to C string + * (non-NULL C constant strings are cords); + * CORD_printf (etc.) - cord version of printf (use %r for cords). */ + #ifndef CORD_H #define CORD_H @@ -97,7 +98,7 @@ typedef const char * CORD; -/* An empty cord is always represented as nil */ +/* An empty cord is always represented as nil. */ #define CORD_EMPTY 0 /* Is a nonempty cord represented as a C string? */ @@ -114,10 +115,10 @@ /* not be altered by the caller. */ CORD_API CORD CORD_cat_char_star(CORD x, const char * y, size_t leny); -/* Compute the length of a cord */ +/* Compute the length of a cord. */ CORD_API size_t CORD_len(CORD x); -/* Cords may be represented by functions defining the ith character */ +/* Cords may be represented by functions defining the ith character. */ typedef char (* CORD_fn)(size_t i, void * client_data); /* Turn a functional description into a cord. */ @@ -152,8 +153,8 @@ #define CORD_NO_FN ((CORD_batched_iter_fn)0) /* Apply f1 to each character in the cord, in ascending order, */ -/* starting at position i. If */ -/* f2 is not CORD_NO_FN, then multiple calls to f1 may be replaced by */ +/* starting at position i. If f2 is not CORD_NO_FN, then */ +/* multiple calls to f1 may be replaced by */ /* a single call to f2. The parameter f2 is provided only to allow */ /* some optimization by the client. This terminates when the right */ /* end of this string is reached, or when f1 or f2 return != 0. In the */ @@ -162,15 +163,15 @@ CORD_API int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1, CORD_batched_iter_fn f2, void * client_data); -/* A simpler version that starts at 0, and without f2: */ +/* A simpler version that starts at 0, and without f2. */ CORD_API int CORD_iter(CORD x, CORD_iter_fn f1, void * client_data); #define CORD_iter(x, f1, cd) CORD_iter5(x, 0, f1, CORD_NO_FN, cd) -/* Similar to CORD_iter5, but end-to-beginning. No provisions for */ +/* Similar to CORD_iter5, but end-to-beginning. No provisions for */ /* CORD_batched_iter_fn. */ CORD_API int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data); -/* A simpler version that starts at the end: */ +/* A simpler version that starts at the end. */ CORD_API int CORD_riter(CORD x, CORD_iter_fn f1, void * client_data); #ifdef __cplusplus @@ -184,9 +185,9 @@ /* positions are big (order of a few 100 bytes), so allocate them with */ /* caution. */ /* Things in cord_pos.h should be treated as opaque, except as */ -/* described below. Also note that */ -/* CORD_pos_fetch, CORD_next and CORD_prev have both macro and function */ -/* definitions. The former may evaluate their argument more than once. */ +/* described below. Also, note that CORD_pos_fetch, CORD_next and */ +/* CORD_prev have both macro and function definitions. The former */ +/* may evaluate their argument more than once. */ #include "cord_pos.h" #ifdef __cplusplus @@ -245,10 +246,10 @@ /* Concatenate n cords. */ CORD_API CORD CORD_catn(int n, /* CORD */ ...); -/* Return the character in CORD_substr(x, i, 1) */ +/* Return the character in CORD_substr(x, i, 1). */ CORD_API char CORD_fetch(CORD x, size_t i); -/* Return < 0, 0, or > 0, depending on whether x < y, x = y, x > y */ +/* Return < 0, 0, or > 0, depending on whether x < y, x = y, x > y. */ CORD_API int CORD_cmp(CORD x, CORD y); /* A generalization that takes both starting positions for the */ @@ -276,13 +277,13 @@ /* We must have exclusive access to the descriptor f, i.e. we may */ /* read it at any time, and expect the file pointer to be */ /* where we left it. Normally this should be invoked as */ -/* CORD_from_file(fopen(...)) */ +/* CORD_from_file(fopen(...)). */ /* CORD_from_file arranges to close the file descriptor when it is no */ /* longer needed (e.g. when the result becomes inaccessible). */ /* The file f must be such that ftell reflects the actual character */ /* position in the file, i.e. the number of characters that can be */ -/* or were read with fread. On UNIX systems this is always true. On */ -/* MS Windows systems, f must be opened in binary mode. */ +/* or were read with fread. On UNIX systems this is always true. */ +/* On MS Windows systems, f must be opened in binary mode. */ CORD_API CORD CORD_from_file(FILE * f); /* Equivalent to the above, except that the entire file will be read */ @@ -290,8 +291,8 @@ /* The binary mode restriction from above does not apply. */ CORD_API CORD CORD_from_file_eager(FILE * f); -/* Equivalent to the above, except that the file will be read on demand.*/ -/* The binary mode restriction applies. */ +/* Equivalent to the above, except that the file will be read on */ +/* demand. The binary mode restriction applies. */ CORD_API CORD CORD_from_file_lazy(FILE * f); /* Turn a cord into a C string. The result shares no structure with */ @@ -306,8 +307,8 @@ /* the argument and is thus not modifiable. */ CORD_API const char * CORD_to_const_char_star(CORD x); -/* Write a cord to a file, starting at the current position. No */ -/* trailing NULs are newlines are added. */ +/* Write a cord to a file, starting at the current position. */ +/* No trailing NULs are newlines are added. */ /* Returns EOF if a write error occurs, 1 otherwise. */ CORD_API int CORD_put(CORD x, FILE * f); @@ -316,11 +317,11 @@ /* A vague analog of strchr. Returns the position (an integer, not */ /* a pointer) of the first occurrence of (char) c inside x at position */ -/* i or later. The value i must be < CORD_len(x). */ +/* i or later. The value i must be < CORD_len(x). */ CORD_API size_t CORD_chr(CORD x, size_t i, int c); /* A vague analog of strrchr. Returns index of the last occurrence */ -/* of (char) c inside x at position i or earlier. The value i */ +/* of (char) c inside x at position i or earlier. The value i */ /* must be < CORD_len(x). */ CORD_API size_t CORD_rchr(CORD x, size_t i, int c); @@ -337,8 +338,8 @@ /* (Note that %c, %C, and %S were already taken.) */ /* 2. The format string is represented as a CORD. */ /* 3. CORD_sprintf and CORD_vsprintf assign the result through the 1st */ -/* argument. Unlike their ANSI C versions, there is no need to guess */ -/* the correct buffer size. */ +/* argument. Unlike their ANSI C versions, there is no need to */ +/* guess the correct buffer size. */ /* 4. Most of the conversions are implement through the native */ /* vsprintf. Hence they are usually no faster, and */ /* idiosyncrasies of the native printf are preserved. However, */
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/cord_pos.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/cord_pos.h
Changed
@@ -47,8 +47,8 @@ /* Always points to a valid string */ /* containing the current character */ /* unless cur_end is 0. */ - size_t cur_start; /* Start position of cur_leaf */ - size_t cur_end; /* Ending position of cur_leaf */ + size_t cur_start; /* Start position of cur_leaf. */ + size_t cur_end; /* Ending position of cur_leaf; */ /* 0 if cur_leaf is invalid. */ struct CORD_pe pathMAX_DEPTH + 1; /* pathpath_len is the leaf corresponding to cur_pos */ @@ -110,16 +110,16 @@ #define CORD_pos_valid(p) ((p)0.path_len != CORD_POS_INVALID) /* Some grubby stuff for performance-critical friends: */ -#define CORD_pos_chars_left(p) ((long)((p)0.cur_end) - (long)((p)0.cur_pos)) +#define CORD_pos_chars_left(p) ((long)((p)0.cur_end)-(long)((p)0.cur_pos)) /* Number of characters in cache. <= 0 ==> none */ #define CORD_pos_advance(p,n) ((p)0.cur_pos += (n) - 1, CORD_next(p)) - /* Advance position by n characters */ - /* 0 < n < CORD_pos_chars_left(p) */ + /* Advance position by n characters; */ + /* 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) - /* address of current character in cache. */ + /* Address of the current character in cache. */ #ifdef __cplusplus } /* extern "C" */
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/ec.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/ec.h
Changed
@@ -1,5 +1,18 @@ -# ifndef EC_H -# define EC_H +/* + * Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +#ifndef EC_H +#define EC_H # ifndef CORD_H # include "cord.h" @@ -73,4 +86,4 @@ } /* extern "C" */ #endif -# endif /* EC_H */ +#endif /* EC_H */
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/gc.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/gc.h
Changed
@@ -5,7 +5,7 @@ * Copyright 1999 by Hewlett-Packard Company. All rights reserved. * Copyright (C) 2007 Free Software Foundation, Inc * Copyright (c) 2000-2011 by Hewlett-Packard Development Company. - * Copyright (c) 2009-2018 Ivan Maidanski + * Copyright (c) 2009-2020 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -87,24 +87,28 @@ /* avoid data races on multiprocessors. */ #ifdef GC_THREADS + /* GC is parallelized for performance on multiprocessors. Set to */ + /* a non-zero value when client calls GC_start_mark_threads() */ + /* directly or starts the first non-main thread, provided the */ + /* collector is built with PARALLEL_MARK defined, and either */ + /* GC_MARKERS (or GC_NPROCS) environment variable is set to a value */ + /* bigger than 1, or multiple cores (processors) are available, or */ + /* the client calls GC_set_markers_count() before GC initialization. */ + /* After setting, GC_parallel value is equal to the number of marker */ + /* threads minus one (i.e. the number of existing parallel marker */ + /* threads excluding the initiating one). */ GC_API GC_ATTR_DEPRECATED int GC_parallel; - /* GC is parallelized for performance on */ - /* multiprocessors. Set to a non-zero value */ - /* only implicitly if collector is built with */ - /* PARALLEL_MARK defined, and if either */ - /* GC_MARKERS (or GC_NPROCS) environment */ - /* variable is set to > 1, or multiple cores */ - /* (processors) are available. */ - /* If GC_parallel is on (non-zero), incremental */ - /* collection is only partially functional, */ - /* and may not be desirable. The getter does */ - /* not use or need synchronization (i.e. */ - /* acquiring the GC lock). Starting from */ - /* GC v7.3, GC_parallel value is equal to the */ - /* number of marker threads minus one (i.e. */ - /* number of existing parallel marker threads */ - /* excluding the initiating one). */ + + /* Return value of GC_parallel. Does not acquire the GC lock. */ GC_API int GC_CALL GC_get_parallel(void); + + /* Set the number of marker threads (including the initiating one) */ + /* to the desired value at start-up. Zero value means the collector */ + /* is to decide. If the correct non-zero value is passed, then later */ + /* GC_parallel will be set to the value minus one. Has no effect if */ + /* called after GC initialization. Does not itself cause creation of */ + /* the marker threads. Does not use any synchronization. */ + GC_API void GC_CALL GC_set_markers_count(unsigned); #endif @@ -242,8 +246,8 @@ # ifndef GC_DONT_GC GC_ATTR_DEPRECATED # endif - int GC_dont_gc; /* != 0 ==> Don't collect. In versions 6.2a1+, */ - /* this overrides explicit GC_gcollect() calls. */ + int GC_dont_gc; /* != 0 ==> Do not collect. This overrides */ + /* explicit GC_gcollect() calls as well. */ /* Used as a counter, so that nested enabling */ /* and disabling work correctly. Should */ /* normally be updated with GC_enable() and */ @@ -261,8 +265,7 @@ GC_API GC_ATTR_DEPRECATED int GC_use_entire_heap; /* Causes the non-incremental collector to use the */ - /* entire heap before collecting. This was the only */ - /* option for GC versions < 5.0. This sometimes */ + /* entire heap before collecting. This sometimes */ /* results in more large block fragmentation, since */ /* very large blocks will tend to get broken up */ /* during each GC cycle. It is likely to result in a */ @@ -329,8 +332,8 @@ /* GC_call_with_alloc_lock() is required to */ /* avoid data races (if the value is modified */ /* after the GC is put to multi-threaded mode). */ - /* In version 7.1 (and before), the setter */ - /* returned the old value. */ + /* In GC v7.1 (and before), the setter returned */ + /* the old value. */ GC_API void GC_CALL GC_set_free_space_divisor(GC_word); GC_API GC_word GC_CALL GC_get_free_space_divisor(void); @@ -347,7 +350,7 @@ GC_API GC_ATTR_DEPRECATED char *GC_stackbottom; - /* Cool end of user stack. */ + /* The cold end (bottom) of user stack. */ /* May be set in the client prior to */ /* calling any GC_ routines. This */ /* avoids some overhead, and */ @@ -378,9 +381,12 @@ GC_API GC_ATTR_DEPRECATED unsigned long GC_time_limit; /* If incremental collection is enabled, */ - /* We try to terminate collections */ - /* after this many milliseconds. Not a */ - /* hard time bound. Setting this to */ + /* we try to terminate collections */ + /* after this many milliseconds (plus */ + /* the amount of nanoseconds as given in */ + /* the latest GC_set_time_limit_tv call, */ + /* if any). Not a hard time bound. */ + /* Setting this variable to */ /* GC_TIME_UNLIMITED will essentially */ /* disable incremental collection while */ /* leaving generational collection */ @@ -393,11 +399,46 @@ /* GC_call_with_alloc_lock() is required to */ /* avoid data races (if the value is modified */ /* after the GC is put to multi-threaded mode). */ + /* The setter does not update the value of the */ + /* nanosecond part of the time limit (it is */ + /* zero unless ever set by GC_set_time_limit_tv */ + /* call). */ GC_API void GC_CALL GC_set_time_limit(unsigned long); GC_API unsigned long GC_CALL GC_get_time_limit(void); +/* A portable type definition of time with a nanosecond precision. */ +struct GC_timeval_s { + unsigned long tv_ms; /* time in milliseconds */ + unsigned long tv_nsec;/* nanoseconds fraction (<1000000) */ +}; + /* Public procedures */ +/* Set/get the time limit of the incremental collections. This is */ +/* similar to GC_set_time_limit and GC_get_time_limit but the time is */ +/* provided with the nanosecond precision. The value of tv_nsec part */ +/* should be less than a million. If the value of tv_ms part is */ +/* GC_TIME_UNLIMITED then tv_nsec is ignored. Initially, the value of */ +/* tv_nsec part of the time limit is zero. The functions do not use */ +/* any synchronization. Defined only if the library has been compiled */ +/* without NO_CLOCK. */ +GC_API void GC_CALL GC_set_time_limit_tv(struct GC_timeval_s); +GC_API struct GC_timeval_s GC_CALL GC_get_time_limit_tv(void); + +/* Set/get the minimum value of the ratio of allocated bytes since GC */ +/* to the amount of finalizers created since that GC (value > */ +/* GC_bytes_allocd / (GC_fo_entries - last_fo_entries)) which triggers */ +/* the collection instead heap expansion. The value has no effect in */ +/* the GC incremental mode. The default value is 10000 unless */ +/* GC_ALLOCD_BYTES_PER_FINALIZER macro with a custom value is defined */ +/* to build libgc. The default value might be not the right choice for */ +/* clients where e.g. most objects have a finalizer. Zero value */ +/* effectively disables taking amount of finalizers in the decision */ +/* whether to collect or not. The functions do not use any */ +/* synchronization. */ +GC_API void GC_CALL GC_set_allocd_bytes_per_finalizer(GC_word); +GC_API GC_word GC_CALL GC_get_allocd_bytes_per_finalizer(void); + /* Tell the collector to start various performance measurements. */ /* Only the total time taken by full collections is calculated, as */ /* of now. And, currently, there is no way to stop the measurements. */ @@ -444,6 +485,12 @@ GC_API void GC_CALL GC_set_max_prior_attempts(int); GC_API int GC_CALL GC_get_max_prior_attempts(void); +/* Control whether to disable algorithm deciding if a collection should */ +/* be started when we allocated enough to amortize GC. Both the setter */ +/* and the getter acquire the GC lock (to avoid data races). */ +GC_API void GC_CALL GC_set_disable_automatic_collection(int); +GC_API int GC_CALL GC_get_disable_automatic_collection(void); + /* Overrides the default handle-fork mode. Non-zero value means GC */ /* should install proper pthread_atfork handlers. Has effect only if */ /* called before GC_INIT. Clients should invoke GC_set_handle_fork */ @@ -452,8 +499,8 @@ /* activities are not fully POSIX-compliant.) GC_set_handle_fork */ /* instructs GC_init to setup GC fork handlers using pthread_atfork, */ /* the latter might fail (or, even, absent on some targets) causing */ -/* abort at GC initialization. Starting from 7.3alpha3, problems with */ -/* missing (or failed) pthread_atfork() could be avoided by invocation */ +/* abort at GC initialization. Issues with missing (or failed) */ +/* pthread_atfork() could be avoided by invocation */ /* of GC_set_handle_fork(-1) at application start-up and surrounding */ /* each fork() with the relevant GC_atfork_prepare/parent/child calls. */ GC_API void GC_CALL GC_set_handle_fork(int); @@ -463,7 +510,7 @@ /* before fork(); GC_atfork_parent should be invoked just after fork in */ /* the branch that corresponds to parent process (i.e., fork result is */ /* non-zero); GC_atfork_child is to be called immediately in the child */ -/* branch (i.e., fork result is 0). Note that GC_atfork_child() call */ +/* branch (i.e., fork result is 0). Note that GC_atfork_child() call */ /* should, of course, precede GC_start_mark_threads call (if any). */ GC_API void GC_CALL GC_atfork_prepare(void); GC_API void GC_CALL GC_atfork_parent(void); @@ -599,17 +646,20 @@ GC_API void GC_CALL GC_exclude_static_roots(void * /* low_address */, void * /* high_address_plus_1 */); +/* Clear the number of entries in the exclusion table. Wizards only. */ +GC_API void GC_CALL GC_clear_exclusion_table(void); + /* Clear the set of root segments. Wizards only. */ GC_API void GC_CALL GC_clear_roots(void);
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/gc_allocator.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/gc_allocator.h
Changed
@@ -43,36 +43,11 @@ #include "gc.h" #include <new> // for placement new and bad_alloc -#ifndef GC_ATTR_EXPLICIT -# if __cplusplus >= 201103L && !defined(__clang__) || _MSVC_LANG >= 201103L \ - || defined(CPPCHECK) -# define GC_ATTR_EXPLICIT explicit -# else -# define GC_ATTR_EXPLICIT /* empty */ -# endif -#endif - #if !defined(GC_NO_MEMBER_TEMPLATES) && defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC++ 6.0 do not support member templates. # define GC_NO_MEMBER_TEMPLATES #endif -#ifndef GC_NOEXCEPT -# if defined(__DMC__) || (defined(__BORLANDC__) \ - && (defined(_RWSTD_NO_EXCEPTIONS) || defined(_RWSTD_NO_EX_SPEC))) \ - || (defined(_MSC_VER) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS) \ - || (defined(__WATCOMC__) && !defined(_CPPUNWIND)) -# define GC_NOEXCEPT /* empty */ -# ifndef GC_NEW_ABORTS_ON_OOM -# define GC_NEW_ABORTS_ON_OOM -# endif -# elif __cplusplus >= 201103L || _MSVC_LANG >= 201103L -# define GC_NOEXCEPT noexcept -# else -# define GC_NOEXCEPT throw() -# endif -#endif // !GC_NOEXCEPT - #if defined(GC_NEW_ABORTS_ON_OOM) || defined(_LIBCPP_NO_EXCEPTIONS) # define GC_ALLOCATOR_THROW_OR_ABORT() GC_abort_on_oom() #else
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/gc_config_macros.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/gc_config_macros.h
Changed
@@ -4,6 +4,7 @@ * Copyright (c) 1998 by Fergus Henderson. All rights reserved. * Copyright (c) 2000-2009 by Hewlett-Packard Development Company. * All rights reserved. + * Copyright (c) 2008-2020 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -90,8 +91,8 @@ # define GC_HPUX_THREADS # elif defined(__HAIKU__) # define GC_HAIKU_THREADS -# elif defined(__DragonFly__) || defined(__FreeBSD_kernel__) \ - || (defined(__FreeBSD__) && !defined(SN_TARGET_ORBIS)) +# elif (defined(__DragonFly__) || defined(__FreeBSD_kernel__) \ + || defined(__FreeBSD__)) && !defined(GC_NO_FREEBSD) # define GC_FREEBSD_THREADS # elif defined(__NetBSD__) # define GC_NETBSD_THREADS @@ -285,6 +286,14 @@ # endif #endif +#ifndef GC_ATTR_CONST +# if GC_GNUC_PREREQ(4, 0) +# define GC_ATTR_CONST __attribute__((__const__)) +# else +# define GC_ATTR_CONST /* empty */ +# endif +#endif + #ifndef GC_ATTR_DEPRECATED # ifdef GC_BUILD # undef GC_ATTR_DEPRECATED @@ -319,6 +328,7 @@ #endif /* GLIBC */ #if defined(_MSC_VER) && _MSC_VER >= 1200 /* version 12.0+ (MSVC 6.0+) */ \ + && !defined(_M_ARM) && !defined(_M_ARM64) \ && !defined(_AMD64_) && !defined(_M_X64) && !defined(_WIN32_WCE) \ && !defined(GC_HAVE_NO_BUILTIN_BACKTRACE) \ && !defined(GC_HAVE_BUILTIN_BACKTRACE) @@ -351,10 +361,13 @@ /* how to generate call stacks. */ # define GC_RETURN_ADDR (GC_word)__builtin_return_address(0) # if GC_GNUC_PREREQ(4, 0) && (defined(__i386__) || defined(__amd64__) \ - || defined(__x86_64__) /* and probably others... */) + || defined(__x86_64__) /* and probably others... */) \ + && !defined(GC_NO_RETURN_ADDR_PARENT) # define GC_HAVE_RETURN_ADDR_PARENT # define GC_RETURN_ADDR_PARENT \ (GC_word)__builtin_extract_return_addr(__builtin_return_address(1)) + /* Note: a compiler might complain that calling */ + /* __builtin_return_address with a nonzero argument is unsafe. */ # endif # else /* Just pass 0 for gcc compatibility. */ @@ -413,4 +426,33 @@ #endif /* GC_PTHREADS */ +#ifdef __cplusplus + +#ifndef GC_ATTR_EXPLICIT +# if __cplusplus >= 201103L && !defined(__clang__) || _MSVC_LANG >= 201103L \ + || defined(CPPCHECK) +# define GC_ATTR_EXPLICIT explicit +# else +# define GC_ATTR_EXPLICIT /* empty */ +# endif +#endif + +#ifndef GC_NOEXCEPT +# if defined(__DMC__) || (defined(__BORLANDC__) \ + && (defined(_RWSTD_NO_EXCEPTIONS) || defined(_RWSTD_NO_EX_SPEC))) \ + || (defined(_MSC_VER) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS) \ + || (defined(__WATCOMC__) && !defined(_CPPUNWIND)) +# define GC_NOEXCEPT /* empty */ +# ifndef GC_NEW_ABORTS_ON_OOM +# define GC_NEW_ABORTS_ON_OOM +# endif +# elif __cplusplus >= 201103L || _MSVC_LANG >= 201103L +# define GC_NOEXCEPT noexcept +# else +# define GC_NOEXCEPT throw() +# endif +#endif + +#endif /* __cplusplus */ + #endif
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/gc_cpp.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/gc_cpp.h
Changed
@@ -135,7 +135,7 @@ 5. GC name conflicts: Many other systems seem to use the identifier "GC" as an abbreviation -for "Graphics Context". Since version 5.0, GC placement has been replaced +for "Graphics Context". Thus, GC placement has been replaced by UseGC. GC is an alias for UseGC, unless GC_NAME_CONFLICT is defined. ****************************************************************************/ @@ -173,22 +173,6 @@ # define GC_PLACEMENT_DELETE #endif -#ifndef GC_NOEXCEPT -# if defined(__DMC__) || (defined(__BORLANDC__) \ - && (defined(_RWSTD_NO_EXCEPTIONS) || defined(_RWSTD_NO_EX_SPEC))) \ - || (defined(_MSC_VER) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS) \ - || (defined(__WATCOMC__) && !defined(_CPPUNWIND)) -# define GC_NOEXCEPT /* empty */ -# ifndef GC_NEW_ABORTS_ON_OOM -# define GC_NEW_ABORTS_ON_OOM -# endif -# elif __cplusplus >= 201103L || _MSVC_LANG >= 201103L -# define GC_NOEXCEPT noexcept -# else -# define GC_NOEXCEPT throw() -# endif -#endif // !GC_NOEXCEPT - #if defined(GC_NEW_ABORTS_ON_OOM) || defined(_LIBCPP_NO_EXCEPTIONS) # define GC_OP_NEW_OOM_CHECK(obj) \ do { if (!(obj)) GC_abort_on_oom(); } while (0) @@ -504,9 +488,11 @@ inline gc_cleanup::~gc_cleanup() { - void* base = GC_base(this); - if (0 == base) return; // Non-heap object. - GC_register_finalizer_ignore_self(base, 0, 0, 0, 0); +# ifndef GC_NO_FINALIZATION + void* base = GC_base(this); + if (0 == base) return; // Non-heap object. + GC_register_finalizer_ignore_self(base, 0, 0, 0, 0); +# endif } inline void GC_CALLBACK gc_cleanup::cleanup(void* obj, void* displ) @@ -516,19 +502,23 @@ inline gc_cleanup::gc_cleanup() { - GC_finalization_proc oldProc; - void* oldData; - void* this_ptr = (void*)this; - void* base = GC_base(this_ptr); - if (base != 0) { - // Don't call the debug version, since this is a real base address. - GC_register_finalizer_ignore_self(base, (GC_finalization_proc) cleanup, - (void*)((char*)this_ptr - (char*)base), - &oldProc, &oldData); - if (oldProc != 0) { - GC_register_finalizer_ignore_self(base, oldProc, oldData, 0, 0); +# ifndef GC_NO_FINALIZATION + GC_finalization_proc oldProc = 0; + void* oldData = NULL; // to avoid "might be uninitialized" compiler warning + void* this_ptr = (void*)this; + void* base = GC_base(this_ptr); + if (base != 0) { + // Don't call the debug version, since this is a real base address. + GC_register_finalizer_ignore_self(base, (GC_finalization_proc) cleanup, + (void*)((char*)this_ptr-(char*)base), + &oldProc, &oldData); + if (oldProc != 0) { + GC_register_finalizer_ignore_self(base, oldProc, oldData, 0, 0); + } } - } +# elif defined(CPPCHECK) + (void)cleanup; +# endif } #ifdef GC_NAMESPACE @@ -543,9 +533,14 @@ switch (gcp) { case GC_NS_QUALIFY(UseGC): obj = GC_MALLOC(size); - if (cleanup != 0 && obj != 0) { - GC_REGISTER_FINALIZER_IGNORE_SELF(obj, cleanup, clientData, 0, 0); - } +# ifndef GC_NO_FINALIZATION + if (cleanup != 0 && obj != 0) { + GC_REGISTER_FINALIZER_IGNORE_SELF(obj, cleanup, clientData, 0, 0); + } +# else + (void)cleanup; + (void)clientData; +# endif break; case GC_NS_QUALIFY(PointerFreeGC): obj = GC_MALLOC_ATOMIC(size);
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/gc_inline.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/gc_inline.h
Changed
@@ -95,7 +95,7 @@ /* The ultimately general inline allocation macro. Allocate an object */ /* of size granules, putting the resulting pointer in result. Tiny_fl */ /* is a "tiny" free list array, which will be used first, if the size */ -/* is appropriate. If granules is too large, we allocate with */ +/* is appropriate. If granules argument is too large, we allocate with */ /* default_expr instead. If we need to refill the free list, we use */ /* GC_generic_malloc_many with the indicated kind. */ /* Tiny_fl should be an array of GC_TINY_FREELISTS void * pointers. */ @@ -108,8 +108,8 @@ /* size that are used to satisfy size 0 allocation requests. */ /* We rely on much of this hopefully getting optimized away in the */ /* num_direct = 0 case. */ -/* Particularly if granules is constant, this should generate a small */ -/* amount of code. */ +/* Particularly, if granules argument is constant, this should generate */ +/* a small amount of code. */ # define GC_FAST_MALLOC_GRANS(result,granules,tiny_fl,num_direct, \ kind,default_expr,init) \ do { \ @@ -167,10 +167,9 @@ /* Allocate n words (NOT BYTES). X is made to point to the result. */ /* This should really only be used if GC_all_interior_pointers is */ /* not set, or DONT_ADD_BYTE_AT_END is set. See above. */ -/* The semantics changed in version 7.0; we no longer lock, and */ -/* the caller is responsible for supplying a cleared tiny_fl */ -/* free list array. For single-threaded applications, this may be */ -/* a global array. */ +/* Does not acquire lock. The caller is responsible for supplying */ +/* a cleared tiny_fl free list array. For single-threaded */ +/* applications, this may be a global array. */ # define GC_MALLOC_WORDS_KIND(result,n,tiny_fl,kind,init) \ do { \ size_t granules = GC_WORDS_TO_WHOLE_GRANULES(n); \
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/gc_mark.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/gc_mark.h
Changed
@@ -33,6 +33,14 @@ extern "C" { #endif +#define GC_PROC_BYTES 100 + +#if defined(GC_BUILD) || defined(NOT_GCBUILD) + struct GC_ms_entry; +#else + struct GC_ms_entry { void *opaque; }; +#endif + /* A client supplied mark procedure. Returns new mark stack pointer. */ /* Primary effect should be to push new entries on the mark stack. */ /* Mark stack pointer values are passed and returned explicitly. */ @@ -54,14 +62,10 @@ /* residing on a free list. Such objects are cleared, except for a */ /* free list link field in the first word. Thus mark procedures may */ /* not count on the presence of a type descriptor, and must handle this */ -/* case correctly somehow. */ -#define GC_PROC_BYTES 100 - -#ifdef GC_BUILD - struct GC_ms_entry; -#else - struct GC_ms_entry { void *opaque; }; -#endif +/* case correctly somehow. Also, a mark procedure should be prepared */ +/* to be executed concurrently from the marker threads (the later ones */ +/* are created only if the client has called GC_start_mark_threads() */ +/* or started a user thread previously). */ typedef struct GC_ms_entry * (*GC_mark_proc)(GC_word * /* addr */, struct GC_ms_entry * /* mark_stack_ptr */, struct GC_ms_entry * /* mark_stack_limit */, @@ -152,12 +156,23 @@ (GC_word)(obj) <= (GC_word)GC_greatest_plausible_heap_addr ? \ GC_mark_and_push(obj, msp, lim, src) : (msp)) -GC_API size_t GC_debug_header_size; - /* The size of the header added to objects allocated through */ - /* the GC_debug routines. */ - /* Defined as a variable so that client mark procedures don't */ - /* need to be recompiled for collector version changes. */ -#define GC_USR_PTR_FROM_BASE(p) ((void *)((char *)(p) + GC_debug_header_size)) +/* The size of the header added to objects allocated through the */ +/* GC_debug routines. Defined as a function so that client mark */ +/* procedures do not need to be recompiled for the collector library */ +/* version changes. */ +GC_API GC_ATTR_CONST size_t GC_CALL GC_get_debug_header_size(void); +#define GC_USR_PTR_FROM_BASE(p) \ + ((void *)((char *)(p) + GC_get_debug_header_size())) + +/* The same but defined as a variable. Exists only for the backward */ +/* compatibility. Some compilers do not accept "const" together with */ +/* deprecated or dllimport attributes, so the symbol is exported as */ +/* a non-constant one. */ +GC_API GC_ATTR_DEPRECATED +# ifdef GC_BUILD + const +# endif + size_t GC_debug_header_size; /* And some routines to support creation of new "kinds", e.g. with */ /* custom mark procedures, by language runtimes. */
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/gc_version.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/gc_version.h
Changed
@@ -29,8 +29,8 @@ /* Eventually this one may become unnecessary. For now we need */ /* it to keep the old-style build process working. */ #define GC_TMP_VERSION_MAJOR 8 -#define GC_TMP_VERSION_MINOR 0 -#define GC_TMP_VERSION_MICRO 6 /* 8.0.6 */ +#define GC_TMP_VERSION_MINOR 2 +#define GC_TMP_VERSION_MICRO 2 /* 8.2.2 */ #ifdef GC_VERSION_MAJOR # if GC_TMP_VERSION_MAJOR != GC_VERSION_MAJOR \
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/include.am -> _service:tar_scm:gc-8.2.2.tar.gz/include/include.am
Changed
@@ -16,10 +16,8 @@ include/gc.h \ include/gc_backptr.h \ include/gc_config_macros.h \ - include/gc_gcj.h \ include/gc_inline.h \ include/gc_mark.h \ - include/gc_pthread_redirects.h \ include/gc_tiny_fl.h \ include/gc_typed.h \ include/gc_version.h \ @@ -29,18 +27,16 @@ # headers which are not installed # dist_noinst_HEADERS += \ - include/gc_alloc_ptrs.h \ - include/new_gc_alloc.h \ include/private/darwin_semaphore.h \ include/private/darwin_stop_world.h \ include/private/dbg_mlc.h \ + include/private/gc_alloc_ptrs.h \ include/private/gc_atomic_ops.h \ include/private/gc_hdrs.h \ include/private/gc_locks.h \ include/private/gc_pmark.h \ include/private/gc_priv.h \ include/private/gcconfig.h \ - include/private/msvc_dbg.h \ include/private/pthread_stop_world.h \ include/private/pthread_support.h \ include/private/specific.h \
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/leak_detector.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/leak_detector.h
Changed
@@ -16,7 +16,7 @@ #define GC_LEAK_DETECTOR_H /* Include leak_detector.h (e.g., via GCC --include directive) */ -/* to turn BoehmGC into a Leak Detector. */ +/* to turn libgc into a leak detector. */ #ifndef GC_DEBUG # define GC_DEBUG
View file
_service:tar_scm:gc-8.2.2.tar.gz/include/private/gc_alloc_ptrs.h
Added
@@ -0,0 +1,60 @@ +/* + * Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. + * Copyright (c) 2018-2021 Ivan Maidanski + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +/* This file is kept for a binary compatibility purpose only. */ + +#ifndef GC_ALLOC_PTRS_H +#define GC_ALLOC_PTRS_H + +#include "gc.h" + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef GC_API_PRIV +# define GC_API_PRIV GC_API +#endif + +/* Some compilers do not accept "const" together with the dllimport */ +/* attribute, so the symbols below are exported as non-constant ones. */ +#ifndef GC_APIVAR_CONST +# if defined(GC_BUILD) || !defined(GC_DLL) +# define GC_APIVAR_CONST const +# else +# define GC_APIVAR_CONST /* empty */ +# endif +#endif + +GC_API_PRIV void ** GC_APIVAR_CONST GC_objfreelist_ptr; +GC_API_PRIV void ** GC_APIVAR_CONST GC_aobjfreelist_ptr; +GC_API_PRIV void ** GC_APIVAR_CONST GC_uobjfreelist_ptr; + +#ifdef GC_ATOMIC_UNCOLLECTABLE + GC_API_PRIV void ** GC_APIVAR_CONST GC_auobjfreelist_ptr; +#endif + +/* Manually update the number of bytes allocated during the current */ +/* collection cycle and the number of explicitly deallocated bytes of */ +/* memory since the last collection, respectively. Both functions are */ +/* unsynchronized, GC_call_with_alloc_lock() should be used to avoid */ +/* data races. */ +GC_API_PRIV void GC_CALL GC_incr_bytes_allocd(size_t /* bytes */); +GC_API_PRIV void GC_CALL GC_incr_bytes_freed(size_t /* bytes */); + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* GC_ALLOC_PTRS_H */
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/private/gc_atomic_ops.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/private/gc_atomic_ops.h
Changed
@@ -12,7 +12,7 @@ */ /* This is a private GC header which provides an implementation of */ -/* libatomic_ops subset primitives sufficient for GC assuming that C11 */ +/* libatomic_ops subset primitives sufficient for GC assuming that GCC */ /* atomic intrinsics are available (and have correct implementation). */ /* This is enabled by defining GC_BUILTIN_ATOMIC macro. Otherwise, */ /* libatomic_ops library is used to define the primitives. */ @@ -45,7 +45,8 @@ # define AO_TS_SET (AO_TS_t)1 /* true */ # endif # define AO_CLEAR(p) __atomic_clear(p, __ATOMIC_RELEASE) -# define AO_test_and_set_acquire(p) __atomic_test_and_set(p, __ATOMIC_ACQUIRE) +# define AO_test_and_set_acquire(p) \ + (__atomic_test_and_set(p, __ATOMIC_ACQUIRE) ? AO_TS_SET : AO_TS_CLEAR) # define AO_HAVE_test_and_set_acquire # define AO_compiler_barrier() __atomic_signal_fence(__ATOMIC_SEQ_CST)
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/private/gc_locks.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/private/gc_locks.h
Changed
@@ -53,21 +53,17 @@ # endif # if (!defined(AO_HAVE_test_and_set_acquire) || defined(GC_RTEMS_PTHREADS) \ - || defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3) \ + || defined(SN_TARGET_PS3) \ || defined(GC_WIN32_THREADS) || defined(BASE_ATOMIC_OPS_EMULATED) \ || defined(LINT2)) && defined(GC_PTHREADS) # define USE_PTHREAD_LOCKS # undef USE_SPIN_LOCK +# if defined(LINT2) && !defined(NO_PTHREAD_TRYLOCK) +# define NO_PTHREAD_TRYLOCK +# endif # endif # if defined(GC_WIN32_THREADS) && !defined(USE_PTHREAD_LOCKS) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE - EXTERN_C_END -# include <windows.h> - EXTERN_C_BEGIN # define NO_THREAD (DWORD)(-1) GC_EXTERN CRITICAL_SECTION GC_allocate_ml; # ifdef GC_ASSERTIONS
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/private/gc_pmark.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/private/gc_pmark.h
Changed
@@ -74,8 +74,6 @@ /* Number of mark stack entries to discard on overflow. */ #define GC_MARK_STACK_DISCARDS (INITIAL_MARK_STACK_SIZE/8) -GC_EXTERN size_t GC_mark_stack_size; - #ifdef PARALLEL_MARK /* * Allow multiple threads to participate in the marking process. @@ -344,13 +342,13 @@ /* beginning of object. If so, it is valid, and we are fine. */ GC_ASSERT(gran_displ <= HBLK_OBJS(hhdr -> hb_sz)); # endif /* MARK_BIT_PER_OBJ */ - TRACE(source, GC_log_printf("GC #%u: passed validity tests\n", - (unsigned)GC_gc_no)); + TRACE(source, GC_log_printf("GC #%lu: passed validity tests\n", + (unsigned long)GC_gc_no)); SET_MARK_BIT_EXIT_IF_SET(hhdr, gran_displ); /* contains "break" */ - TRACE(source, GC_log_printf("GC #%u: previously unmarked\n", - (unsigned)GC_gc_no)); - TRACE_TARGET(base, GC_log_printf("GC #%u: marking %p from %p instead\n", - (unsigned)GC_gc_no, (void *)base, + TRACE(source, GC_log_printf("GC #%lu: previously unmarked\n", + (unsigned long)GC_gc_no)); + TRACE_TARGET(base, GC_log_printf("GC #%lu: marking %p from %p instead\n", + (unsigned long)GC_gc_no, (void *)base, (void *)source)); INCR_MARKS(hhdr); GC_STORE_BACK_PTR(source, base); @@ -442,13 +440,7 @@ } \ } while (0) -GC_EXTERN GC_bool GC_mark_stack_too_small; - /* We need a larger mark stack. May be */ - /* set by client supplied mark routines.*/ - -typedef int mark_state_t; /* Current state of marking, as follows:*/ - /* Used to remember where we are during */ - /* concurrent marking. */ + /* Current state of marking, as follows.*/ /* We say something is dirty if it was */ /* written since the last time we */ @@ -469,24 +461,24 @@ /* being pushed. "I" holds, except */ /* that grungy roots may point to */ /* unmarked objects, as may marked */ - /* grungy objects above scan_ptr. */ + /* grungy objects above GC_scan_ptr. */ #define MS_PUSH_UNCOLLECTABLE 2 /* "I" holds, except that marked */ - /* uncollectible objects above scan_ptr */ - /* may point to unmarked objects. */ - /* Roots may point to unmarked objects */ + /* uncollectible objects above */ + /* GC_scan_ptr may point to unmarked */ + /* objects. Roots may point to */ + /* unmarked objects. */ #define MS_ROOTS_PUSHED 3 /* "I" holds, mark stack may be nonempty. */ #define MS_PARTIALLY_INVALID 4 /* "I" may not hold, e.g. because of */ - /* the mark stack overflow. However */ - /* marked heap objects below scan_ptr */ - /* point to marked or stacked objects. */ + /* the mark stack overflow. However, */ + /* marked heap objects below */ + /* GC_scan_ptr point to marked or */ + /* stacked objects. */ #define MS_INVALID 5 /* "I" may not hold. */ -GC_EXTERN mark_state_t GC_mark_state; - EXTERN_C_END #endif /* GC_PMARK_H */
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/private/gc_priv.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/private/gc_priv.h
Changed
@@ -3,7 +3,7 @@ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. - * + * Copyright (c) 2008-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -22,13 +22,12 @@ # include "config.h" #endif -#ifndef GC_BUILD +#if !defined(GC_BUILD) && !defined(NOT_GCBUILD) # define GC_BUILD #endif #if (defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) \ - || (defined(__CYGWIN__) && !defined(USE_MMAP))) \ - && !defined(_GNU_SOURCE) + || defined(__CYGWIN__)) && !defined(_GNU_SOURCE) /* Can't test LINUX, since this must be defined before other includes. */ # define _GNU_SOURCE 1 #endif @@ -167,6 +166,16 @@ # define REGISTER register #endif +#if defined(CPPCHECK) +# define MACRO_BLKSTMT_BEGIN { +# define MACRO_BLKSTMT_END } +# define LOCAL_VAR_INIT_OK =0 /* to avoid "uninit var" false positive */ +#else +# define MACRO_BLKSTMT_BEGIN do { +# define MACRO_BLKSTMT_END } while (0) +# define LOCAL_VAR_INIT_OK /* empty */ +#endif + #if defined(M68K) && defined(__GNUC__) /* By default, __alignof__(word) is 2 on m68k. Use this attribute to */ /* have proper word alignment (i.e. 4-byte on a 32-bit arch). */ @@ -205,7 +214,10 @@ # elif GC_CLANG_PREREQ(3, 8) # define GC_ATTR_NO_SANITIZE_THREAD __attribute__((no_sanitize("thread"))) # else -# define GC_ATTR_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread)) + /* It seems that no_sanitize_thread attribute has no effect if the */ + /* function is inlined (as of gcc 11.1.0, at least). */ +# define GC_ATTR_NO_SANITIZE_THREAD \ + GC_ATTR_NOINLINE __attribute__((no_sanitize_thread)) # endif #endif /* !GC_ATTR_NO_SANITIZE_THREAD */ @@ -259,14 +271,22 @@ # define GC_API_PRIV GC_API #endif -#if defined(THREADS) && !defined(NN_PLATFORM_CTR) \ - && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) +#if defined(THREADS) && !defined(NN_PLATFORM_CTR) # include "gc_atomic_ops.h" # ifndef AO_HAVE_compiler_barrier # define AO_HAVE_compiler_barrier 1 # endif #endif +#if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif +# define NOSERVICE +# include <windows.h> +# include <winbase.h> +#endif + #include "gc_locks.h" #define GC_WORD_MAX (~(word)0) @@ -323,7 +343,7 @@ /* by integers, etc. Under SunOS 4.X with a */ /* statically linked libc, we empirically */ /* observed that it would be difficult to */ - /* allocate individual objects larger than 100K. */ + /* allocate individual objects > 100 KB. */ /* Even if only smaller objects are allocated, */ /* more swap space is likely to be needed. */ /* Fortunately, much of this will never be */ @@ -446,23 +466,43 @@ x = rusage.ru_utime; \ } while (0) # define MS_TIME_DIFF(a,b) ((unsigned long)((long)(a.tv_sec-b.tv_sec) * 1000 \ - + (long)(a.tv_usec-b.tv_usec) / 1000)) + + (long)(a.tv_usec - b.tv_usec) / 1000 \ + - (a.tv_usec < b.tv_usec \ + && (long)(a.tv_usec - b.tv_usec) % 1000 != 0 ? 1 : 0))) /* "a" time is expected to be not earlier than */ /* "b" one; the result has unsigned long type. */ -#elif defined(MSWIN32) || defined(MSWINCE) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE -# include <windows.h> -# include <winbase.h> -# define CLOCK_TYPE DWORD -# ifdef MSWINRT_FLAVOR -# define GET_TIME(x) (void)(x = (DWORD)GetTickCount64()) +# define NS_FRAC_TIME_DIFF(a, b) ((unsigned long) \ + ((a.tv_usec < b.tv_usec \ + && (long)(a.tv_usec - b.tv_usec) % 1000 != 0 ? 1000L : 0) \ + + (long)(a.tv_usec - b.tv_usec) % 1000) * 1000) + /* The total time difference could be computed as */ + /* MS_TIME_DIFF(a,b)*1000000+NS_FRAC_TIME_DIFF(a,b).*/ + +#elif defined(MSWIN32) || defined(MSWINCE) || defined(WINXP_USE_PERF_COUNTER) +# if defined(MSWINRT_FLAVOR) || defined(WINXP_USE_PERF_COUNTER) +# define CLOCK_TYPE ULONGLONG +# define GET_TIME(x) \ + do { \ + LARGE_INTEGER freq, tc; \ + if (!QueryPerformanceFrequency(&freq)) \ + ABORT("QueryPerformanceFrequency requires WinXP+"); \ + /* Note: two standalone if statements are needed to */ \ + /* avoid MS VC false warning about potentially */ \ + /* uninitialized tc variable. */ \ + if (!QueryPerformanceCounter(&tc)) \ + ABORT("QueryPerformanceCounter failed"); \ + x = (CLOCK_TYPE)((double)tc.QuadPart/freq.QuadPart * 1e9); \ + } while (0) + /* TODO: Call QueryPerformanceFrequency once at GC init. */ +# define MS_TIME_DIFF(a, b) ((unsigned long)(((a) - (b)) / 1000000UL)) +# define NS_FRAC_TIME_DIFF(a, b) ((unsigned long)(((a) - (b)) % 1000000UL)) # else +# define CLOCK_TYPE DWORD # define GET_TIME(x) (void)(x = GetTickCount()) -# endif -# define MS_TIME_DIFF(a,b) ((unsigned long)((a)-(b))) +# define MS_TIME_DIFF(a, b) ((unsigned long)((a) - (b))) +# define NS_FRAC_TIME_DIFF(a, b) 0UL +# endif /* !WINXP_USE_PERF_COUNTER */ + #elif defined(NN_PLATFORM_CTR) # define CLOCK_TYPE long long EXTERN_C_BEGIN @@ -471,7 +511,36 @@ EXTERN_C_END # define GET_TIME(x) (void)(x = n3ds_get_system_tick()) # define MS_TIME_DIFF(a,b) ((unsigned long)n3ds_convert_tick_to_ms((a)-(b))) -#else /* !BSD_TIME && !NN_PLATFORM_CTR && !MSWIN32 && !MSWINCE */ +# define NS_FRAC_TIME_DIFF(a, b) 0UL /* TODO: implement it */ + +#elif defined(NINTENDO_SWITCH) \ + || (((defined(LINUX) && defined(__USE_POSIX199309)) \ + || defined(CYGWIN32)) && defined(_POSIX_TIMERS)) +# include <time.h> +# define HAVE_CLOCK_GETTIME 1 +# define CLOCK_TYPE struct timespec +# define CLOCK_TYPE_INITIALIZER { 0, 0 } +# if defined(_POSIX_MONOTONIC_CLOCK) && !defined(NINTENDO_SWITCH) +# define GET_TIME(x) \ + do { \ + if (clock_gettime(CLOCK_MONOTONIC, &x) == -1) \ + ABORT("clock_gettime failed"); \ + } while (0) +# else +# define GET_TIME(x) \ + do { \ + if (clock_gettime(CLOCK_REALTIME, &x) == -1) \ + ABORT("clock_gettime failed"); \ + } while (0) +# endif +# define MS_TIME_DIFF(a, b) \ + /* a.tv_nsec - b.tv_nsec is in range -1e9 to 1e9 exclusively */ \ + ((unsigned long)((a).tv_nsec + (1000000L*1000 - (b).tv_nsec)) / 1000000UL \ + + ((unsigned long)((a).tv_sec - (b).tv_sec) * 1000UL) - 1000UL) +# define NS_FRAC_TIME_DIFF(a, b) \ + ((unsigned long)((a).tv_nsec + (1000000L*1000 - (b).tv_nsec)) % 1000000UL) + +#else /* !BSD_TIME && !LINUX && !NN_PLATFORM_CTR && !MSWIN32 */ # include <time.h> # if defined(FREEBSD) && !defined(CLOCKS_PER_SEC) # include <machine/limits.h> @@ -496,6 +565,13 @@ : ((unsigned long)((a) - (b)) * 1000) / (unsigned long)CLOCKS_PER_SEC) /* Avoid using double type since some targets (like ARM) might */ /* require -lm option for double-to-long conversion. */ +# define NS_FRAC_TIME_DIFF(a, b) (CLOCKS_PER_SEC <= 1000 ? 0UL \ + : (unsigned long)(CLOCKS_PER_SEC <= (clock_t)1000000UL \ + ? (((a) - (b)) * ((clock_t)1000000UL / CLOCKS_PER_SEC) % 1000) * 1000 \ + : (CLOCKS_PER_SEC <= (clock_t)1000000UL * 1000 \ + ? ((a) - (b)) * ((clock_t)1000000UL * 1000 / CLOCKS_PER_SEC) \ + : (((a) - (b)) * (clock_t)1000000UL * 1000) / CLOCKS_PER_SEC) \ + % (clock_t)1000000UL)) #endif /* !BSD_TIME && !MSWIN32 */ # ifndef CLOCK_TYPE_INITIALIZER /* This is used to initialize CLOCK_TYPE variables (to some value) */ @@ -610,21 +686,21 @@ /* literals. C_msg should not contain format specifiers. Arguments */ /* should match their format specifiers. */
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/private/gcconfig.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/private/gcconfig.h
Changed
@@ -3,6 +3,7 @@ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996 by Silicon Graphics. All rights reserved. * Copyright (c) 2000-2004 Hewlett-Packard Development Company, L.P. + * Copyright (c) 2009-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -109,19 +110,6 @@ # define LINUX # endif -/* And one for QNX: */ -# if defined(__QNX__) -# define I386 -# define OS_TYPE "QNX" -# define SA_RESTART 0 -# define HEURISTIC1 - extern char etext; - extern int _end; -# define DATASTART ((ptr_t)(etext)) -# define DATAEND ((ptr_t)(_end)) -# define mach_type_known -# endif - /* And one for NetBSD: */ # if defined(__NetBSD__) # define NETBSD @@ -135,7 +123,7 @@ /* And one for FreeBSD: */ # if (defined(__FreeBSD__) || defined(__DragonFly__) \ || defined(__FreeBSD_kernel__)) && !defined(FREEBSD) \ - && !defined(SN_TARGET_ORBIS) /* Orbis compiler defines __FreeBSD__ */ + && !defined(GC_NO_FREEBSD) /* Orbis compiler defines __FreeBSD__ */ # define FREEBSD # endif @@ -161,7 +149,7 @@ # define AARCH64 # if !defined(LINUX) && !defined(DARWIN) && !defined(FREEBSD) \ && !defined(NETBSD) && !defined(NN_BUILD_TARGET_PLATFORM_NX) \ - && !defined(OPENBSD) + && !defined(OPENBSD) && !defined(_WIN32) # define NOSYS # define mach_type_known # endif @@ -173,7 +161,7 @@ # elif !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) \ && !defined(OPENBSD) && !defined(DARWIN) && !defined(_WIN32) \ && !defined(__CEGCC__) && !defined(NN_PLATFORM_CTR) \ - && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) \ + && !defined(GC_NO_NOSYS) && !defined(SN_TARGET_PSP2) \ && !defined(SYMBIAN) # define NOSYS # define mach_type_known @@ -234,7 +222,7 @@ # endif # define mach_type_known # endif -# if defined(__NetBSD__) && defined(__vax__) +# if defined(NETBSD) && defined(__vax__) # define VAX # define mach_type_known # endif @@ -251,11 +239,15 @@ # define IRIX5 /* or IRIX 6.X */ # endif # endif /* !LINUX */ -# if defined(__NetBSD__) && defined(__MIPSEL__) +# if defined(NETBSD) && defined(__MIPSEL__) # undef ULTRIX # endif # define mach_type_known # endif +# if defined(__QNX__) +# define I386 +# define mach_type_known +# endif # if defined(__NIOS2__) || defined(__NIOS2) || defined(__nios2__) # define NIOS2 /* Altera NIOS2 */ # define mach_type_known @@ -267,7 +259,7 @@ # if defined(DGUX) && (defined(i386) || defined(__i386__)) # define I386 # ifndef _USING_DGUX -# define _USING_DGUX +# define _USING_DGUX # endif # define mach_type_known # endif @@ -303,8 +295,7 @@ # define SOLARIS # define mach_type_known # elif defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \ - && !defined(__OpenBSD__) && !defined(__NetBSD__) \ - && !defined(__FreeBSD__) && !defined(__DragonFly__) + && !defined(FREEBSD) && !defined(NETBSD) && !defined(OPENBSD) # define SPARC # define DRSNX # define mach_type_known @@ -314,7 +305,7 @@ # define AIX # define mach_type_known # endif -# if defined(__NetBSD__) && defined(__sparc__) +# if defined(NETBSD) && defined(__sparc__) # define SPARC # define mach_type_known # endif @@ -372,6 +363,10 @@ # define IA64 # define mach_type_known # endif +# if defined(LINUX) && defined(__e2k__) +# define E2K +# define mach_type_known +# endif # if defined(LINUX) && defined(__aarch64__) # define AARCH64 # define mach_type_known @@ -386,6 +381,10 @@ # endif # define mach_type_known # endif +# if defined(LINUX) && defined(__loongarch__) +# define LOONGARCH +# define mach_type_known +# endif # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) \ || defined(powerpc64) || defined(__powerpc64__)) # define POWERPC @@ -438,9 +437,8 @@ # define MACOS # define mach_type_known # endif -# if defined(__OpenBSD__) && defined(__powerpc__) +# if defined(OPENBSD) && defined(__powerpc__) # define POWERPC -# define OPENBSD # define mach_type_known # endif # if defined(DARWIN) @@ -476,16 +474,15 @@ # define NEXT # define mach_type_known # endif -# if defined(__OpenBSD__) && (defined(i386) || defined(__i386__)) +# if defined(OPENBSD) && (defined(i386) || defined(__i386__)) # define I386 -# define OPENBSD # define mach_type_known # endif -# if defined(__NetBSD__) && (defined(i386) || defined(__i386__)) +# if defined(NETBSD) && (defined(i386) || defined(__i386__)) # define I386 # define mach_type_known # endif -# if defined(__NetBSD__) && defined(__x86_64__) +# if defined(NETBSD) && defined(__x86_64__) # define X86_64 # define mach_type_known # endif @@ -493,8 +490,7 @@ # define I386 # define mach_type_known # endif -# if (defined(FREEBSD) || defined(SN_TARGET_ORBIS)) \ - && (defined(__amd64__) || defined(__x86_64__)) +# if defined(FREEBSD) && (defined(__amd64__) || defined(__x86_64__)) # define X86_64 # define mach_type_known # endif @@ -663,6 +659,10 @@ # define NONSTOP # define mach_type_known # endif +# if defined(__arc__) && defined(LINUX) +# define ARC +# define mach_type_known +# endif # if defined(__hexagon__) && defined(LINUX) # define HEXAGON # define mach_type_known @@ -675,7 +675,8 @@ # endif # define mach_type_known # endif -# if defined(__riscv) && defined(LINUX) +# if defined(__riscv) && (defined(FREEBSD) || defined(LINUX) \ + || defined(OPENBSD)) # define RISCV # define mach_type_known # endif @@ -698,6 +699,7 @@ # endif # if defined(__EMSCRIPTEN__) +# define EMSCRIPTEN # define I386 # define mach_type_known
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/private/pthread_stop_world.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/private/pthread_stop_world.h
Changed
@@ -22,10 +22,18 @@ struct thread_stop_info { # if !defined(GC_OPENBSD_UTHREADS) && !defined(NACL) \ - && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) + && !defined(PLATFORM_STOP_WORLD) && !defined(SN_TARGET_PSP2) volatile AO_t last_stop_count; /* The value of GC_stop_count when the thread */ /* last successfully handled a suspend signal. */ +# ifdef GC_ENABLE_SUSPEND_THREAD + volatile AO_t ext_suspend_cnt; + /* An odd value means thread was suspended */ + /* externally. Incremented on every call of */ + /* GC_suspend_thread() and GC_resume_thread(). */ + /* Updated with the GC lock held, but could be */ + /* read from a signal handler. */ +# endif # endif ptr_t stack_ptr; /* Valid only when stopped. */ @@ -44,9 +52,8 @@ # define NACL_GC_REG_STORAGE_SIZE 20 # endif ptr_t reg_storageNACL_GC_REG_STORAGE_SIZE; -# elif defined(SN_TARGET_ORBIS) -# define ORBIS_GC_REG_STORAGE_SIZE 27 - word registersORBIS_GC_REG_STORAGE_SIZE; /* used externally */ +# elif defined(PLATFORM_HAVE_GC_REG_STORAGE_SIZE) + word registersPLATFORM_GC_REG_STORAGE_SIZE; /* used externally */ # endif };
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/private/pthread_support.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/private/pthread_support.h
Changed
@@ -66,12 +66,7 @@ /* Extra bookkeeping information the stopping code uses */ struct thread_stop_info stop_info; -# if defined(GC_ENABLE_SUSPEND_THREAD) && !defined(GC_DARWIN_THREADS) \ - && !defined(GC_OPENBSD_UTHREADS) && !defined(NACL) - volatile AO_t suspended_ext; /* Thread was suspended externally. */ -# endif - - unsigned char flags; + unsigned char flags; /* Protected by GC lock. */ # define FINISHED 1 /* Thread has exited. */ # define DETACHED 2 /* Thread is treated as detached. */ /* Thread may really be detached, or */ @@ -93,12 +88,14 @@ /* not need to be sent a signal to stop */ /* it. */ - unsigned short finalizer_skipped; - unsigned char finalizer_nested; +# ifndef GC_NO_FINALIZATION + unsigned short finalizer_skipped; + unsigned char finalizer_nested; /* Used by GC_check_finalizer_nested() */ /* to minimize the level of recursion */ /* when a client finalizer allocates */ /* memory (initially both are 0). */ +# endif ptr_t stack_end; /* Cold end of the stack (except for */ /* main thread). */ @@ -113,8 +110,8 @@ /* valid only if the thread is blocked; */ /* non-NULL value means already set. */ # endif -# ifdef IA64 - ptr_t backing_store_end; +# if defined(E2K) || defined(IA64) + ptr_t backing_store_end; /* Note: may reference data in GC heap */ ptr_t backing_store_ptr; # endif @@ -168,6 +165,15 @@ GC_INNER void GC_unblock_gc_signals(void); #endif +#if defined(GC_ENABLE_SUSPEND_THREAD) && !defined(GC_DARWIN_THREADS) \ + && !defined(GC_OPENBSD_UTHREADS) && !defined(NACL) \ + && !defined(PLATFORM_STOP_WORLD) && !defined(SN_TARGET_PSP2) + GC_INNER void GC_suspend_self_inner(GC_thread me, word suspend_cnt); + + GC_INNER void GC_suspend_self_blocked(ptr_t thread_me, void *context); + /* Wrapper over GC_suspend_self_inner. */ +#endif + #ifdef GC_PTHREAD_START_STANDALONE # define GC_INNER_PTHRSTART /* empty */ #else
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/private/specific.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/private/specific.h
Changed
@@ -1,4 +1,17 @@ /* + * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +/* * This is a reimplementation of a subset of the pthread_getspecific/setspecific * interface. This appears to outperform the standard linuxthreads one * by a significant margin. @@ -67,7 +80,7 @@ /* only as a backup. */ /* Return the "quick thread id". Default version. Assumes page size, */ -/* or at least thread stack separation, is at least 4K. */ +/* or at least thread stack separation, is at least 4 KB. */ /* Must be defined so that it never returns 0. (Page 0 can't really be */ /* part of any stack, since that would make 0 a valid stack pointer.) */ #define quick_thread_id() (((word)GC_approx_sp()) >> 12)
View file
_service:tar_scm:gc-8.0.6.tar.gz/include/private/thread_local_alloc.h -> _service:tar_scm:gc-8.2.2.tar.gz/include/private/thread_local_alloc.h
Changed
@@ -54,9 +54,11 @@ # endif /* !GNU */ # elif (defined(LINUX) && !defined(ARM32) && !defined(AVR32) \ && GC_GNUC_PREREQ(3, 3) \ - && !(defined(__clang__) && defined(HOST_ANDROID))) \ - || (defined(FREEBSD) && defined(__GLIBC__) /* kFreeBSD */ \ - && GC_GNUC_PREREQ(4, 4)) \ + && !(defined(__clang__) && (defined(HOST_ANDROID) \ + || (defined(AARCH64) && !GC_CLANG_PREREQ(8, 0))))) \ + || ((defined(NETBSD) && __NetBSD_Version__ >= 600000000 /* 6.0 */ \ + || defined(FREEBSD)) \ + && (GC_GNUC_PREREQ(4, 4) || GC_CLANG_PREREQ(3, 9))) \ || (defined(HOST_ANDROID) && defined(ARM32) \ && (GC_GNUC_PREREQ(4, 6) || GC_CLANG_PREREQ_FULL(3, 8, 256229))) # define USE_COMPILER_TLS @@ -133,13 +135,6 @@ # define GC_remove_specific_after_fork(key, t) (void)0 typedef void * GC_key_t; #elif defined(USE_WIN32_SPECIFIC) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE - EXTERN_C_END -# include <windows.h> - EXTERN_C_BEGIN # define GC_getspecific TlsGetValue # define GC_setspecific(key, v) !TlsSetValue(key, v) /* We assume 0 == success, msft does the opposite. */
View file
_service:tar_scm:gc-8.0.6.tar.gz/install-sh -> _service:tar_scm:gc-8.2.2.tar.gz/install-sh
Changed
@@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2013-12-25.23; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -271,15 +295,18 @@ fi dst=$dst_arg - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. + # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst - dst=$dstdir/`basename "$src"` + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac dstdir_status=0 else dstdir=`dirname "$dst"` @@ -288,27 +315,16 @@ fi fi + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *23672367) mkdir_umask=$umask;; - .*00202 | .0202 | .02) mkdir_umask=22;; - - *0-7) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -318,43 +334,49 @@ fi posix_mkdir=false - case $umask in - *1235670-70-7) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;;
View file
_service:tar_scm:gc-8.0.6.tar.gz/mach_dep.c -> _service:tar_scm:gc-8.2.2.tar.gz/mach_dep.c
Changed
@@ -14,7 +14,7 @@ #include "private/gc_priv.h" -#if !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) +#if !defined(PLATFORM_MACH_DEP) && !defined(SN_TARGET_PSP2) #include <stdio.h> @@ -26,6 +26,89 @@ # endif #endif +#ifdef E2K +# include <errno.h> +# include <asm/e2k_syswork.h> +# include <sys/mman.h> +# include <sys/syscall.h> + + GC_INNER size_t GC_get_procedure_stack(ptr_t buf, size_t buf_sz) { + word new_sz; + + GC_ASSERT(0 == buf_sz || buf != NULL); + for (;;) { + word stack_ofs; + + new_sz = 0; + if (syscall(__NR_access_hw_stacks, E2K_GET_PROCEDURE_STACK_SIZE, + NULL, NULL, 0, &new_sz) == -1) { + if (errno != EAGAIN) + ABORT_ARG1("Cannot get size of procedure stack", + ": errno= %d", errno); + continue; + } + GC_ASSERT(new_sz > 0 && new_sz % sizeof(word) == 0); + if (new_sz > buf_sz) + break; + /* Immediately read the stack right after checking its size. */ + stack_ofs = 0; + if (syscall(__NR_access_hw_stacks, E2K_READ_PROCEDURE_STACK_EX, + &stack_ofs, buf, new_sz, NULL) != -1) + break; + if (errno != EAGAIN) + ABORT_ARG2("Cannot read procedure stack", + ": new_sz= %lu, errno= %d", (unsigned long)new_sz, errno); + } + return (size_t)new_sz; + } + + ptr_t GC_save_regs_in_stack(void) { + __asm__ __volatile__ ("flushr"); + return NULL; + } + + GC_INNER ptr_t GC_mmap_procedure_stack_buf(size_t aligned_sz) + { + void *buf = mmap(NULL, aligned_sz, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANON, 0 /* fd */, 0 /* offset */); + if (MAP_FAILED == buf) + ABORT_ARG2("Could not map memory for procedure stack", + ": requested %lu bytes, errno= %d", + (unsigned long)aligned_sz, errno); + return (ptr_t)buf; + } + + GC_INNER void GC_unmap_procedure_stack_buf(ptr_t buf, size_t sz) + { + if (munmap(buf, ROUNDUP_PAGESIZE(sz)) == -1) + ABORT_ARG1("munmap failed (for procedure stack space)", + ": errno= %d", errno); + } + +# ifdef THREADS + GC_INNER size_t GC_alloc_and_get_procedure_stack(ptr_t *pbuf) + { + /* TODO: support saving from non-zero ofs in stack */ + ptr_t buf = NULL; + size_t new_sz, buf_sz; + + GC_ASSERT(I_HOLD_LOCK()); + for (buf_sz = 0; ; buf_sz = new_sz) { + new_sz = GC_get_procedure_stack(buf, buf_sz); + if (new_sz <= buf_sz) break; + + if (EXPECT(buf != NULL, FALSE)) + GC_INTERNAL_FREE(buf); + buf = (ptr_t)GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE(new_sz, PTRFREE); + if (NULL == buf) + ABORT("Could not allocate memory for procedure stack"); + } + *pbuf = buf; + return new_sz; + } +# endif /* THREADS */ +#endif /* E2K */ + #if defined(MACOS) && defined(__MWERKS__) #if defined(POWERPC) @@ -232,6 +315,8 @@ # if defined(HAVE_PUSH_REGS) GC_push_regs(); +# elif defined(EMSCRIPTEN) + /* No-op, "registers" are pushed in GC_push_other_roots(). */ # else # if defined(UNIX_LIKE) && !defined(NO_GETCONTEXT) /* Older versions of Darwin seem to lack getcontext(). */ @@ -284,11 +369,14 @@ ABORT("feenableexcept failed"); # endif # endif /* GETCONTEXT_FPU_EXCMASK_BUG */ -# if defined(SPARC) || defined(IA64) +# if defined(E2K) || defined(IA64) || defined(SPARC) /* On a register window machine, we need to save register */ /* contents on the stack for this to work. This may already be */ /* subsumed by the getcontext() call. */ - GC_save_regs_ret_val = GC_save_regs_in_stack(); +# if defined(IA64) || defined(SPARC) + GC_save_regs_ret_val = +# endif + GC_save_regs_in_stack(); # endif if (NULL == context) /* getcontext failed */ # endif /* !NO_GETCONTEXT */ @@ -298,6 +386,9 @@ /* force callee-save registers and register windows onto */ /* the stack. */ __builtin_unwind_init(); +# elif defined(NO_CRT) && defined(MSWIN32) + CONTEXT ctx; + RtlCaptureContext(&ctx); # else /* Generic code */ /* The idea is due to Parag Patel at HP. */ @@ -334,4 +425,4 @@ GC_noop1(COVERT_DATAFLOW(&dummy)); } -#endif /* !SN_TARGET_ORBIS && !SN_TARGET_PSP2 */ +#endif /* !PLATFORM_MACH_DEP && !SN_TARGET_PSP2 */
View file
_service:tar_scm:gc-8.0.6.tar.gz/malloc.c -> _service:tar_scm:gc-8.2.2.tar.gz/malloc.c
Changed
@@ -31,10 +31,9 @@ return(TRUE); } -/* Allocate a large block of size lb bytes. */ -/* The block is not cleared. */ -/* Flags is 0 or IGNORE_OFF_PAGE. */ -/* EXTRA_BYTES were already added to lb. */ +/* Allocate a large block of size lb bytes. The block is not cleared. */ +/* flags argument should be 0 or IGNORE_OFF_PAGE. EXTRA_BYTES value */ +/* was already added to lb. */ GC_INNER ptr_t GC_alloc_large(size_t lb, int k, unsigned flags) { struct hblk * h; @@ -52,8 +51,11 @@ LOCK(); } /* Do our share of marking work */ - if (GC_incremental && !GC_dont_gc) + if (GC_incremental && !GC_dont_gc) { + ENTER_GC(); GC_collect_a_little_inner((int)n_blocks); + EXIT_GC(); + } h = GC_allochblk(lb, k, flags); # ifdef USE_MUNMAP if (0 == h) { @@ -242,7 +244,7 @@ DCL_LOCK_STATE; GC_ASSERT(k < MAXOBJKINDS); - if (EXPECT(GC_have_errors, FALSE)) + if (EXPECT(get_have_errors(), FALSE)) GC_print_all_errors(); GC_INVOKE_FINALIZERS(); GC_DBG_COLLECT_AT_MALLOC(lb); @@ -381,14 +383,11 @@ } GC_ASSERT(0 == op || GC_is_marked(op)); } else { - hdr * hhdr; - - op = GC_generic_malloc(lb, k); - if (NULL == op) - return NULL; + op = GC_generic_malloc(lb, k); + if (op /* != NULL */) { /* CPPCHECK */ + hdr * hhdr = HDR(op); GC_ASSERT(((word)op & (HBLKSIZE - 1)) == 0); /* large block */ - hhdr = HDR(op); /* We don't need the lock here, since we have an undisguised */ /* pointer. We do need to hold the lock while we adjust */ /* mark bits. */ @@ -401,6 +400,7 @@ # endif hhdr -> hb_n_marks = 1; UNLOCK(); + } } return op; } @@ -564,8 +564,13 @@ struct obj_kind * ok; DCL_LOCK_STATE; - if (p == 0) return; + if (p /* != NULL */) { + /* CPPCHECK */ + } else { /* Required by ANSI. It's not my fault ... */ + return; + } + # ifdef LOG_ALLOCS GC_log_printf("GC_free(%p) after GC #%lu\n", p, (unsigned long)GC_gc_no);
View file
_service:tar_scm:gc-8.0.6.tar.gz/mallocx.c -> _service:tar_scm:gc-8.2.2.tar.gz/mallocx.c
Changed
@@ -3,6 +3,7 @@ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996 by Silicon Graphics. All rights reserved. * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. + * Copyright (c) 2009-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -27,20 +28,14 @@ #include <stdio.h> #include <string.h> -#ifdef MSWINCE -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE -# include <windows.h> -#else +#ifndef MSWINCE # include <errno.h> #endif /* Some externally visible but unadvertised variables to allow access to */ /* free lists from inlined allocators without including gc_priv.h */ /* or introducing dependencies on internal data structure layouts. */ -#include "gc_alloc_ptrs.h" +#include "private/gc_alloc_ptrs.h" void ** const GC_objfreelist_ptr = GC_objfreelist; void ** const GC_aobjfreelist_ptr = GC_aobjfreelist; void ** const GC_uobjfreelist_ptr = GC_uobjfreelist; @@ -84,6 +79,12 @@ struct hblk * h; hdr * hhdr; void * result; +# if defined(_FORTIFY_SOURCE) && defined(__GNUC__) && !defined(__clang__) + volatile /* Use cleared_p instead of p as a workaround to avoid */ + /* passing alloc_size(lb) attribute associated with p */ + /* to memset (including memset call inside GC_free). */ +# endif + word cleared_p = (word)p; size_t sz; /* Current size in bytes */ size_t orig_sz; /* Original sz in bytes */ int obj_kind; @@ -151,7 +152,7 @@ if (orig_sz > lb) { /* Clear unneeded part of object to avoid bogus pointer */ /* tracing. */ - BZERO(((ptr_t)p) + lb, orig_sz - lb); + BZERO((ptr_t)cleared_p + lb, orig_sz - lb); } return(p); } @@ -164,7 +165,7 @@ /* But this gives the client warning of imminent disaster. */ BCOPY(p, result, sz); # ifndef IGNORE_FREE - GC_free(p); + GC_free((ptr_t)cleared_p); # endif } return result; @@ -210,7 +211,7 @@ lb_rounded = GRANULES_TO_BYTES(lg); n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded); init = GC_obj_kindsk.ok_init; - if (EXPECT(GC_have_errors, FALSE)) + if (EXPECT(get_have_errors(), FALSE)) GC_print_all_errors(); GC_INVOKE_FINALIZERS(); GC_DBG_COLLECT_AT_MALLOC(lb); @@ -255,13 +256,13 @@ /* Increment GC_bytes_allocd from code that doesn't have direct access */ /* to GC_arrays. */ -GC_API void GC_CALL GC_incr_bytes_allocd(size_t n) +void GC_CALL GC_incr_bytes_allocd(size_t n) { GC_bytes_allocd += n; } /* The same for GC_bytes_freed. */ -GC_API void GC_CALL GC_incr_bytes_freed(size_t n) +void GC_CALL GC_incr_bytes_freed(size_t n) { GC_bytes_freed += n; } @@ -330,7 +331,7 @@ GC_ASSERT(k < MAXOBJKINDS); lw = BYTES_TO_WORDS(lb); lg = BYTES_TO_GRANULES(lb); - if (EXPECT(GC_have_errors, FALSE)) + if (EXPECT(get_have_errors(), FALSE)) GC_print_all_errors(); GC_INVOKE_FINALIZERS(); GC_DBG_COLLECT_AT_MALLOC(lb); @@ -443,7 +444,7 @@ /* Next try to allocate a new block worth of objects of this size. */ { struct hblk *h = GC_allochblk(lb, k, 0); - if (h != 0) { + if (h /* != NULL */) { /* CPPCHECK */ if (IS_UNCOLLECTABLE(k)) GC_set_hdr_marks(HDR(h)); GC_bytes_allocd += HBLKSIZE - HBLKSIZE % lb; # ifdef PARALLEL_MARK @@ -612,15 +613,17 @@ } #endif /* GC_REQUIRE_WCSDUP */ -GC_API void * GC_CALL GC_malloc_stubborn(size_t lb) -{ - return GC_malloc(lb); -} +#ifndef CPPCHECK + GC_API void * GC_CALL GC_malloc_stubborn(size_t lb) + { + return GC_malloc(lb); + } -GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED) -{ - /* Empty. */ -} + GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED) + { + /* Empty. */ + } +#endif /* !CPPCHECK */ GC_API void GC_CALL GC_end_stubborn_change(const void *p) {
View file
_service:tar_scm:gc-8.0.6.tar.gz/mark.c -> _service:tar_scm:gc-8.2.2.tar.gz/mark.c
Changed
@@ -2,6 +2,7 @@ * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved. + * Copyright (c) 2008-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -56,10 +57,6 @@ GC_noop_sink = x; } -/* mark_proc GC_mark_procsMAX_MARK_PROCS = {0} -- declared in gc_priv.h */ - -GC_INNER unsigned GC_n_mark_procs = GC_RESERVED_MARK_PROCS; - /* Initialize GC_obj_kinds properly and standard free lists properly. */ /* This must be done statically since they may be accessed before */ /* GC_init is called. */ @@ -84,8 +81,6 @@ # endif }; -GC_INNER unsigned GC_n_kinds = GC_N_KINDS_INITIAL_VALUE; - # ifndef INITIAL_MARK_STACK_SIZE # define INITIAL_MARK_STACK_SIZE (1*HBLKSIZE) /* INITIAL_MARK_STACK_SIZE * sizeof(mse) should be a */ @@ -103,25 +98,10 @@ /* Used for logging only. */ #endif -GC_INNER size_t GC_mark_stack_size = 0; - #ifdef PARALLEL_MARK - STATIC volatile AO_t GC_first_nonempty = 0; - /* Lowest entry on mark stack */ - /* that may be nonempty. */ - /* Updated only by initiating */ - /* thread. */ + GC_INNER GC_bool GC_parallel_mark_disabled = FALSE; #endif -GC_INNER mark_state_t GC_mark_state = MS_NONE; - -GC_INNER GC_bool GC_mark_stack_too_small = FALSE; - -static struct hblk * scan_ptr; - -STATIC GC_bool GC_objects_are_marked = FALSE; - /* Are there collectible marked objects in the heap? */ - /* Is a collection in progress? Note that this can return true in the */ /* non-incremental case, if a collection has been abandoned and the */ /* mark state is now MS_INVALID. */ @@ -130,7 +110,7 @@ return(GC_mark_state != MS_NONE); } -/* clear all mark bits in the header */ +/* Clear all mark bits in the header. */ GC_INNER void GC_clear_hdr_marks(hdr *hhdr) { size_t last_bit; @@ -171,9 +151,7 @@ # endif } -/* - * Clear all mark bits associated with block h. - */ +/* Clear all mark bits associated with block h. */ static void clear_marks_for_block(struct hblk *h, word dummy GC_ATTR_UNUSED) { hdr * hhdr = HDR(h); @@ -185,7 +163,7 @@ GC_clear_hdr_marks(hhdr); } -/* Slow but general routines for setting/clearing/asking about mark bits */ +/* Slow but general routines for setting/clearing/asking about mark bits. */ GC_API void GC_CALL GC_set_mark_bit(const void *p) { struct hblk *h = HBLKPTR(p); @@ -231,17 +209,15 @@ return (int)mark_bit_from_hdr(hhdr, bit_no); /* 0 or 1 */ } -/* - * Clear mark bits in all allocated heap blocks. This invalidates - * the marker invariant, and sets GC_mark_state to reflect this. - * (This implicitly starts marking to reestablish the invariant.) - */ +/* Clear mark bits in all allocated heap blocks. This invalidates the */ +/* marker invariant, and sets GC_mark_state to reflect this. (This */ +/* implicitly starts marking to reestablish the invariant.) */ GC_INNER void GC_clear_marks(void) { GC_apply_to_all_blocks(clear_marks_for_block, (word)0); GC_objects_are_marked = FALSE; GC_mark_state = MS_INVALID; - scan_ptr = 0; + GC_scan_ptr = NULL; } /* Initiate a garbage collection. Initiates a full collection if the */ @@ -253,28 +229,23 @@ if (GC_incremental) { # ifdef CHECKSUMS GC_read_dirty(FALSE); + GC_check_dirty(); # else GC_read_dirty(GC_mark_state == MS_INVALID); # endif } -# endif -# ifdef CHECKSUMS - if (GC_incremental) GC_check_dirty(); -# endif -# if !defined(GC_DISABLE_INCREMENTAL) GC_n_rescuing_pages = 0; # endif if (GC_mark_state == MS_NONE) { GC_mark_state = MS_PUSH_RESCUERS; } else if (GC_mark_state != MS_INVALID) { ABORT("Unexpected state"); - } /* else this is really a full collection, and mark */ - /* bits are invalid. */ - scan_ptr = 0; + } /* Else this is really a full collection, and mark bits are invalid. */ + GC_scan_ptr = NULL; } #ifdef PARALLEL_MARK - STATIC void GC_do_parallel_mark(void); /* initiate parallel marking. */ + STATIC void GC_do_parallel_mark(void); /* Initiate parallel marking. */ #endif /* PARALLEL_MARK */ #ifdef GC_DISABLE_INCREMENTAL @@ -324,8 +295,8 @@ MARK_FROM_MARK_STACK(); break; } else { - scan_ptr = GC_push_next_marked_dirty(scan_ptr); - if (scan_ptr == 0) { + GC_scan_ptr = GC_push_next_marked_dirty(GC_scan_ptr); + if (NULL == GC_scan_ptr) { # if !defined(GC_DISABLE_INCREMENTAL) GC_COND_LOG_PRINTF("Marked from %lu dirty pages\n", (unsigned long)GC_n_rescuing_pages); @@ -350,8 +321,8 @@ MARK_FROM_MARK_STACK(); break; } else { - scan_ptr = GC_push_next_marked_uncollectable(scan_ptr); - if (scan_ptr == 0) { + GC_scan_ptr = GC_push_next_marked_uncollectable(GC_scan_ptr); + if (NULL == GC_scan_ptr) { GC_push_roots(TRUE, cold_gc_frame); GC_objects_are_marked = TRUE; if (GC_mark_state != MS_INVALID) { @@ -363,15 +334,13 @@ case MS_ROOTS_PUSHED: # ifdef PARALLEL_MARK - /* In the incremental GC case, this currently doesn't */ - /* quite do the right thing, since it runs to */ - /* completion. On the other hand, starting a */ - /* parallel marker is expensive, so perhaps it is */ - /* the right thing? */ /* Eventually, incremental marking should run */ /* asynchronously in multiple threads, without grabbing */ /* the allocation lock. */ - if (GC_parallel) { + /* For now, parallel marker is disabled if there is */ + /* a chance that marking could be interrupted by */ + /* a client-supplied time limit or custom stop function. */ + if (GC_parallel && !GC_parallel_mark_disabled) { GC_do_parallel_mark(); GC_ASSERT((word)GC_mark_stack_top < (word)GC_first_nonempty); GC_mark_stack_top = GC_mark_stack - 1; @@ -406,7 +375,7 @@ MARK_FROM_MARK_STACK(); break; } - if (scan_ptr == 0 && GC_mark_state == MS_INVALID) { + if (NULL == GC_scan_ptr && GC_mark_state == MS_INVALID) { /* About to start a heap scan for marked objects. */ /* Mark stack is empty. OK to reallocate. */ if (GC_mark_stack_too_small) { @@ -414,8 +383,8 @@ } GC_mark_state = MS_PARTIALLY_INVALID; } - scan_ptr = GC_push_next_marked(scan_ptr); - if (scan_ptr == 0 && GC_mark_state == MS_PARTIALLY_INVALID) { + GC_scan_ptr = GC_push_next_marked(GC_scan_ptr); + if (NULL == GC_scan_ptr && GC_mark_state == MS_PARTIALLY_INVALID) { GC_push_roots(TRUE, cold_gc_frame); GC_objects_are_marked = TRUE;
View file
_service:tar_scm:gc-8.0.6.tar.gz/mark_rts.c -> _service:tar_scm:gc-8.2.2.tar.gz/mark_rts.c
Changed
@@ -1,6 +1,7 @@ /* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. + * Copyright (c) 2009-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -36,9 +37,6 @@ int GC_no_dls = 0; /* Register dynamic library data segments. */ -static int n_root_sets = 0; - /* GC_static_roots0..n_root_sets) contains the valid root sets. */ - #if !defined(NO_DEBUGGING) || defined(GC_ASSERTIONS) /* Should return the same value as GC_root_size. */ GC_INNER word GC_compute_root_size(void) @@ -66,7 +64,7 @@ (void *)GC_static_rootsi.r_end, GC_static_rootsi.r_tmp ? " (temporary)" : ""); } - GC_printf("GC_root_size: %lu\n", (unsigned long)GC_root_size); + GC_printf("GC_root_size= %lu\n", (unsigned long)GC_root_size); if ((size = GC_compute_root_size()) != GC_root_size) GC_err_printf("GC_root_size incorrect!! Should be: %lu\n", @@ -271,15 +269,15 @@ n_root_sets++; } -static GC_bool roots_were_cleared = FALSE; - GC_API void GC_CALL GC_clear_roots(void) { DCL_LOCK_STATE; if (!EXPECT(GC_is_initialized, TRUE)) GC_init(); LOCK(); - roots_were_cleared = TRUE; +# ifdef THREADS + GC_roots_were_cleared = TRUE; +# endif n_root_sets = 0; GC_root_size = 0; # if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) @@ -341,11 +339,10 @@ } #endif -#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) - STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e); +STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e); - GC_API void GC_CALL GC_remove_roots(void *b, void *e) - { +GC_API void GC_CALL GC_remove_roots(void *b, void *e) +{ DCL_LOCK_STATE; /* Quick check whether has nothing to do */ @@ -356,27 +353,29 @@ LOCK(); GC_remove_roots_inner((ptr_t)b, (ptr_t)e); UNLOCK(); - } +} - /* Should only be called when the lock is held */ - STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e) - { +/* Should only be called when the lock is held */ +STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e) +{ int i; - GC_bool rebuild = FALSE; +# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) + int old_n_roots = n_root_sets; +# endif for (i = 0; i < n_root_sets; ) { if ((word)GC_static_rootsi.r_start >= (word)b && (word)GC_static_rootsi.r_end <= (word)e) { GC_remove_root_at_pos(i); - rebuild = TRUE; } else { i++; } } - if (rebuild) +# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) + if (n_root_sets < old_n_roots) GC_rebuild_root_index(); - } -#endif /* !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) */ +# endif +} #ifdef USE_PROC_FOR_LIBRARIES /* Exchange the elements of the roots table. Requires rebuild of */ @@ -502,8 +501,11 @@ GC_INNER ptr_t GC_approx_sp(void) { volatile word sp; -# if defined(S390) && !defined(CPPCHECK) && (__clang_major__ < 8) - /* Workaround a crash in SystemZTargetLowering of libLLVM-3.8. */ +# if ((defined(E2K) && defined(__clang__)) \ + || (defined(S390) && (__clang_major__ < 8))) && !defined(CPPCHECK) + /* Workaround some bugs in clang: */ + /* "undefined reference to llvm.frameaddress" error (clang-9/e2k); */ + /* a crash in SystemZTargetLowering of libLLVM-3.8 (S390). */ sp = (word)&sp; # elif defined(CPPCHECK) || (__GNUC__ >= 4 /* GC_GNUC_PREREQ(4, 0) */ \ && !defined(STACK_NOT_SCANNED)) @@ -532,7 +534,10 @@ -- address order. */ -STATIC size_t GC_excl_table_entries = 0;/* Number of entries in use. */ +GC_API void GC_CALL GC_clear_exclusion_table(void) +{ + GC_excl_table_entries = 0; +} /* Return the first exclusion range that includes an address >= start_addr */ /* Assumes the exclusion table contains at least one entry (namely the */ @@ -540,8 +545,10 @@ STATIC struct exclusion * GC_next_exclusion(ptr_t start_addr) { size_t low = 0; - size_t high = GC_excl_table_entries - 1; + size_t high; + GC_ASSERT(GC_excl_table_entries > 0); + high = GC_excl_table_entries - 1; while (high > low) { size_t mid = (low + high) >> 1; @@ -617,18 +624,14 @@ # define GC_PUSH_CONDITIONAL(b, t, all) \ (GC_parallel \ ? GC_push_conditional_eager(b, t, all) \ - : GC_push_conditional(b, t, all)) -#elif defined(GC_DISABLE_INCREMENTAL) -# define GC_PUSH_CONDITIONAL(b, t, all) GC_push_all(b, t) + : GC_push_conditional_static(b, t, all)) #else -# define GC_PUSH_CONDITIONAL(b, t, all) GC_push_conditional(b, t, all) - /* Do either of GC_push_all or GC_push_selected */ - /* depending on the third arg. */ +# define GC_PUSH_CONDITIONAL(b, t, all) GC_push_conditional_static(b, t, all) #endif /* Invoke push_conditional on ranges that are not excluded. */ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top, - GC_bool all GC_ATTR_UNUSED) + GC_bool all) { while ((word)bottom < (word)top) { struct exclusion *next = GC_next_exclusion(bottom); @@ -645,12 +648,15 @@ } } -#ifdef IA64 +#if defined(E2K) || defined(IA64) /* Similar to GC_push_all_stack_sections() but for IA-64 registers store. */ GC_INNER void GC_push_all_register_sections(ptr_t bs_lo, ptr_t bs_hi, int eager, struct GC_traced_stack_sect_s *traced_stack_sect) { - while (traced_stack_sect != NULL) { +# ifdef E2K + (void)traced_stack_sect; /* TODO: Not implemented yet */ +# else + while (traced_stack_sect != NULL) { ptr_t frame_bs_lo = traced_stack_sect -> backing_store_end; GC_ASSERT((word)frame_bs_lo <= (word)bs_hi); if (eager) { @@ -660,7 +666,8 @@ } bs_hi = traced_stack_sect -> saved_backing_store_ptr; traced_stack_sect = traced_stack_sect -> prev; - } + } +# endif GC_ASSERT((word)bs_lo <= (word)bs_hi); if (eager) { GC_push_all_eager(bs_lo, bs_hi); @@ -668,7 +675,7 @@ GC_push_all_stack(bs_lo, bs_hi); } } -#endif /* IA64 */ +#endif /* E2K || IA64 */ #ifdef THREADS @@ -776,27 +783,19 @@ #endif /* !THREADS */
View file
_service:tar_scm:gc-8.0.6.tar.gz/misc.c -> _service:tar_scm:gc-8.2.2.tar.gz/misc.c
Changed
@@ -2,6 +2,7 @@ * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved. + * Copyright (c) 2008-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -27,21 +28,17 @@ # include <sys/syscall.h> #endif -#if defined(MSWIN32) || defined(MSWINCE) \ - || (defined(CYGWIN32) && defined(GC_READ_ENV_FILE)) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE -# include <windows.h> -#endif - -#if defined(UNIX_LIKE) || defined(CYGWIN32) || defined(SYMBIAN) +#if defined(UNIX_LIKE) || defined(CYGWIN32) || defined(SYMBIAN) \ + || (defined(CONSOLE_LOG) && defined(MSWIN32)) # include <fcntl.h> # include <sys/types.h> # include <sys/stat.h> #endif +#if defined(CONSOLE_LOG) && defined(MSWIN32) && !defined(__GNUC__) +# include <io.h> +#endif + #ifdef NONSTOP # include <floss.h> #endif @@ -52,7 +49,7 @@ GC_INNER PCR_Th_ML GC_allocate_ml; # elif defined(SN_TARGET_PSP2) GC_INNER WapiMutex GC_allocate_ml_PSP2 = { 0, NULL }; -# elif defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3) +# elif defined(GC_DEFN_ALLOCATE_ML) || defined(SN_TARGET_PS3) # include <pthread.h> GC_INNER pthread_mutex_t GC_allocate_ml; # endif @@ -78,6 +75,10 @@ GC_FAR struct _GC_arrays GC_arrays /* = { 0 } */; +GC_INNER unsigned GC_n_mark_procs = GC_RESERVED_MARK_PROCS; + +GC_INNER unsigned GC_n_kinds = GC_N_KINDS_INITIAL_VALUE; + GC_INNER GC_bool GC_debugging_started = FALSE; /* defined here so we don't have to load dbg_mlc.o */ @@ -189,8 +190,6 @@ # endif #elif !defined(HAVE_NO_FORK) - - /* Same as above but with GC_CALL calling conventions. */ GC_API void GC_CALL GC_atfork_prepare(void) { # ifdef THREADS @@ -314,7 +313,11 @@ } /* Make sure the recursive call is not a tail call, and the bzero */ /* call is not recognized as dead code. */ - GC_noop1(COVERT_DATAFLOW(dummy)); +# if defined(CPPCHECK) + GC_noop1(dummy0); +# else + GC_noop1(COVERT_DATAFLOW(dummy)); +# endif return(arg); } # endif /* !ASM_CLEAR_CODE */ @@ -479,6 +482,11 @@ return (size_t)(GC_heapsize - GC_unmapped_bytes); } +GC_API size_t GC_CALL GC_get_obtained_from_os_bytes(void) +{ + return (size_t)GC_our_mem_bytes; +} + GC_API size_t GC_CALL GC_get_free_bytes(void) { /* ignore the memory space returned to OS */ @@ -553,6 +561,7 @@ (word)GC_bytes_found : 0; pstats->reclaimed_bytes_before_gc = GC_reclaimed_bytes_before_gc; pstats->expl_freed_bytes_since_gc = GC_bytes_freed; /* since gc-7.7 */ + pstats->obtained_from_os_bytes = GC_our_mem_bytes; /* since gc-8.2 */ } # include <string.h> /* for memset() */ @@ -661,6 +670,8 @@ unsigned len; DWORD nBytesRead; TCHAR path_MAX_PATH + 0x10; /* buffer for path + ext */ + size_t bytes_to_get; + len = (unsigned)GetModuleFileName(NULL /* hModule */, path, _MAX_PATH + 1); /* If GetModuleFileName() has failed then len is 0. */ @@ -681,11 +692,14 @@ } /* At this execution point, GC_setpagesize() and GC_init_win32() */ /* must already be called (for GET_MEM() to work correctly). */ - content = (char *)GET_MEM(ROUNDUP_PAGESIZE_IF_MMAP((size_t)len + 1)); + GC_ASSERT(GC_page_size != 0); + bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP((size_t)len + 1); + content = (char *)GET_MEM(bytes_to_get); if (content == NULL) { CloseHandle(hFile); return; /* allocation failure */ } + GC_add_to_our_memory(content, bytes_to_get); ofs = 0; nBytesRead = (DWORD)-1L; /* Last ReadFile() call should clear nBytesRead on success. */ @@ -695,8 +709,10 @@ break; } CloseHandle(hFile); - if (ofs != len || nBytesRead != 0) + if (ofs != len || nBytesRead != 0) { + /* TODO: recycle content */ return; /* read operation is failed - ignoring the file content */ + } contentofs = '\0'; while (ofs-- > 0) { if (contentofs == '\r' || contentofs == '\n') @@ -714,7 +730,8 @@ { char *p; char *end_of_content; - unsigned namelen; + size_t namelen; + # ifndef NO_GETENV p = getenv(name); /* try the standard getenv() first */ if (p != NULL) @@ -745,8 +762,8 @@ return GC_is_initialized; } -#if (defined(MSWIN32) || defined(MSWINCE) || defined(MSWIN_XBOX1)) \ - && defined(THREADS) +#if defined(GC_WIN32_THREADS) \ + && ((defined(MSWIN32) && !defined(CONSOLE_LOG)) || defined(MSWINCE)) GC_INNER CRITICAL_SECTION GC_write_cs; #endif @@ -805,19 +822,20 @@ #if !defined(OS2) && !defined(MACOS) && !defined(GC_ANDROID_LOG) \ && !defined(NN_PLATFORM_CTR) && !defined(NINTENDO_SWITCH) \ - && !defined(MSWIN32) && !defined(MSWINCE) + && (!defined(MSWIN32) || defined(CONSOLE_LOG)) && !defined(MSWINCE) STATIC int GC_stdout = GC_DEFAULT_STDOUT_FD; STATIC int GC_stderr = GC_DEFAULT_STDERR_FD; STATIC int GC_log = GC_DEFAULT_STDERR_FD; - GC_API void GC_CALL GC_set_log_fd(int fd) - { - GC_log = fd; - } +# ifndef MSWIN32 + GC_API void GC_CALL GC_set_log_fd(int fd) + { + GC_log = fd; + } +# endif #endif -#if defined(MSWIN32) && !defined(MSWINRT_FLAVOR) && !defined(MSWIN_XBOX1) \ - && !defined(SMALL_CONFIG) +#ifdef MSGBOX_ON_ERROR STATIC void GC_win32_MessageBoxA(const char *msg, const char *caption, unsigned flags) { @@ -836,7 +854,7 @@ } # endif } -#endif /* MSWIN32 */ +#endif /* MSGBOX_ON_ERROR */ #if defined(THREADS) && defined(UNIX_LIKE) && !defined(NO_GETCONTEXT) static void callee_saves_pushed_dummy_fn(ptr_t data GC_ATTR_UNUSED, @@ -970,8 +988,9 @@ /* else */ InitializeCriticalSection(&GC_allocate_ml); } # endif -# endif /* GC_WIN32_THREADS */ -# if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS) +# endif /* GC_WIN32_THREADS && !GC_PTHREADS */
View file
_service:tar_scm:gc-8.0.6.tar.gz/missing -> _service:tar_scm:gc-8.2.2.tar.gz/missing
Changed
@@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,9 +207,9 @@ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End:
View file
_service:tar_scm:gc-8.0.6.tar.gz/new_hblk.c -> _service:tar_scm:gc-8.2.2.tar.gz/new_hblk.c
Changed
@@ -42,7 +42,7 @@ p1 = 0; p2 = (word)p; p3 = 0; - }; + } return((ptr_t)(p-2)); } @@ -62,7 +62,7 @@ p0 = (word)(p-4); p1 = 0; CLEAR_DOUBLE(p+2); - }; + } return((ptr_t)(p-4)); } @@ -78,7 +78,7 @@ for (; (word)p < (word)lim; p += 4) { p0 = (word)(p-2); p2 = (word)p; - }; + } return((ptr_t)(p-2)); } @@ -95,7 +95,7 @@ GC_PREFETCH_FOR_WRITE((ptr_t)(p + 64)); p0 = (word)(p-4); p4 = (word)p; - }; + } return((ptr_t)(p-4)); } #endif /* !SMALL_CONFIG */ @@ -174,6 +174,7 @@ GC_bool clear = GC_obj_kindskind.ok_init; GC_STATIC_ASSERT((sizeof (struct hblk)) == HBLKSIZE); + GC_ASSERT(I_HOLD_LOCK()); if (GC_debugging_started) clear = TRUE;
View file
_service:tar_scm:gc-8.0.6.tar.gz/obj_map.c -> _service:tar_scm:gc-8.2.2.tar.gz/obj_map.c
Changed
@@ -35,6 +35,7 @@ GC_INNER void GC_register_displacement_inner(size_t offset) { + GC_ASSERT(I_HOLD_LOCK()); if (offset >= VALID_OFFSET_SZ) { ABORT("Bad argument to GC_register_displacement"); } @@ -46,8 +47,7 @@ #ifdef MARK_BIT_PER_GRANULE /* Add a heap block map for objects of size granules to obj_map. */ - /* Return FALSE on failure. */ - /* A size of 0 granules is used for large objects. */ + /* A size of 0 is used for large objects. Return FALSE on failure. */ GC_INNER GC_bool GC_add_map_entry(size_t granules) { unsigned displ;
View file
_service:tar_scm:gc-8.0.6.tar.gz/os_dep.c -> _service:tar_scm:gc-8.2.2.tar.gz/os_dep.c
Changed
@@ -3,6 +3,7 @@ * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved. + * Copyright (c) 2008-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -50,16 +51,6 @@ # undef GC_AMIGA_DEF #endif -#if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE -# include <windows.h> - /* It's not clear this is completely kosher under Cygwin. But it */ - /* allows us to get a working GC_get_stack_base. */ -#endif - #ifdef MACOS # include <Processes.h> #endif @@ -76,6 +67,10 @@ # include <sys/types.h> # include <sys/mman.h> # include <sys/stat.h> +#endif + +#if defined(ADD_HEAP_GUARD_PAGES) || defined(LINUX_STACKBOTTOM) \ + || defined(MMAP_SUPPORTED) || defined(NEED_PROC_MAPS) # include <errno.h> #endif @@ -109,34 +104,42 @@ #define IGNORE_PAGES_EXECUTABLE 1 /* Undefined on GC_pages_executable real use. */ -#ifdef NEED_PROC_MAPS -/* We need to parse /proc/self/maps, either to find dynamic libraries, */ -/* and/or to find the register backing store base (IA64). Do it once */ -/* here. */ +#if ((defined(LINUX_STACKBOTTOM) || defined(NEED_PROC_MAPS) \ + || defined(PROC_VDB) || defined(SOFT_VDB)) && !defined(PROC_READ)) \ + || defined(CPPCHECK) +# define PROC_READ read + /* Should probably call the real read, if read is wrapped. */ +#endif -/* Repeatedly perform a read call until the buffer is filled or */ -/* we encounter EOF. */ -STATIC ssize_t GC_repeat_read(int fd, char *buf, size_t count) -{ -# define READ read +#if defined(LINUX_STACKBOTTOM) || defined(NEED_PROC_MAPS) + /* Repeatedly perform a read call until the buffer is filled */ + /* up, or we encounter EOF or an error. */ + STATIC ssize_t GC_repeat_read(int fd, char *buf, size_t count) + { size_t num_read = 0; ASSERT_CANCEL_DISABLED(); while (num_read < count) { - ssize_t result = READ(fd, buf + num_read, count - num_read); + ssize_t result = PROC_READ(fd, buf + num_read, count - num_read); if (result < 0) return result; if (result == 0) break; num_read += result; } -# undef READ return num_read; -} + } +#endif /* LINUX_STACKBOTTOM || NEED_PROC_MAPS */ + +#ifdef NEED_PROC_MAPS +/* We need to parse /proc/self/maps, either to find dynamic libraries, */ +/* and/or to find the register backing store base (IA64). Do it once */ +/* here. */ #ifdef THREADS /* Determine the length of a file by incrementally reading it into a */ /* buffer. This would be silly to use it on a file supporting lseek, */ /* but Linux /proc files usually do not. */ + /* As of Linux 4.15.0, lseek(SEEK_END) fails for /proc/self/maps. */ STATIC size_t GC_get_file_len(int f) { size_t total = 0; @@ -145,7 +148,7 @@ char bufGET_FILE_LEN_BUF_SZ; do { - result = read(f, buf, GET_FILE_LEN_BUF_SZ); + result = PROC_READ(f, buf, sizeof(buf)); if (result == -1) return 0; total += result; } while (result > 0); @@ -164,10 +167,8 @@ #endif /* THREADS */ /* Copy the contents of /proc/self/maps to a buffer in our address */ -/* space. Return the address of the buffer, or zero on failure. */ -/* This code could be simplified if we could determine its size ahead */ -/* of time. */ -GC_INNER char * GC_get_maps(void) +/* space. Return the address of the buffer. */ +GC_INNER const char * GC_get_maps(void) { ssize_t result; static char *maps_buf = NULL; @@ -185,19 +186,19 @@ /* threads that we already think of as dead release their */ /* stacks. And there is no easy way to read the entire */ /* file atomically. This is arguably a misfeature of the */ - /* /proc/.../maps interface. */ + /* /proc/self/maps interface. */ /* Since we expect the file can grow asynchronously in rare */ /* cases, it should suffice to first determine */ - /* the size (using lseek or read), and then to reread the */ - /* file. If the size is inconsistent we have to retry. */ + /* the size (using read), and then to reread the file. */ + /* If the size is inconsistent we have to retry. */ /* This only matters with threads enabled, and if we use */ /* this to locate roots (not the default). */ # ifdef THREADS /* Determine the initial size of /proc/self/maps. */ - /* Note that lseek doesn't work, at least as of 2.6.15. */ maps_size = GC_get_maps_len(); - if (0 == maps_size) return 0; + if (0 == maps_size) + ABORT("Cannot determine length of /proc/self/maps"); # else maps_size = 4000; /* Guess */ # endif @@ -209,35 +210,47 @@ int f; while (maps_size >= maps_buf_sz) { - GC_scratch_recycle_no_gww(maps_buf, maps_buf_sz); +# ifdef LINT2 + /* Workaround passing tainted maps_buf to a tainted sink. */ + GC_noop1((word)maps_buf); +# else + GC_scratch_recycle_no_gww(maps_buf, maps_buf_sz); +# endif /* Grow only by powers of 2, since we leak "too small" buffers.*/ while (maps_size >= maps_buf_sz) maps_buf_sz *= 2; maps_buf = GC_scratch_alloc(maps_buf_sz); + if (NULL == maps_buf) + ABORT_ARG1("Insufficient space for /proc/self/maps buffer", + ", %lu bytes requested", (unsigned long)maps_buf_sz); # ifdef THREADS /* Recompute initial length, since we allocated. */ /* This can only happen a few times per program */ /* execution. */ maps_size = GC_get_maps_len(); - if (0 == maps_size) return 0; + if (0 == maps_size) + ABORT("Cannot determine length of /proc/self/maps"); # endif - if (maps_buf == 0) return 0; } GC_ASSERT(maps_buf_sz >= maps_size + 1); f = open("/proc/self/maps", O_RDONLY); - if (-1 == f) return 0; + if (-1 == f) + ABORT_ARG1("Cannot open /proc/self/maps", + ": errno= %d", errno); # ifdef THREADS old_maps_size = maps_size; # endif maps_size = 0; do { result = GC_repeat_read(f, maps_buf, maps_buf_sz-1); - if (result <= 0) - break; + if (result < 0) { + ABORT_ARG1("Failed to read /proc/self/maps", + ": errno= %d", errno); + } maps_size += result; } while ((size_t)result == maps_buf_sz-1); close(f); - if (result <= 0) - return 0; + if (0 == maps_size) + ABORT("Empty /proc/self/maps"); # ifdef THREADS if (maps_size > old_maps_size) { /* This might be caused by e.g. thread creation. */ @@ -268,40 +281,41 @@ * anywhere, which is safer anyway. */ -/* Assign various fields of the first line in buf_ptr to (*start), */ +/* Assign various fields of the first line in maps_ptr to (*start), */
View file
_service:tar_scm:gc-8.0.6.tar.gz/pthread_start.c -> _service:tar_scm:gc-8.2.2.tar.gz/pthread_start.c
Changed
@@ -22,7 +22,7 @@ /* case at the top of the file. FIXME: it's still unclear whether this */ /* will actually cause the exit handler to be invoked last when */ /* thread_exit is called (and if -fexceptions is used). */ -#if defined(__GNUC__) && defined(__linux__) +#if !defined(DONT_UNDEF_EXCEPTIONS) && defined(__GNUC__) && defined(__linux__) /* We undefine __EXCEPTIONS to avoid using GCC __cleanup__ attribute. */ /* The current NPTL implementation of pthread_cleanup_push uses */ /* __cleanup__ attribute when __EXCEPTIONS is defined (-fexceptions). */
View file
_service:tar_scm:gc-8.0.6.tar.gz/pthread_stop_world.c -> _service:tar_scm:gc-8.2.2.tar.gz/pthread_stop_world.c
Changed
@@ -4,6 +4,7 @@ * Copyright (c) 1998 by Fergus Henderson. All rights reserved. * Copyright (c) 2000-2009 by Hewlett-Packard Development Company. * All rights reserved. + * Copyright (c) 2008-2020 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -18,13 +19,44 @@ #include "private/pthread_support.h" #if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && \ - !defined(GC_DARWIN_THREADS) && !defined(SN_TARGET_ORBIS) \ + !defined(GC_DARWIN_THREADS) && !defined(PLATFORM_STOP_WORLD) \ && !defined(SN_TARGET_PSP2) #ifdef NACL - # include <unistd.h> # include <sys/time.h> +#elif defined(GC_OPENBSD_UTHREADS) +# include <pthread_np.h> +#else +# include <signal.h> +# include <semaphore.h> +# include <errno.h> +# include <time.h> /* for nanosleep() */ +# include <unistd.h> +#endif /* !GC_OPENBSD_UTHREADS && !NACL */ + +#ifndef GC_OPENBSD_UTHREADS + GC_INLINE void GC_usleep(unsigned us) + { +# if defined(LINT2) || defined(THREAD_SANITIZER) + /* Workaround "waiting while holding a lock" static analyzer warning. */ + /* Workaround a rare hang in usleep() trying to acquire TSan Lock. */ + while (us-- > 0) + sched_yield(); /* pretending it takes 1us */ +# elif defined(CPPCHECK) /* || _POSIX_C_SOURCE >= 199309L */ + struct timespec ts; + + ts.tv_sec = 0; + ts.tv_nsec = us * 1000; + /* This requires _POSIX_TIMERS feature. */ + (void)nanosleep(&ts, NULL); +# else + usleep(us); +# endif + } +#endif /* !GC_OPENBSD_UTHREADS */ + +#ifdef NACL STATIC int GC_nacl_num_gc_threads = 0; STATIC __thread int GC_nacl_thread_idx = -1; @@ -36,17 +68,7 @@ volatile int GC_nacl_thread_parkedMAX_NACL_GC_THREADS; int GC_nacl_thread_usedMAX_NACL_GC_THREADS; -#elif defined(GC_OPENBSD_UTHREADS) - -# include <pthread_np.h> - -#else /* !GC_OPENBSD_UTHREADS && !NACL */ - -#include <signal.h> -#include <semaphore.h> -#include <errno.h> -#include <time.h> /* for nanosleep() */ -#include <unistd.h> +#elif !defined(GC_OPENBSD_UTHREADS) #if (!defined(AO_HAVE_load_acquire) || !defined(AO_HAVE_store_release)) \ && !defined(CPPCHECK) @@ -57,10 +79,6 @@ /* It's safe to call original pthread_sigmask() here. */ #undef pthread_sigmask -#ifdef GC_ENABLE_SUSPEND_THREAD - static void *GC_CALLBACK suspend_self_inner(void *client_data); -#endif - #ifdef DEBUG_THREADS # ifndef NSIG # if defined(MAXSIG) @@ -127,8 +145,9 @@ /* before they are expected to stop (unless */ /* they have stopped voluntarily). */ -#if defined(GC_OSF1_THREADS) || defined(THREAD_SANITIZER) \ - || defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) +#ifndef NO_RETRY_SIGNALS + /* Any platform could lose signals, so let's be conservative and */ + /* always enable signals retry logic. */ STATIC GC_bool GC_retry_signals = TRUE; #else STATIC GC_bool GC_retry_signals = FALSE; @@ -153,6 +172,10 @@ # else # define SIG_THR_RESTART SIGRTMIN + 5 # endif +# elif defined(GC_FREEBSD_THREADS) && defined(__GLIBC__) +# define SIG_THR_RESTART (32+5) +# elif defined(GC_FREEBSD_THREADS) || defined(HURD) || defined(RTEMS) +# define SIG_THR_RESTART SIGUSR2 # else # define SIG_THR_RESTART SIGXCPU # endif @@ -229,17 +252,13 @@ ABORT("Bad signal in suspend_handler"); } -# if defined(IA64) || defined(HP_PA) || defined(M68K) +# if defined(E2K) || defined(HP_PA) || defined(IA64) || defined(M68K) \ + || defined(NO_SA_SIGACTION) GC_with_callee_saves_pushed(GC_suspend_handler_inner, NULL); # else - /* We believe that in all other cases the full context is already */ + /* We believe that in this case the full context is already */ /* in the signal handler frame. */ - { -# ifdef NO_SA_SIGACTION - void *context = 0; -# endif GC_suspend_handler_inner(NULL, context); - } # endif errno = old_errno; } @@ -292,7 +311,8 @@ /* avoid the related TSan warning. */ # ifdef SPARC ao_store_async((volatile AO_t *)&me->stop_info.stack_ptr, - (AO_t)GC_save_regs_in_stack()); + (AO_t)GC_save_regs_in_stack()); + /* TODO: regs saving already done by GC_with_callee_saves_pushed */ # else # ifdef IA64 me -> backing_store_ptr = GC_save_regs_in_stack(); @@ -307,7 +327,14 @@ { pthread_t self = pthread_self(); GC_thread me; +# ifdef E2K + ptr_t bs_lo; + size_t stack_size; +# endif IF_CANCEL(int cancel_state;) +# ifdef GC_ENABLE_SUSPEND_THREAD + word suspend_cnt; +# endif AO_t my_stop_count = ao_load_acquire_async(&GC_stop_count); /* After the barrier, this thread should see */ /* the actual content of GC_threads. */ @@ -329,20 +356,14 @@ me = GC_lookup_thread_async(self); # ifdef GC_ENABLE_SUSPEND_THREAD - if (ao_load_async(&me->suspended_ext)) { - GC_store_stack_ptr(me); - sem_post(&GC_suspend_ack_sem); - suspend_self_inner(me); -# ifdef DEBUG_THREADS - GC_log_printf("Continuing %p on GC_resume_thread\n", (void *)self); -# endif - RESTORE_CANCEL(cancel_state); - return; - } + suspend_cnt = (word)ao_load_async(&(me -> stop_info.ext_suspend_cnt)); # endif - if (((word)me->stop_info.last_stop_count & ~(word)THREAD_RESTARTED) - == (word)my_stop_count) { + == (word)my_stop_count +# ifdef GC_ENABLE_SUSPEND_THREAD + && (suspend_cnt & 1) == 0 +# endif + ) { /* Duplicate signal. OK if we are retrying. */ if (!GC_retry_signals) { WARN("Duplicate suspend signal in thread %p\n", self); @@ -351,21 +372,13 @@ return; } GC_store_stack_ptr(me); - -# ifdef THREAD_SANITIZER - /* TSan disables signals around signal handlers. Without */ - /* a pthread_sigmask call, sigsuspend may block forever. */ - { - sigset_t set; - sigemptyset(&set); - GC_ASSERT(GC_sig_suspend != SIGNAL_UNSET); - GC_ASSERT(GC_sig_thr_restart != SIGNAL_UNSET); - sigaddset(&set, GC_sig_suspend); - sigaddset(&set, GC_sig_thr_restart); - if (pthread_sigmask(SIG_UNBLOCK, &set, NULL) != 0) - ABORT("pthread_sigmask failed in suspend handler"); - } +# ifdef E2K
View file
_service:tar_scm:gc-8.0.6.tar.gz/pthread_support.c -> _service:tar_scm:gc-8.2.2.tar.gz/pthread_support.c
Changed
@@ -3,6 +3,7 @@ * Copyright (c) 1996 by Silicon Graphics. All rights reserved. * Copyright (c) 1998 by Fergus Henderson. All rights reserved. * Copyright (c) 2000-2005 by Hewlett-Packard Company. All rights reserved. + * Copyright (c) 2008-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -309,12 +310,12 @@ #endif /* THREAD_LOCAL_ALLOC */ -#ifdef PARALLEL_MARK - # ifndef MAX_MARKERS # define MAX_MARKERS 16 # endif +#ifdef PARALLEL_MARK + static ptr_t marker_spMAX_MARKERS - 1 = {0}; #ifdef IA64 static ptr_t marker_bspMAX_MARKERS - 1 = {0}; @@ -335,6 +336,40 @@ } #endif /* GC_DARWIN_THREADS */ +#ifdef HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG /* NetBSD */ + static void set_marker_thread_name(unsigned id) + { + int err = pthread_setname_np(pthread_self(), "GC-marker-%zu", + (void*)(size_t)id); + if (err != 0) + WARN("pthread_setname_np failed, errno= %" WARN_PRIdPTR "\n", err); + } +#elif defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID) \ + || defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) + static void set_marker_thread_name(unsigned id) + { + char name_buf16; /* pthread_setname_np may fail for longer names */ + int len = sizeof("GC-marker-") - 1; + + /* Compose the name manually as snprintf may be unavailable or */ + /* "%u directive output may be truncated" warning may occur. */ + BCOPY("GC-marker-", name_buf, len); + if (id >= 10) + name_buflen++ = (char)('0' + (id / 10) % 10); + name_buflen = (char)('0' + id % 10); + name_buflen + 1 = '\0'; + +# ifdef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID /* iOS, OS X */ + (void)pthread_setname_np(name_buf); +# else /* Linux, Solaris, etc. */ + if (pthread_setname_np(pthread_self(), name_buf) != 0) + WARN("pthread_setname_np failed\n", 0); +# endif + } +#else +# define set_marker_thread_name(id) (void)(id) +#endif + STATIC void * GC_mark_thread(void * id) { word my_mark_no = 0; @@ -344,6 +379,7 @@ DISABLE_CANCEL(cancel_state); /* Mark threads are not cancellable; they */ /* should be invisible to client. */ + set_marker_thread_name((unsigned)(word)id); marker_sp(word)id = GC_approx_sp(); # ifdef IA64 marker_bsp(word)id = GC_save_regs_in_stack(); @@ -379,15 +415,31 @@ STATIC pthread_t GC_mark_threadsMAX_MARKERS; +#ifdef GLIBC_2_1_MUTEX_HACK + /* Ugly workaround for a linux threads bug in the final versions */ + /* of glibc2.1. Pthread_mutex_trylock sets the mutex owner */ + /* field even when it fails to acquire the mutex. This causes */ + /* pthread_cond_wait to die. Remove for glibc2.2. */ + /* According to the man page, we should use */ + /* PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, but that isn't actually */ + /* defined. */ + static pthread_mutex_t mark_mutex = + {0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, {0, 0}}; +#else + static pthread_mutex_t mark_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif + +static int available_markers_m1 = 0; + #ifdef CAN_HANDLE_FORK - static int available_markers_m1 = 0; static pthread_cond_t mark_cv; /* initialized by GC_start_mark_threads_inner */ #else -# define available_markers_m1 GC_markers_m1 static pthread_cond_t mark_cv = PTHREAD_COND_INITIALIZER; #endif +STATIC void GC_wait_for_gc_completion(GC_bool wait_for_all); + GC_INNER void GC_start_mark_threads_inner(void) { int i; @@ -396,12 +448,13 @@ sigset_t set, oldset; # endif - GC_ASSERT(I_DONT_HOLD_LOCK()); - if (available_markers_m1 <= 0) return; + GC_ASSERT(I_HOLD_LOCK()); + ASSERT_CANCEL_DISABLED(); + if (available_markers_m1 <= 0 || GC_parallel) return; /* Skip if parallel markers disabled or already started. */ -# ifdef CAN_HANDLE_FORK - if (GC_parallel) return; + GC_wait_for_gc_completion(TRUE); +# ifdef CAN_HANDLE_FORK /* Initialize mark_cv (for the first time), or cleanup its value */ /* after forking in the child process. All the marker threads in */ /* the parent process were blocked on this variable at fork, so */ @@ -453,21 +506,20 @@ if (REAL_FUNC(pthread_sigmask)(SIG_BLOCK, &set, &oldset) < 0) { WARN("pthread_sigmask set failed, no markers started," - " errno = %" WARN_PRIdPTR "\n", errno); + " errno= %" WARN_PRIdPTR "\n", errno); GC_markers_m1 = 0; (void)pthread_attr_destroy(&attr); return; } # endif /* !NO_MARKER_SPECIAL_SIGMASK */ -# ifdef CAN_HANDLE_FORK - /* To have proper GC_parallel value in GC_help_marker. */ - GC_markers_m1 = available_markers_m1; -# endif + /* To have proper GC_parallel value in GC_help_marker. */ + GC_markers_m1 = available_markers_m1; + for (i = 0; i < available_markers_m1; ++i) { if (0 != REAL_FUNC(pthread_create)(GC_mark_threads + i, &attr, GC_mark_thread, (void *)(word)i)) { - WARN("Marker thread creation failed, errno = %" WARN_PRIdPTR "\n", + WARN("Marker thread creation failed, errno= %" WARN_PRIdPTR "\n", errno); /* Don't try to create other marker threads. */ GC_markers_m1 = i; @@ -478,7 +530,7 @@ # ifndef NO_MARKER_SPECIAL_SIGMASK /* Restore previous signal mask. */ if (REAL_FUNC(pthread_sigmask)(SIG_SETMASK, &oldset, NULL) < 0) { - WARN("pthread_sigmask restore failed, errno = %" WARN_PRIdPTR "\n", + WARN("pthread_sigmask restore failed, errno= %" WARN_PRIdPTR "\n", errno); } # endif @@ -494,11 +546,19 @@ GC_INNER volatile GC_thread GC_threadsTHREAD_TABLE_SZ = {0}; +/* It may not be safe to allocate when we register the first thread. */ +/* As "next" and "status" fields are unused, no need to push this */ +/* (but "backing_store_end" field should be pushed on E2K). */ +static struct GC_Thread_Rep first_thread; + void GC_push_thread_structures(void) { GC_ASSERT(I_HOLD_LOCK()); GC_PUSH_ALL_SYM(GC_threads); -# if defined(THREAD_LOCAL_ALLOC) +# ifdef E2K + GC_PUSH_ALL_SYM(first_thread.backing_store_end); +# endif +# if defined(THREAD_LOCAL_ALLOC) && defined(USE_CUSTOM_SPECIFIC) GC_PUSH_ALL_SYM(GC_thread_key); # endif } @@ -521,10 +581,6 @@ } #endif /* DEBUG_THREADS */ -/* It may not be safe to allocate when we register the first thread. */ -/* As "next" and "status" fields are unused, no need to push this. */ -static struct GC_Thread_Rep first_thread; - /* Add a thread to GC_threads. We assume it wasn't already there. */ /* Caller holds allocation lock. */ STATIC GC_thread GC_new_thread(pthread_t id) @@ -580,7 +636,7 @@ GC_thread prev = NULL; # ifdef DEBUG_THREADS - GC_log_printf("Deleting thread %p, n_threads = %d\n", + GC_log_printf("Deleting thread %p, n_threads= %d\n", (void *)id, GC_count_threads()); # endif
View file
_service:tar_scm:gc-8.0.6.tar.gz/ptr_chck.c -> _service:tar_scm:gc-8.2.2.tar.gz/ptr_chck.c
Changed
@@ -123,6 +123,7 @@ word sz; if (!EXPECT(GC_is_initialized, TRUE)) GC_init(); + if (NULL == p) return NULL; hhdr = HDR((word)p); if (hhdr == 0) return(p); h = HBLKPTR(p);
View file
_service:tar_scm:gc-8.0.6.tar.gz/reclaim.c -> _service:tar_scm:gc-8.2.2.tar.gz/reclaim.c
Changed
@@ -3,6 +3,7 @@ * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved. * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved. * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P. + * Copyright (c) 2009-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -44,7 +45,11 @@ STATIC ptr_t GC_leakedMAX_LEAKED = { NULL }; STATIC unsigned GC_n_leaked = 0; -GC_INNER GC_bool GC_have_errors = FALSE; +#ifdef AO_HAVE_store + GC_INNER volatile AO_t GC_have_errors = 0; +#else + GC_INNER GC_bool GC_have_errors = FALSE; +#endif #if !defined(EAGER_SWEEP) && defined(ENABLE_DISCLAIM) STATIC void GC_reclaim_unconditionally_marked(void); @@ -52,12 +57,12 @@ GC_INLINE void GC_add_leaked(ptr_t leaked) { -# ifndef SHORT_DBG_HDRS - if (GC_findleak_delay_free && !GC_check_leaked(leaked)) - return; -# endif +# ifndef SHORT_DBG_HDRS + if (GC_findleak_delay_free && !GC_check_leaked(leaked)) + return; +# endif - GC_have_errors = TRUE; + GC_SET_HAVE_ERRORS(); if (GC_n_leaked < MAX_LEAKED) { GC_leakedGC_n_leaked++ = leaked; /* Make sure it's not reclaimed this cycle */ @@ -80,7 +85,7 @@ UNLOCK(); return; } - have_errors = GC_have_errors; + have_errors = get_have_errors(); printing_errors = TRUE; n_leaked = GC_n_leaked; if (n_leaked > 0) { @@ -143,6 +148,30 @@ /* TODO: This should perhaps again be specialized for USE_MARK_BYTES */ /* and USE_MARK_BITS cases. */ +GC_INLINE word *GC_clear_block(word *p, word sz, signed_word *count) +{ + word *q = (word *)((ptr_t)p + sz); + + /* Clear object, advance p to next object in the process. */ +# ifdef USE_MARK_BYTES + GC_ASSERT((sz & 1) == 0); + GC_ASSERT(((word)p & (2 * sizeof(word) - 1)) == 0); + p1 = 0; + p += 2; + while ((word)p < (word)q) { + CLEAR_DOUBLE(p); + p += 2; + } +# else + p++; /* Skip link field */ + while ((word)p < (word)q) { + *p++ = 0; + } +# endif + *count += sz; + return p; +} + /* * Restore unmarked small objects in h of size sz to the object * free list. Returns the new list. @@ -152,8 +181,7 @@ ptr_t list, signed_word *count) { word bit_no = 0; - word *p, *q, *plim; - signed_word n_bytes_found = 0; + ptr_t p, plim; GC_ASSERT(hhdr == GC_find_header((ptr_t)hbp)); # ifndef THREADS @@ -162,40 +190,23 @@ /* Skip the assertion because of a potential race with GC_realloc. */ # endif GC_ASSERT((sz & (BYTES_PER_WORD-1)) == 0); - p = (word *)(hbp->hb_body); - plim = (word *)(hbp->hb_body + HBLKSIZE - sz); + p = hbp->hb_body; + plim = p + HBLKSIZE - sz; /* go through all words in block */ while ((word)p <= (word)plim) { if (mark_bit_from_hdr(hhdr, bit_no)) { - p = (word *)((ptr_t)p + sz); + p += sz; } else { - n_bytes_found += sz; - /* object is available - put on list */ - obj_link(p) = list; - list = ((ptr_t)p); - /* Clear object, advance p to next object in the process */ - q = (word *)((ptr_t)p + sz); -# ifdef USE_MARK_BYTES - GC_ASSERT(!(sz & 1) - && !((word)p & (2 * sizeof(word) - 1))); - p1 = 0; - p += 2; - while ((word)p < (word)q) { - CLEAR_DOUBLE(p); - p += 2; - } -# else - p++; /* Skip link field */ - while ((word)p < (word)q) { - *p++ = 0; - } -# endif + /* Object is available - put it on list. */ + obj_link(p) = list; + list = p; + + p = (ptr_t)GC_clear_block((word *)p, sz, count); } bit_no += MARK_BIT_OFFSET(sz); } - *count += n_bytes_found; - return(list); + return list; } /* The same thing, but don't clear objects: */ @@ -234,52 +245,29 @@ ptr_t list, signed_word *count) { word bit_no = 0; - word *p, *q, *plim; - signed_word n_bytes_found = 0; + ptr_t p, plim; struct obj_kind *ok = &GC_obj_kindshhdr->hb_obj_kind; int (GC_CALLBACK *disclaim)(void *) = ok->ok_disclaim_proc; # ifndef THREADS GC_ASSERT(sz == hhdr -> hb_sz); # endif - p = (word *)(hbp -> hb_body); - plim = (word *)((ptr_t)p + HBLKSIZE - sz); + p = hbp->hb_body; + plim = p + HBLKSIZE - sz; - while ((word)p <= (word)plim) { - int marked = mark_bit_from_hdr(hhdr, bit_no); - if (!marked && (*disclaim)(p)) { + for (; (word)p <= (word)plim; bit_no += MARK_BIT_OFFSET(sz)) { + if (mark_bit_from_hdr(hhdr, bit_no)) { + p += sz; + } else if ((*disclaim)(p)) { set_mark_bit_from_hdr(hhdr, bit_no); hhdr -> hb_n_marks++; - marked = 1; - } - if (marked) - p = (word *)((ptr_t)p + sz); - else { - n_bytes_found += sz; - /* object is available - put on list */ - obj_link(p) = list; - list = ((ptr_t)p); - /* Clear object, advance p to next object in the process */ - q = (word *)((ptr_t)p + sz); -# ifdef USE_MARK_BYTES - GC_ASSERT((sz & 1) == 0); - GC_ASSERT(((word)p & (2 * sizeof(word) - 1)) == 0); - p1 = 0; - p += 2; - while ((word)p < (word)q) { - CLEAR_DOUBLE(p); - p += 2; - } -# else - p++; /* Skip link field */ - while ((word)p < (word)q) { - *p++ = 0; - } -# endif + p += sz; + } else { + obj_link(p) = list; + list = p; + p = (ptr_t)GC_clear_block((word *)p, sz, count); } - bit_no += MARK_BIT_OFFSET(sz); }
View file
_service:tar_scm:gc-8.0.6.tar.gz/specific.c -> _service:tar_scm:gc-8.2.2.tar.gz/specific.c
Changed
@@ -51,7 +51,7 @@ GC_INNER int GC_setspecific(tsd * key, void * value) { pthread_t self = pthread_self(); - int hash_val = HASH(self); + unsigned hash_val = HASH(self); volatile tse * entry; GC_ASSERT(I_HOLD_LOCK()); @@ -138,8 +138,7 @@ tse * volatile * cache_ptr) { pthread_t self = pthread_self(); - unsigned hash_val = HASH(self); - tse *entry = key->hashhash_val.p; + tse *entry = key->hashHASH(self).p; GC_ASSERT(qtid != INVALID_QTID); while (entry != NULL && !THREAD_EQUAL(entry->thread, self)) {
View file
_service:tar_scm:gc-8.0.6.tar.gz/test-driver -> _service:tar_scm:gc-8.2.2.tar.gz/test-driver
Changed
@@ -1,9 +1,9 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2013-07-13.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -42,11 +42,13 @@ { cat <<END Usage: - test-driver --test-name=NAME --log-file=PATH --trs-file=PATH - --expect-failure={yes|no} --color-tests={yes|no} - --enable-hard-errors={yes|no} -- + test-driver --test-name NAME --log-file PATH --trs-file PATH + --expect-failure {yes|no} --color-tests {yes|no} + --enable-hard-errors {yes|no} -- TEST-SCRIPT TEST-SCRIPT-ARGUMENTS + The '--test-name', '--log-file' and '--trs-file' options are mandatory. +See the GNU Automake documentation for information. END } @@ -103,8 +105,11 @@ trap "st=141; $do_exit" 13 trap "st=143; $do_exit" 15 -# Test script is run here. -"$@" >$log_file 2>&1 +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then @@ -126,7 +131,7 @@ # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). -echo "$res $test_name (exit status: $estatus)" >>$log_file +echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" @@ -140,9 +145,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End:
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/disclaim_bench.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/disclaim_bench.c
Changed
@@ -22,8 +22,7 @@ #include "gc_disclaim.h" -/* Include gc_priv.h is done after including GC public headers, so */ -/* that GC_BUILD has no effect on the public prototypes. */ +#define NOT_GCBUILD #include "private/gc_priv.h" /* for CLOCK_TYPE, COVERT_DATAFLOW, GC_random */ #ifdef LINT2 @@ -62,12 +61,14 @@ { testobj_t obj; switch (model) { +# ifndef GC_NO_FINALIZATION case 0: obj = GC_NEW(struct testobj_s); if (obj != NULL) GC_REGISTER_FINALIZER_NO_ORDER(obj, testobj_finalize, &free_count, NULL, NULL); break; +# endif case 1: obj = (testobj_t)GC_finalized_malloc(sizeof(struct testobj_s), &fclos); @@ -116,9 +117,12 @@ model_min = model_max = (int)COVERT_DATAFLOW(atoi(argv1)); if (model_min < 0 || model_max > 2) exit(2); - } - else { + } else { +# ifndef GC_NO_FINALIZATION model_min = 0; +# else + model_min = 1; +# endif model_max = 2; } if (GC_get_find_leak())
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/disclaim_test.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/disclaim_test.c
Changed
@@ -28,21 +28,26 @@ #undef GC_NO_THREAD_REDIRECTS #include "gc_disclaim.h" -#ifdef LINT2 - /* Avoid include gc_priv.h. */ -# ifndef GC_API_PRIV -# define GC_API_PRIV GC_API -# endif -# ifdef __cplusplus - extern "C" { -# endif - GC_API_PRIV long GC_random(void); -# ifdef __cplusplus - } /* extern "C" */ -# endif +#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; + } + + /* 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. */ + /* The standard specifies rand() as not a thread-safe API function. */ # undef rand -# define rand() (int)GC_random() -#endif /* LINT2 */ +# define rand() GC_rand() +#endif /* GC_PTHREADS || LINT2 */ #define my_assert(e) \ if (!(e)) { \ @@ -114,7 +119,7 @@ my_assert(cd == (void *)PTR_HASH(p)); /* Check that obj and its car and cdr are not trashed. */ # ifdef DEBUG_DISCLAIM_DESTRUCT - printf("Destruct %p = (%p, %p)\n", + printf("Destruct %p: (car= %p, cdr= %p)\n", (void *)p, (void *)p->car, (void *)p->cdr); # endif my_assert(GC_base(obj)); @@ -159,7 +164,7 @@ GC_ptr_store_and_dirty(&p->cdr, cdr); GC_reachable_here(car); # ifdef DEBUG_DISCLAIM_DESTRUCT - printf("Construct %p = (%p, %p)\n", + printf("Construct %p: (car= %p, cdr= %p)\n", (void *)p, (void *)p->car, (void *)p->cdr); # endif return p; @@ -184,6 +189,7 @@ # ifndef NTHREADS # define NTHREADS 6 # endif +# include <errno.h> /* for EAGAIN */ # include <pthread.h> #else # undef NTHREADS @@ -229,7 +235,7 @@ { # if NTHREADS > 1 pthread_t thNTHREADS; - int i; + int i, n; # endif GC_set_all_interior_pointers(0); /* for a stricter test */ @@ -251,15 +257,17 @@ for (i = 0; i < NTHREADS; ++i) { int err = pthread_create(&thi, NULL, test, NULL); if (err) { - fprintf(stderr, "Failed to create thread # %d: %s\n", i, + fprintf(stderr, "Failed to create thread #%d: %s\n", i, strerror(err)); + if (i > 1 && EAGAIN == err) break; exit(1); } } - for (i = 0; i < NTHREADS; ++i) { + n = i; + for (i = 0; i < n; ++i) { int err = pthread_join(thi, NULL); if (err) { - fprintf(stderr, "Failed to join thread # %d: %s\n", i, + fprintf(stderr, "Failed to join thread #%d: %s\n", i, strerror(err)); exit(69); }
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/disclaim_weakmap_test.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/disclaim_weakmap_test.c
Changed
@@ -24,13 +24,31 @@ #endif #include "gc_disclaim.h" /* includes gc.h */ -#include "gc_mark.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 */ + +#include "gc_mark.h" /* should not precede include gc_priv.h */ #ifdef GC_PTHREADS # ifndef NTHREADS # define NTHREADS 8 # endif -# include <errno.h> +# include <errno.h> /* for EAGAIN, EBUSY */ # include <pthread.h> # include "private/gc_atomic_ops.h" /* for AO_t and AO_fetch_and_add1 */ #else @@ -39,22 +57,6 @@ # define AO_t GC_word #endif -#ifdef LINT2 - /* Avoid include gc_priv.h. */ -# ifndef GC_API_PRIV -# define GC_API_PRIV GC_API -# endif -# ifdef __cplusplus - extern "C" { -# endif - GC_API_PRIV long GC_random(void); -# ifdef __cplusplus - } /* extern "C" */ -# endif -# undef rand -# define rand() (int)GC_random() -#endif /* LINT2 */ - #define POP_SIZE 200 #define MUTATE_CNT (5000000 / NTHREADS) #define GROW_LIMIT (MUTATE_CNT / 10) @@ -166,7 +168,7 @@ return NULL; } -void *weakmap_add(struct weakmap *wm, void *obj) +void *weakmap_add(struct weakmap *wm, void *obj, size_t obj_size) { struct weakmap_link *link, *new_link, **first; GC_word *new_base; @@ -175,6 +177,7 @@ size_t key_size = wm->key_size; /* Lock and look for an existing entry. */ + my_assert(key_size <= obj_size); h = memhash(obj, key_size); first = &wm->linksh % wm->capacity; weakmap_lock(wm, h); @@ -197,7 +200,7 @@ weakmap_unlock(wm, h); AO_fetch_and_add1(&stat_found); # ifdef DEBUG_DISCLAIM_WEAKMAP - printf("Found %p, hash=%p\n", old_obj, (void *)(GC_word)h); + printf("Found %p, hash= %p\n", old_obj, (void *)(GC_word)h); # endif return old_obj; } @@ -223,7 +226,7 @@ weakmap_unlock(wm, h); AO_fetch_and_add1(&stat_added); # ifdef DEBUG_DISCLAIM_WEAKMAP - printf("Added %p, hash=%p\n", new_obj, (void *)(GC_word)h); + printf("Added %p, hash= %p\n", new_obj, (void *)(GC_word)h); # endif return new_obj; } @@ -252,7 +255,7 @@ if (weakmap_trylock(wm, h) != 0) { AO_fetch_and_add1(&stat_skip_locked); # ifdef DEBUG_DISCLAIM_WEAKMAP - printf("Skipping locked %p, hash=%p\n", obj, (void *)(GC_word)h); + printf("Skipping locked %p, hash= %p\n", obj, (void *)(GC_word)h); # endif return 1; } @@ -260,7 +263,7 @@ weakmap_unlock(wm, h); AO_fetch_and_add1(&stat_skip_marked); # ifdef DEBUG_DISCLAIM_WEAKMAP - printf("Skipping marked %p, hash=%p\n", obj, (void *)(GC_word)h); + printf("Skipping marked %p, hash= %p\n", obj, (void *)(GC_word)h); # endif return 1; } @@ -268,7 +271,7 @@ /* Remove obj from wm. */ AO_fetch_and_add1(&stat_removed); # ifdef DEBUG_DISCLAIM_WEAKMAP - printf("Removing %p, hash=%p\n", obj, (void *)(GC_word)h); + printf("Removing %p, hash= %p\n", obj, (void *)(GC_word)h); # endif *(GC_word *)obj_base |= INVALIDATE_FLAG; for (link = &wm->linksh % wm->capacity;; link = &(*link)->next) { @@ -353,7 +356,7 @@ tmpl.cdr = cdr; memcpy(tmpl.magic, pair_magic, PAIR_MAGIC_SIZE); tmpl.checksum = 782 + (car? car->checksum : 0) + (cdr? cdr->checksum : 0); - return (struct pair *)weakmap_add(pair_hcset, &tmpl); + return (struct pair *)weakmap_add(pair_hcset, &tmpl, sizeof(tmpl)); } void pair_check_rec(struct pair *p, int line) @@ -370,7 +373,7 @@ if (p->cdr != NULL) checksum += p->cdr->checksum; if (p->checksum != checksum) { - fprintf(stderr, "Checksum failure for %p = (%p, %p) at %d\n", + fprintf(stderr, "Checksum failure for %p: (car= %p, cdr= %p) at %d\n", (void *)p, (void *)p->car, (void *)p->cdr, line); exit(70); } @@ -417,9 +420,8 @@ int main(void) { unsigned weakobj_kind; - void **weakobj_free_list; # ifdef GC_PTHREADS - int i; + int i, n; pthread_t thNTHREADS; # endif @@ -434,10 +436,7 @@ # endif if (GC_get_find_leak()) printf("This test program is not designed for leak detection mode\n"); - - weakobj_free_list = GC_new_free_list(); - CHECK_OOM(weakobj_free_list); - weakobj_kind = GC_new_kind(weakobj_free_list, /* 0 | */ GC_DS_LENGTH, + weakobj_kind = GC_new_kind(GC_new_free_list(), /* 0 | */ GC_DS_LENGTH, 1 /* adjust */, 1 /* clear */); GC_register_disclaim_proc(weakobj_kind, weakmap_disclaim, 1 /* mark_unconditionally */); @@ -450,10 +449,12 @@ if (err != 0) { fprintf(stderr, "Failed to create thread #%d: %s\n", i, strerror(err)); + if (i > 1 && EAGAIN == err) break; exit(1); } } - for (i = 0; i < NTHREADS; ++i) { + n = i; + for (i = 0; i < n; ++i) { int err = pthread_join(thi, NULL); if (err != 0) { fprintf(stderr, "Failed to join thread #%d: %s\n", i, strerror(err));
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/huge_test.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/huge_test.c
Changed
@@ -48,10 +48,12 @@ int main(void) { - GC_INIT(); + GC_INIT(); - CHECK_ALLOC_FAILED(GC_MALLOC(GC_SWORD_MAX - 1024), "SWORD_MAX-1024"); - CHECK_ALLOC_FAILED(GC_MALLOC(GC_SWORD_MAX), "SWORD_MAX"); + CHECK_ALLOC_FAILED(GC_MALLOC(GC_SWORD_MAX - 1024), "SWORD_MAX-1024"); + CHECK_ALLOC_FAILED(GC_MALLOC(GC_SWORD_MAX), "SWORD_MAX"); + /* Skip other checks to avoid "exceeds maximum object size" gcc warning. */ +# if !defined(_FORTIFY_SOURCE) CHECK_ALLOC_FAILED(GC_MALLOC((GC_word)GC_SWORD_MAX + 1), "SWORD_MAX+1"); CHECK_ALLOC_FAILED(GC_MALLOC((GC_word)GC_SWORD_MAX + 1024), "SWORD_MAX+1024"); @@ -60,5 +62,6 @@ CHECK_ALLOC_FAILED(GC_MALLOC(GC_WORD_MAX - 8), "WORD_MAX-8"); CHECK_ALLOC_FAILED(GC_MALLOC(GC_WORD_MAX - 4), "WORD_MAX-4"); CHECK_ALLOC_FAILED(GC_MALLOC(GC_WORD_MAX), "WORD_MAX"); - return 0; +# endif + return 0; }
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/initsecondarythread.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/initsecondarythread.c
Changed
@@ -89,21 +89,23 @@ printf("This test program is not designed for leak detection mode\n"); # ifdef GC_PTHREADS if ((code = pthread_create (&t, NULL, thread, NULL)) != 0) { - fprintf(stderr, "Thread creation failed %d\n", code); + fprintf(stderr, "Thread creation failed, errno= %d\n", code); return 1; } if ((code = pthread_join (t, NULL)) != 0) { - fprintf(stderr, "Thread join failed %d\n", code); + fprintf(stderr, "Thread join failed, errno= %d\n", code); return 1; } # else t = CreateThread(NULL, 0, thread, 0, 0, &thread_id); if (t == NULL) { - fprintf(stderr, "Thread creation failed %d\n", (int)GetLastError()); + fprintf(stderr, "Thread creation failed, errcode= %d\n", + (int)GetLastError()); return 1; } if (WaitForSingleObject(t, INFINITE) != WAIT_OBJECT_0) { - fprintf(stderr, "Thread join failed %d\n", (int)GetLastError()); + fprintf(stderr, "Thread join failed, errcode= %d\n", + (int)GetLastError()); CloseHandle(t); return 1; }
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/leak_test.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/leak_test.c
Changed
@@ -1,7 +1,7 @@ #include "leak_detector.h" int main(void) { - int *p10; + char *p10; int i; GC_set_find_leak(1); /* for new collect versions not compiled */ /* with -DFIND_LEAK. */ @@ -9,14 +9,14 @@ GC_INIT(); /* Needed if thread-local allocation is enabled. */ /* FIXME: This is not ideal. */ for (i = 0; i < 10; ++i) { - pi = (int*)malloc(sizeof(int)+i); + pi = (char*)malloc(sizeof(int)+i); } CHECK_LEAKS(); for (i = 1; i < 10; ++i) { free(pi); } for (i = 0; i < 9; ++i) { - pi = (int*)malloc(sizeof(int)+i); + pi = (char*)malloc(sizeof(int)+i); } CHECK_LEAKS(); CHECK_LEAKS();
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/middle.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/middle.c
Changed
@@ -18,6 +18,10 @@ (void)GC_malloc_atomic(4096); (void)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);
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/subthread_create.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/subthread_create.c
Changed
@@ -18,6 +18,7 @@ #ifdef AO_HAVE_fetch_and_add1 #ifdef GC_PTHREADS +# include <errno.h> /* for EAGAIN */ # include <pthread.h> #else # ifndef WIN32_LEAN_AND_MEAN @@ -35,9 +36,11 @@ #include <string.h> #ifndef NTHREADS -# define NTHREADS 31 /* number of initial threads */ +# define NTHREADS 5 #endif +#define NTHREADS_INNER (NTHREADS * 6) /* number of threads to create */ + #ifndef MAX_SUBTHREAD_DEPTH # define MAX_ALIVE_THREAD_COUNT 55 # define MAX_SUBTHREAD_DEPTH 7 @@ -72,15 +75,17 @@ err = pthread_create(&th, NULL, entry, (void *)my_depth); if (err != 0) { - fprintf(stderr, "Thread #%d creation failed: %s\n", thread_num, - strerror(err)); + fprintf(stderr, "Thread #%d creation failed, error: %s\n", + thread_num, strerror(err)); + if (err != EAGAIN) exit(2); - } - err = pthread_detach(th); - if (err != 0) { - fprintf(stderr, "Thread #%d detach failed: %s\n", thread_num, - strerror(err)); + } else { + err = pthread_detach(th); + if (err != 0) { + fprintf(stderr, "Thread #%d detach failed, error: %s\n", + thread_num, strerror(err)); exit(2); + } } # else HANDLE th; @@ -88,8 +93,8 @@ th = CreateThread(NULL, 0, entry, (LPVOID)my_depth, 0, &thread_id); if (th == NULL) { - fprintf(stderr, "Thread #%d creation failed: %d\n", thread_num, - (int)GetLastError()); + fprintf(stderr, "Thread #%d creation failed, errcode= %d\n", + thread_num, (int)GetLastError()); exit(2); } CloseHandle(th); @@ -103,39 +108,42 @@ int main(void) { #if NTHREADS > 0 - int i; + int i, n; # ifdef GC_PTHREADS int err; - pthread_t thNTHREADS; + pthread_t thNTHREADS_INNER; # else - HANDLE thNTHREADS; + HANDLE thNTHREADS_INNER; # endif GC_INIT(); - for (i = 0; i < NTHREADS; ++i) { + for (i = 0; i < NTHREADS_INNER; ++i) { # ifdef GC_PTHREADS err = pthread_create(&thi, NULL, entry, 0); if (err) { - fprintf(stderr, "Thread creation failed: %s\n", strerror(err)); + fprintf(stderr, "Thread creation failed, error: %s\n", + strerror(err)); + if (i > 0 && EAGAIN == err) break; exit(1); } # else DWORD thread_id; thi = CreateThread(NULL, 0, entry, 0, 0, &thread_id); if (thi == NULL) { - fprintf(stderr, "Thread creation failed: %d\n", + fprintf(stderr, "Thread creation failed, errcode= %d\n", (int)GetLastError()); exit(1); } # endif } - - for (i = 0; i < NTHREADS; ++i) { + n = i; + for (i = 0; i < n; ++i) { # ifdef GC_PTHREADS void *res; err = pthread_join(thi, &res); if (err) { - fprintf(stderr, "Failed to join thread: %s\n", strerror(err)); + fprintf(stderr, "Failed to join thread, error: %s\n", + strerror(err)); # if defined(__HAIKU__) /* The error is just ignored (and the test is ended) to */ /* workaround some bug in Haiku pthread_join. */ @@ -146,7 +154,7 @@ } # else if (WaitForSingleObject(thi, INFINITE) != WAIT_OBJECT_0) { - fprintf(stderr, "Failed to join thread: %d\n", + fprintf(stderr, "Failed to join thread, errcode= %d\n", (int)GetLastError()); CloseHandle(thi); exit(1);
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/test.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/test.c
Changed
@@ -2,6 +2,7 @@ * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved. * Copyright (c) 1996 by Silicon Graphics. All rights reserved. + * Copyright (c) 2009-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -36,11 +37,14 @@ #if defined(CPPCHECK) && defined(GC_PTHREADS) && !defined(_GNU_SOURCE) # define _GNU_SOURCE 1 #endif -#undef GC_NO_THREAD_REDIRECTS +#ifdef GC_NO_THREADS_DISCOVERY +# undef GC_NO_THREAD_REDIRECTS +#endif #include "gc.h" #ifndef NTHREADS /* Number of additional threads to fork. */ -# define NTHREADS 5 /* excludes main thread, which also runs a test. */ +# define NTHREADS 5 /* Excludes main thread, which also runs a test. */ + /* In the single-threaded case, the number of times to rerun it. */ /* Not respected by PCR test. */ #endif @@ -57,22 +61,19 @@ # include <assert.h> /* Not normally used, but handy for debugging. */ # endif +#if defined(GC_NO_FINALIZATION) && !defined(NO_TYPED_TEST) +# define NO_TYPED_TEST +#endif + #ifndef NO_TYPED_TEST # include "gc_typed.h" #endif +#define NOT_GCBUILD #include "private/gc_priv.h" /* For output, locking, */ /* some statistics and gcconfig.h. */ -#if defined(MSWIN32) || defined(MSWINCE) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE -# include <windows.h> -#endif /* MSWIN32 || MSWINCE */ - -#ifdef GC_PRINT_VERBOSE_STATS +#if defined(GC_PRINT_VERBOSE_STATS) || defined(GCTEST_PRINT_VERBOSE) # define print_stats VERBOSE # define INIT_PRINT_STATS /* empty */ #else @@ -100,15 +101,13 @@ # if defined(GC_PTHREADS) && !defined(GC_WIN32_PTHREADS) # include <pthread.h> -# else -# define NO_TEST_HANDLE_FORK # endif -# if (!defined(THREADS) || !defined(HANDLE_FORK) \ - || (defined(DARWIN) && defined(MPROTECT_VDB) \ - && !defined(NO_INCREMENTAL) && !defined(MAKE_BACK_GRAPH))) \ - && !defined(NO_TEST_HANDLE_FORK) && !defined(TEST_HANDLE_FORK) \ - && !defined(TEST_FORK_WITHOUT_ATFORK) +# if ((defined(DARWIN) && defined(MPROTECT_VDB) \ + && !defined(MAKE_BACK_GRAPH) && !defined(TEST_HANDLE_FORK)) \ + || (defined(THREADS) && !defined(CAN_HANDLE_FORK)) \ + || defined(HAVE_NO_FORK) || defined(USE_WINALLOC)) \ + && !defined(NO_TEST_HANDLE_FORK) # define NO_TEST_HANDLE_FORK # endif @@ -663,18 +662,18 @@ { DWORD thread_id; HANDLE h; - h = GC_CreateThread((SECURITY_ATTRIBUTES *)NULL, (word)0, - tiny_reverse_test, NULL, (DWORD)0, &thread_id); + h = CreateThread((SECURITY_ATTRIBUTES *)NULL, (word)0, + tiny_reverse_test, NULL, (DWORD)0, &thread_id); /* Explicitly specify types of the */ /* arguments to test the prototype. */ if (h == (HANDLE)NULL) { - GC_printf("Small thread creation failed %d\n", - (int)GetLastError()); + GC_printf("Small thread creation failed, errcode= %d\n", + (int)GetLastError()); FAIL; } if (WaitForSingleObject(h, INFINITE) != WAIT_OBJECT_0) { - GC_printf("Small thread wait failed %d\n", - (int)GetLastError()); + GC_printf("Small thread wait failed, errcode= %d\n", + (int)GetLastError()); FAIL; } } @@ -728,17 +727,23 @@ return GC_call_with_gc_active(reverse_test_inner, (void*)(word)1); } +# ifndef BIG # if defined(MACOS) \ || (defined(UNIX_LIKE) && defined(NO_GETCONTEXT)) /* e.g. musl */ - /* Assume 128K stacks at least. */ -# define BIG 1000 + /* Assume 128 KB stacks at least. */ +# if defined(__s390x__) +# define BIG 600 +# else +# define BIG 1000 +# endif # elif defined(PCR) - /* PCR default stack is 100K. Stack frames are up to 120 bytes. */ + /* PCR default stack is 100 KB. Stack frames are up to 120 bytes. */ # define BIG 700 # elif defined(MSWINCE) || defined(RTEMS) - /* WinCE only allows 64K stacks */ + /* WinCE only allows 64 KB stacks. */ # define BIG 500 -# elif defined(OSF1) +# elif defined(EMSCRIPTEN) || defined(OSF1) + /* Wasm reports "Maximum call stack size exceeded" error otherwise. */ /* OSF has limited stack space by default, and large frames. */ # define BIG 200 # elif defined(__MACH__) && defined(__ppc64__) @@ -746,6 +751,7 @@ # else # define BIG 4500 # endif +# endif a_set(ints(1, 49)); b = ints(1, 50); @@ -792,14 +798,20 @@ GC_FREE((void *)e); check_ints(b,1,50); +# ifndef EMSCRIPTEN check_ints(a_get(),1,49); +# else + /* FIXME: gctest fails unless check_ints(a_get(), ...) are skipped. */ +# endif for (i = 0; i < 50; i++) { check_ints(b,1,50); b = reverse(reverse(b)); } check_ints(b,1,50); +# ifndef EMSCRIPTEN check_ints(a_get(),1,49); - for (i = 0; i < 60; i++) { +# endif + for (i = 0; i < 10 * (NTHREADS+1); i++) { # if (defined(GC_PTHREADS) || defined(GC_WIN32_THREADS)) \ && (NTHREADS > 0) if (i % 10 == 0) fork_a_thread(); @@ -816,7 +828,9 @@ AO_fetch_and_add1(&realloc_count); # endif } +# ifndef EMSCRIPTEN check_ints(a_get(),1,49); +# endif check_ints(b,1,50); /* Restore c and d values. */ @@ -855,7 +869,10 @@ struct treenode * rchild; } tn; -int finalizable_count = 0; +#ifndef GC_NO_FINALIZATION + int finalizable_count = 0; +#endif + int finalized_count = 0; int dropped_something = 0; @@ -921,14 +938,16 @@ if (AO_fetch_and_add1(&extra_count) % 119 == 0) { # ifndef GC_NO_FINALIZATION int my_index; - void *new_link; -# endif + void **new_link = GC_NEW(void *); + CHECK_OUT_OF_MEMORY(new_link); + AO_fetch_and_add1(&collectable_count); +# endif { FINALIZER_LOCK(); /* Losing a count here causes erroneous report of failure. */ - finalizable_count++; # ifndef GC_NO_FINALIZATION + finalizable_count++; my_index = live_indicators_count++; # endif
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/test_cpp.cc -> _service:tar_scm:gc-8.2.2.tar.gz/tests/test_cpp.cc
Changed
@@ -1,16 +1,17 @@ -/**************************************************************************** -Copyright (c) 1994 by Xerox Corporation. All rights reserved. - -THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED -OR IMPLIED. ANY USE IS AT YOUR OWN RISK. - -Permission is hereby granted to use or copy this program for any -purpose, provided the above notices are retained on all copies. -Permission to modify the code and to distribute modified code is -granted, provided the above notices are retained, and a notice that -the code was modified is included with the above copyright notice. -**************************************************************************** +/* + * Copyright (c) 1994 by Xerox Corporation. All rights reserved. + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ +/**************************************************************************** usage: test_cpp number-of-iterations This program tries to test the specific C++ functionality provided by @@ -35,12 +36,7 @@ #include <stdlib.h> #include <string.h> -#ifndef DONT_USE_STD_ALLOCATOR -# include "gc_allocator.h" -#else - /* Note: This works only for ancient STL versions. */ -# include "new_gc_alloc.h" -#endif +#include "gc_allocator.h" # include "private/gcconfig.h" @@ -75,23 +71,21 @@ __LINE__ ); \ exit( 1 ); } -#ifndef GC_ATTR_EXPLICIT -# if __cplusplus >= 201103L && !defined(__clang__) || _MSVC_LANG >= 201103L \ - || defined(CPPCHECK) -# define GC_ATTR_EXPLICIT explicit -# else -# define GC_ATTR_EXPLICIT /* empty */ -# endif +#if defined(__powerpc64__) && !defined(__clang__) && GC_GNUC_PREREQ(10, 0) + /* Suppress "layout of aggregates ... has changed" GCC note. */ +# define A_I_TYPE short +#else +# define A_I_TYPE int #endif class A {public: /* An uncollectible class. */ - GC_ATTR_EXPLICIT A( int iArg ): i( iArg ) {} + GC_ATTR_EXPLICIT A( int iArg ): i((A_I_TYPE)iArg) {} void Test( int iArg ) { my_assert( i == iArg );} virtual ~A() {} - int i;}; + A_I_TYPE i; }; class B: public GC_NS_QUALIFY(gc), public A { public: @@ -165,7 +159,9 @@ GC_gcollect(); } my_assert(nFreed <= nAllocated); - my_assert(nFreed >= (nAllocated / 5) * 4 || GC_get_find_leak()); +# ifndef GC_NO_FINALIZATION + my_assert(nFreed >= (nAllocated / 5) * 4 || GC_get_find_leak()); +# endif } static int nFreed; @@ -189,7 +185,9 @@ nFreed++; my_assert( (GC_word)self->i == (GC_word)data );} static void Test() { - my_assert(nFreed >= (nAllocated / 5) * 4 || GC_get_find_leak()); +# ifndef GC_NO_FINALIZATION + my_assert(nFreed >= (nAllocated / 5) * 4 || GC_get_find_leak()); +# endif } int i; @@ -228,7 +226,9 @@ } static void Test() { - my_assert(nFreedF >= (nAllocatedF / 5) * 4 || GC_get_find_leak()); +# ifndef GC_NO_FINALIZATION + my_assert(nFreedF >= (nAllocatedF / 5) * 4 || GC_get_find_leak()); +# endif my_assert(2 * nFreedF == nFreed); } @@ -318,24 +318,18 @@ GC_printf("This test program is not designed for leak detection mode\n"); int i, iters, n; -# ifndef DONT_USE_STD_ALLOCATOR - int *x = gc_allocator<int>().allocate(1); - int *xio; - xio = gc_allocator_ignore_off_page<int>().allocate(1); - (void)xio; - int **xptr = traceable_allocator<int *>().allocate(1); -# else - int *x = (int *)gc_alloc::allocate(sizeof(int)); -# endif + int *x = gc_allocator<int>().allocate(1); + int *xio; + xio = gc_allocator_ignore_off_page<int>().allocate(1); + GC_reachable_here(xio); + int **xptr = traceable_allocator<int *>().allocate(1); *x = 29; -# ifndef DONT_USE_STD_ALLOCATOR - if (!xptr) { - fprintf(stderr, "Out of memory!\n"); - exit(3); - } - GC_PTR_STORE_AND_DIRTY(xptr, x); - x = 0; -# endif + if (!xptr) { + fprintf(stderr, "Out of memory!\n"); + exit(3); + } + GC_PTR_STORE_AND_DIRTY(xptr, x); + x = 0; if (argc != 2 || (n = (int)COVERT_DATAFLOW(atoi(argv1))) <= 0) { GC_printf("usage: test_cpp number-of-iterations\n" @@ -363,7 +357,7 @@ D* d; F* f; d = ::new (USE_GC, D::CleanUp, (void*)(GC_word)i) D( i ); - (void)d; + GC_reachable_here(d); f = new F; F** fa = new F*1; fa0 = f; @@ -379,7 +373,7 @@ for (i = 0; i < 1000000; i++) { A* a; a = new (USE_GC) A( i ); - (void)a; + GC_reachable_here(a); B* b; b = new B( i ); (void)b; @@ -388,7 +382,7 @@ B::Deleting( 1 ); GC_CHECKED_DELETE(b); B::Deleting( 0 );} -# ifdef FINALIZE_ON_DEMAND +# if defined(FINALIZE_ON_DEMAND) && !defined(GC_NO_FINALIZATION) GC_invoke_finalizers(); # endif } @@ -410,7 +404,7 @@ B::Deleting( 1 ); GC_CHECKED_DELETE(b); B::Deleting( 0 ); -# ifdef FINALIZE_ON_DEMAND +# if defined(FINALIZE_ON_DEMAND) && !defined(GC_NO_FINALIZATION) GC_invoke_finalizers(); # endif } @@ -421,9 +415,7 @@ D::Test(); F::Test();} -# ifndef DONT_USE_STD_ALLOCATOR - x = *xptr; -# endif + x = *xptr; my_assert (29 == x0); GC_printf( "The test appears to have succeeded.\n" ); return( 0 );
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/tests.am -> _service:tar_scm:gc-8.2.2.tar.gz/tests/tests.am
Changed
@@ -21,6 +21,17 @@ endif gctest_DEPENDENCIES = $(top_builddir)/libgc.la +if EMSCRIPTEN +# Note: because of libtool, you'll need to point your browser to +# .libs/gctest.html, not gctest.html at topdir. +check_PROGRAMS += gctest.html +gctest_html_SOURCES = $(gctest_SOURCES) +gctest_html_LDADD = $(gctest_LDADD) +# Bug in the linker not being able to determine that _memalign and +# _memalign is needed? it's part of mmap. +gctest_html_LDFLAGS = -s "EXPORTED_FUNCTIONS='_memalign', '_main', '_memset'" +endif + TESTS += leaktest$(EXEEXT) check_PROGRAMS += leaktest leaktest_SOURCES = tests/leak_test.c @@ -107,7 +118,7 @@ check_PROGRAMS += test_cpp test_cpp_SOURCES = tests/test_cpp.cc if AVOID_CPP_LIB -test_cpp_LDADD = gc_cpp.o $(test_ldadd) $(CXXLIBS) +test_cpp_LDADD = gc_badalc.o gc_cpp.o $(test_ldadd) $(CXXLIBS) else test_cpp_LDADD = libgccpp.la $(nodist_libgc_la_OBJECTS) \ $(EXTRA_TEST_LIBS) $(CXXLIBS)
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/thread_leak_test.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/thread_leak_test.c
Changed
@@ -11,6 +11,7 @@ #include "leak_detector.h" #ifdef GC_PTHREADS +# include <errno.h> /* for EAGAIN */ # include <pthread.h> #else # ifndef WIN32_LEAN_AND_MEAN @@ -50,7 +51,7 @@ int main(void) { # if NTHREADS > 0 - int i; + int i, n; # ifdef GC_PTHREADS pthread_t tNTHREADS; # else @@ -73,12 +74,15 @@ code = ti != NULL ? 0 : (int)GetLastError(); # endif if (code != 0) { - fprintf(stderr, "Thread creation failed %d\n", code); + fprintf(stderr, "Thread creation failed, errcode= %d\n", code); +# ifdef GC_PTHREADS + if (i > 1 && EAGAIN == code) break; +# endif exit(2); } } - - for (i = 0; i < NTHREADS; ++i) { + n = i; + for (i = 0; i < n; ++i) { # ifdef GC_PTHREADS code = pthread_join(ti, 0); # else @@ -86,7 +90,7 @@ (int)GetLastError(); # endif if (code != 0) { - fprintf(stderr, "Thread join failed %d\n", code); + fprintf(stderr, "Thread join failed, errcode= %d\n", code); exit(2); } }
View file
_service:tar_scm:gc-8.0.6.tar.gz/tests/threadkey_test.c -> _service:tar_scm:gc-8.2.2.tar.gz/tests/threadkey_test.c
Changed
@@ -24,7 +24,7 @@ #ifdef SKIP_THREADKEY_TEST -int main (void) +int main(void) { printf("threadkey_test skipped\n"); return 0; @@ -81,10 +81,12 @@ } #ifndef NTHREADS -# define NTHREADS 30 /* number of initial threads */ +# define NTHREADS 5 #endif -int main (void) +#define NTHREADS_INNER (NTHREADS * 6) /* number of threads to create */ + +int main(void) { int i; @@ -96,7 +98,7 @@ # else pthread_once (&key_once, make_key); # endif - for (i = 0; i < NTHREADS; i++) { + for (i = 0; i < NTHREADS_INNER; i++) { pthread_t t; if (GC_pthread_create(&t, NULL, entry, NULL) == 0) { @@ -105,7 +107,7 @@ : GC_pthread_detach(t); if (code != 0) { - fprintf(stderr, "Thread %s failed %d\n", + fprintf(stderr, "Thread %s failed, errno= %d\n", (i & 1) != 0 ? "join" : "detach", code); exit(2); }
View file
_service:tar_scm:gc-8.0.6.tar.gz/thread_local_alloc.c -> _service:tar_scm:gc-8.2.2.tar.gz/thread_local_alloc.c
Changed
@@ -97,7 +97,10 @@ GC_ASSERT(I_HOLD_LOCK()); if (!EXPECT(keys_initialized, TRUE)) { - GC_ASSERT((word)&GC_thread_key % sizeof(word) == 0); +# ifdef USE_CUSTOM_SPECIFIC + /* Ensure proper alignment of a "pushed" GC symbol. */ + GC_ASSERT((word)&GC_thread_key % sizeof(word) == 0); +# endif res = GC_key_create(&GC_thread_key, reset_thread_key); if (COVERT_DATAFLOW(res) != 0) { ABORT("Failed to create key for local allocator"); @@ -176,10 +179,15 @@ GC_ASSERT(GC_is_initialized); GC_ASSERT(GC_is_thread_tsd_valid(tsd)); granules = ROUNDED_UP_GRANULES(bytes); +# if defined(CPPCHECK) +# define MALLOC_KIND_PTRFREE_INIT (void*)1 +# else +# define MALLOC_KIND_PTRFREE_INIT NULL +# endif GC_FAST_MALLOC_GRANS(result, granules, ((GC_tlfs)tsd) -> _freelistskind, DIRECT_GRANULES, kind, GC_malloc_kind_global(bytes, kind), - (void)(kind == PTRFREE ? NULL + (void)(kind == PTRFREE ? MALLOC_KIND_PTRFREE_INIT : (obj_link(result) = 0))); # ifdef LOG_ALLOCS GC_log_printf("GC_malloc_kind(%lu, %d) returned %p, recent GC #%lu\n", @@ -223,7 +231,7 @@ void *result; void **tiny_fl; - GC_ASSERT(GC_gcj_malloc_initialized); + GC_ASSERT(GC_gcjobjfreelist != NULL); tiny_fl = ((GC_tlfs)GC_getspecific(GC_thread_key))->gcj_freelists; GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES, GC_gcj_kind,
View file
_service:tar_scm:gc-8.0.6.tar.gz/tools/setjmp_t.c -> _service:tar_scm:gc-8.2.2.tar.gz/tools/setjmp_t.c
Changed
@@ -45,13 +45,8 @@ } return((int)(result0)); } -#elif defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE -# include <windows.h> +#elif defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) int getpagesize(void) { SYSTEM_INFO sysinfo; @@ -81,12 +76,18 @@ int g(int x); +#if defined(CPPCHECK) || !defined(__cplusplus) + const char *a_str = "a"; +#else +# define a_str "a" +#endif + int main(void) { volatile word sp; unsigned ps = GETPAGESIZE(); JMP_BUF b; - register int x = (int)strlen("a"); /* 1, slightly disguised */ + register int x = (int)strlen(a_str); /* 1, slightly disguised */ static volatile int y = 0; sp = (word)(&sp);
View file
_service:tar_scm:gc-8.0.6.tar.gz/typd_mlc.c -> _service:tar_scm:gc-8.2.2.tar.gz/typd_mlc.c
Changed
@@ -50,20 +50,12 @@ /* Object kind for objects with complex */ /* descriptors and GC_array_mark_proc. */ -/* Extended descriptors. GC_typed_mark_proc understands these. */ -/* These are used for simple objects that are larger than what */ -/* can be described by a BITMAP_BITS sized bitmap. */ -typedef struct { - word ed_bitmap; /* lsb corresponds to first word. */ - GC_bool ed_continued; /* next entry is continuation. */ -} ext_descr; - /* Array descriptors. GC_array_mark_proc understands these. */ /* We may eventually need to add provisions for headers and */ /* trailers. Hence we provide for tree structured descriptors, */ /* though we don't really use them currently. */ - struct LeafDescriptor { /* Describes simple array */ +struct LeafDescriptor { /* Describes simple array. */ word ld_tag; # define LEAF_TAG 1 size_t ld_size; /* bytes per element */ @@ -71,21 +63,21 @@ size_t ld_nelements; /* Number of elements. */ GC_descr ld_descriptor; /* A simple length, bitmap, */ /* or procedure descriptor. */ - }; +}; - struct ComplexArrayDescriptor { +struct ComplexArrayDescriptor { word ad_tag; # define ARRAY_TAG 2 size_t ad_nelements; union ComplexDescriptor * ad_element_descr; - }; +}; - struct SequenceDescriptor { +struct SequenceDescriptor { word sd_tag; # define SEQUENCE_TAG 3 union ComplexDescriptor * sd_first; union ComplexDescriptor * sd_second; - }; +}; typedef union ComplexDescriptor { struct LeafDescriptor ld; @@ -94,24 +86,11 @@ } complex_descriptor; #define TAG ad.ad_tag -STATIC ext_descr * GC_ext_descriptors = NULL; - /* Points to array of extended */ - /* descriptors. */ - -STATIC size_t GC_ed_size = 0; /* Current size of above arrays. */ #define ED_INITIAL_SIZE 100 -STATIC size_t GC_avail_descr = 0; /* Next available slot. */ - STATIC int GC_typed_mark_proc_index = 0; /* Indices of my mark */ STATIC int GC_array_mark_proc_index = 0; /* procedures. */ -#ifdef AO_HAVE_load_acquire - STATIC volatile AO_t GC_explicit_typing_initialized = FALSE; -#else - STATIC GC_bool GC_explicit_typing_initialized = FALSE; -#endif - STATIC void GC_push_typed_structures_proc(void) { GC_PUSH_ALL_SYM(GC_ext_descriptors); @@ -132,7 +111,7 @@ LOCK(); while (GC_avail_descr + nwords >= GC_ed_size) { - ext_descr * newExtD; + typed_ext_descr_t *newExtD; size_t new_size; word ed_size = GC_ed_size; @@ -146,14 +125,15 @@ new_size = 2 * ed_size; if (new_size > MAX_ENV) return(-1); } - newExtD = (ext_descr *)GC_malloc_atomic(new_size * sizeof(ext_descr)); + newExtD = (typed_ext_descr_t*)GC_malloc_atomic(new_size + * sizeof(typed_ext_descr_t)); if (NULL == newExtD) return -1; LOCK(); if (ed_size == GC_ed_size) { if (GC_avail_descr != 0) { BCOPY(GC_ext_descriptors, newExtD, - GC_avail_descr * sizeof(ext_descr)); + GC_avail_descr * sizeof(typed_ext_descr_t)); } GC_ed_size = new_size; GC_ext_descriptors = newExtD; @@ -188,7 +168,7 @@ { if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) { descriptor = GC_bm_tableBYTES_TO_WORDS((word)descriptor); - }; + } descriptor |= (descriptor & ~GC_DS_TAGS) >> nwords; return(descriptor); } @@ -227,7 +207,7 @@ /* of space needed on the mark stack. */ if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) { if (descriptor == (GC_descr)size) { - *simple_d = nelements * descriptor; + *simple_d = nelements * descriptor; /* no overflow */ return(SIMPLE); } else if ((word)descriptor == 0) { *simple_d = (GC_descr)0; @@ -301,6 +281,8 @@ (complex_descriptor *)one_element); break; } + if (EXPECT(NULL == *complex_d, FALSE)) return NO_MEM; + return(COMPLEX); } } @@ -332,8 +314,6 @@ return((complex_descriptor *)result); } -STATIC ptr_t * GC_eobjfreelist = NULL; - STATIC mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr, mse * mark_stack_limit, word env); @@ -346,9 +326,7 @@ GC_STATIC_ASSERT(sizeof(struct LeafDescriptor) % sizeof(word) == 0); /* Set up object kind with simple indirect descriptor. */ - GC_eobjfreelist = (ptr_t *)GC_new_free_list_inner(); - GC_explicit_kind = GC_new_kind_inner( - (void **)GC_eobjfreelist, + GC_explicit_kind = GC_new_kind_inner(GC_new_free_list_inner(), (WORDS_TO_BYTES((word)-1) | GC_DS_PER_OBJECT), TRUE, TRUE); /* Descriptors are in the last word of the object. */ @@ -478,6 +456,20 @@ } } +GC_ATTR_NO_SANITIZE_THREAD +static complex_descriptor *get_complex_descr(word *addr, word nwords) +{ + return (complex_descriptor *)addrnwords - 1; +} + +#ifdef AO_HAVE_store_release +# define set_obj_descr(op, nwords, d) \ + AO_store_release((volatile AO_t *)(op) + (nwords) - 1, (AO_t)(d)) +#else +# define set_obj_descr(op, nwords, d) \ + (void)(((word *)(op))(nwords) - 1 = (word)(d)) +#endif + STATIC mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr, mse * mark_stack_limit, word env GC_ATTR_UNUSED) @@ -485,7 +477,7 @@ hdr * hhdr = HDR(addr); word sz = hhdr -> hb_sz; word nwords = BYTES_TO_WORDS(sz); - complex_descriptor * descr = (complex_descriptor *)(addrnwords-1); + complex_descriptor *descr = get_complex_descr(addr, nwords); mse * orig_mark_stack_ptr = mark_stack_ptr; mse * new_mark_stack_ptr; @@ -528,7 +520,7 @@ GC_API GC_descr GC_CALL GC_make_descriptor(const GC_word * bm, size_t len) { - signed_word last_set_bit = len - 1; + signed_word last_set_bit = (signed_word)len - 1; GC_descr result; DCL_LOCK_STATE; @@ -597,14 +589,15 @@ size_t lg; GC_ASSERT(GC_explicit_typing_initialized); + if (EXPECT(0 == lb, FALSE)) lb = 1; /* ensure nwords > 1 */ lb = SIZET_SAT_ADD(lb, TYPD_EXTRA_BYTES); op = (word *)GC_malloc_kind(lb, GC_explicit_kind); if (EXPECT(NULL == op, FALSE)) return NULL; - /* It is not safe to use GC_size_maplb to compute lg here as the */ + /* It is not safe to use GC_size_maplb to compute lg here as */ /* the former might be updated asynchronously. */ lg = BYTES_TO_GRANULES(GC_size(op));
View file
_service:tar_scm:gc-8.0.6.tar.gz/win32_threads.c -> _service:tar_scm:gc-8.2.2.tar.gz/win32_threads.c
Changed
@@ -4,6 +4,7 @@ * Copyright (c) 1998 by Fergus Henderson. All rights reserved. * Copyright (c) 2000-2008 by Hewlett-Packard Development Company. * All rights reserved. + * Copyright (c) 2008-2021 Ivan Maidanski * * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. @@ -19,12 +20,6 @@ #if defined(GC_WIN32_THREADS) -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -#endif -#define NOSERVICE -#include <windows.h> - #ifdef THREAD_LOCAL_ALLOC # include "private/thread_local_alloc.h" #endif /* THREAD_LOCAL_ALLOC */ @@ -96,7 +91,7 @@ /* DllMain-based thread registration is currently incompatible */ /* with thread-local allocation, pthreads and WinCE. */ -#if (defined(GC_DLL) || defined(GC_INSIDE_DLL)) \ +#if (defined(GC_DLL) || defined(GC_INSIDE_DLL)) && !defined(NO_CRT) \ && !defined(GC_NO_THREADS_DISCOVERY) && !defined(MSWINCE) \ && !defined(THREAD_LOCAL_ALLOC) && !defined(GC_PTHREADS) @@ -186,8 +181,6 @@ # endif } -STATIC DWORD GC_main_thread = 0; - #define ADDR_LIMIT ((ptr_t)GC_WORD_MAX) struct GC_Thread_Rep { @@ -236,6 +229,11 @@ # ifdef IA64 ptr_t backing_store_end; ptr_t backing_store_ptr; +# elif defined(I386) + ptr_t initial_stack_base; + /* The cold end of the stack saved by */ + /* GC_record_stack_base (never modified */ + /* by GC_set_stackbottom). */ # endif ptr_t thread_blocked_sp; /* Protected by GC lock. */ @@ -251,12 +249,14 @@ /* GC_call_with_gc_active() of this */ /* thread. May be NULL. */ - unsigned short finalizer_skipped; - unsigned char finalizer_nested; +# ifndef GC_NO_FINALIZATION + unsigned short finalizer_skipped; + unsigned char finalizer_nested; /* Used by GC_check_finalizer_nested() */ /* to minimize the level of recursion */ /* when a client finalizer allocates */ /* memory (initially both are 0). */ +# endif unsigned char suspended; /* really of GC_bool type */ @@ -288,23 +288,20 @@ typedef volatile struct GC_Thread_Rep * GC_vthread; #ifndef GC_NO_THREADS_DISCOVERY + STATIC DWORD GC_main_thread = 0; + + /* We track thread attachments while the world is supposed to be */ + /* stopped. Unfortunately, we cannot stop them from starting, since */ + /* blocking in DllMain seems to cause the world to deadlock. Thus, */ + /* we have to recover if we notice this in the middle of marking. */ + STATIC volatile AO_t GC_attached_thread = FALSE; + /* We assumed that volatile ==> memory ordering, at least among */ /* volatiles. This code should consistently use atomic_ops. */ STATIC volatile GC_bool GC_please_stop = FALSE; #elif defined(GC_ASSERTIONS) STATIC GC_bool GC_please_stop = FALSE; -#endif - -/* - * We track thread attachments while the world is supposed to be stopped. - * Unfortunately, we can't stop them from starting, since blocking in - * DllMain seems to cause the world to deadlock. Thus we have to recover - * If we notice this in the middle of marking. - */ - -#ifndef GC_NO_THREADS_DISCOVERY - STATIC volatile AO_t GC_attached_thread = FALSE; -#endif +#endif /* GC_NO_THREADS_DISCOVERY && GC_ASSERTIONS */ #if defined(WRAP_MARK_SOME) && !defined(GC_PTHREADS) /* Return TRUE if an thread was attached since we last asked or */ @@ -407,6 +404,8 @@ me -> stack_base = (ptr_t)sb->mem_base; # ifdef IA64 me -> backing_store_end = (ptr_t)sb->reg_base; +# elif defined(I386) + me -> initial_stack_base = (ptr_t)sb->mem_base; # endif if (me -> stack_base == NULL) ABORT("Bad stack base in GC_register_my_thread"); @@ -580,37 +579,36 @@ # define CHECK_LOOKUP_MY_THREAD(me) /* empty */ #endif -/* Called by GC_finalize() (in case of an allocation failure observed). */ -/* GC_reset_finalizer_nested() is the same as in pthread_support.c. */ -GC_INNER void GC_reset_finalizer_nested(void) -{ - GC_thread me = GC_lookup_thread_inner(GetCurrentThreadId()); - CHECK_LOOKUP_MY_THREAD(me); - me->finalizer_nested = 0; -} +#ifndef GC_NO_FINALIZATION + /* Called by GC_finalize() (in case of an allocation failure observed). */ + /* GC_reset_finalizer_nested() is the same as in pthread_support.c. */ + GC_INNER void GC_reset_finalizer_nested(void) + { + GC_thread me = GC_lookup_thread_inner(GetCurrentThreadId()); -/* Checks and updates the thread-local level of finalizers recursion. */ -/* Returns NULL if GC_invoke_finalizers() should not be called by the */ -/* collector (to minimize the risk of a deep finalizers recursion), */ -/* otherwise returns a pointer to the thread-local finalizer_nested. */ -/* Called by GC_notify_or_invoke_finalizers() only (the lock is held). */ -/* GC_check_finalizer_nested() is the same as in pthread_support.c. */ -GC_INNER unsigned char *GC_check_finalizer_nested(void) -{ - GC_thread me = GC_lookup_thread_inner(GetCurrentThreadId()); - unsigned nesting_level; - CHECK_LOOKUP_MY_THREAD(me); - nesting_level = me->finalizer_nested; - if (nesting_level) { - /* We are inside another GC_invoke_finalizers(). */ - /* Skip some implicitly-called GC_invoke_finalizers() */ - /* depending on the nesting (recursion) level. */ - if (++me->finalizer_skipped < (1U << nesting_level)) return NULL; - me->finalizer_skipped = 0; + CHECK_LOOKUP_MY_THREAD(me); + me->finalizer_nested = 0; } - me->finalizer_nested = (unsigned char)(nesting_level + 1); - return &me->finalizer_nested; -} + + /* GC_check_finalizer_nested() is the same as in pthread_support.c. */ + GC_INNER unsigned char *GC_check_finalizer_nested(void) + { + GC_thread me = GC_lookup_thread_inner(GetCurrentThreadId()); + unsigned nesting_level; + + CHECK_LOOKUP_MY_THREAD(me); + nesting_level = me->finalizer_nested; + if (nesting_level) { + /* We are inside another GC_invoke_finalizers(). */ + /* Skip some implicitly-called GC_invoke_finalizers() */ + /* depending on the nesting (recursion) level. */ + if (++me->finalizer_skipped < (1U << nesting_level)) return NULL; + me->finalizer_skipped = 0; + } + me->finalizer_nested = (unsigned char)(nesting_level + 1); + return &me->finalizer_nested; + } +#endif /* !GC_NO_FINALIZATION */ #if defined(GC_ASSERTIONS) && defined(THREAD_LOCAL_ALLOC) /* This is called from thread-local GC_malloc(). */ @@ -739,7 +737,7 @@ GC_vthread t = GC_lookup_thread_inner(id); if (0 == t) { - WARN("Removing nonexistent thread, id = %" WARN_PRIdPTR "\n", id); + WARN("Removing nonexistent thread, id= %" WARN_PRIdPTR "\n", id); } else { GC_delete_gc_thread_no_free(t); } @@ -771,13 +769,20 @@ GC_API void GC_CALL GC_allow_register_threads(void) { - /* Check GC is initialized and the current thread is registered. */ - GC_ASSERT(GC_lookup_thread_inner(GetCurrentThreadId()) != 0); +# ifdef GC_ASSERTIONS + DCL_LOCK_STATE; + + /* Check GC is initialized and the current thread is registered. */ + LOCK(); + GC_ASSERT(GC_lookup_thread_inner(GetCurrentThreadId()) != 0); + UNLOCK(); +# endif # if !defined(GC_ALWAYS_MULTITHREADED) && !defined(PARALLEL_MARK) \
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