]> granicus.if.org Git - gc/log
gc
4 years agoDo not use iOS private symbols master
Ivan Maidanski [Mon, 21 Oct 2019 06:39:12 +0000 (09:39 +0300)]
Do not use iOS private symbols

Issue #295 (bdwgc).

* include/private/gcconfig.h [(AARCH64 || ARM32) && DARWIN]
(MPROTECT_VDB): Do not define; add comment.

4 years ago.gitignore: Collapse multiple lib*.so items in a single one
Ivan Maidanski [Tue, 15 Oct 2019 08:18:02 +0000 (11:18 +0300)]
.gitignore: Collapse multiple lib*.so items in a single one
(code refactoring)

4 years agoAppVeyor CI: Test MS VC build with -D GC_NO_INLINE_STD_NEW
Ivan Maidanski [Tue, 15 Oct 2019 07:24:52 +0000 (10:24 +0300)]
AppVeyor CI: Test MS VC build with -D GC_NO_INLINE_STD_NEW

4 years agoNew macro to avoid system-wide new/delete inlining in gc_cpp.h (Win32)
Ivan Maidanski [Tue, 15 Oct 2019 06:59:19 +0000 (09:59 +0300)]
New macro to avoid system-wide new/delete inlining in gc_cpp.h (Win32)
(fix of commit 3d784ed)

* doc/README.macros (GC_NO_INLINE_STD_NEW): Document.
* gc_cpp.cc [(_MSC_VER || __DMC__) && GC_NO_INLINE_STD_NEW
&& GC_NEW_DELETE_NEED_THROW] (GC_DECL_NEW_THROW): Define.
* gc_cpp.cc [(_MSC_VER || __DMC__) && GC_NO_INLINE_STD_NEW]
(operator new, operator delete): Likewise.
* include/gc_cpp.h [_MSC_VER || __DMC__ || (__BORLANDC__ || __CYGWIN__
|| __MINGW32__ || __WATCOMC__) && !GC_BUILD && !GC_NOT_DLL]
(operator new, operator delete): Do not define inline function if
GC_NO_INLINE_STD_NEW.
* gc_cpp.cc [GC_NO_INLINE_STD_NEW && _MSC_VER] (operator new,
operator delete): Declare; move comment.

4 years agoRemove a note in README.macros that work in progress
Ivan Maidanski [Sat, 12 Oct 2019 07:59:10 +0000 (10:59 +0300)]
Remove a note in README.macros that work in progress
(fix of commit 6f8f39af5)

* README.macros: Remove a note that work is in progress.

4 years agoUpdate AUTHORS file
Ivan Maidanski [Fri, 11 Oct 2019 18:36:56 +0000 (21:36 +0300)]
Update AUTHORS file

4 years agoFix 'traceable but uncollectible memory' wording in gcinterface document
Dima Pasechnik [Fri, 11 Oct 2019 18:33:31 +0000 (21:33 +0300)]
Fix 'traceable but uncollectible memory' wording in gcinterface document

Issue #268 (bdgwc).

* doc/gcinterface.md (Class inheritance-based interface): Fix a typo
("traceable but uncollectible memory").

4 years agoFix gc_cpp.h file name in comments after renaming
Ivan Maidanski [Fri, 11 Oct 2019 18:14:24 +0000 (21:14 +0300)]
Fix gc_cpp.h file name in comments after renaming

* gc_cpp.cc: Rename gc_c++.h to gc_cpp.h in the head comment.
* tests/test_cpp.cc: Likewise.

4 years agoUpdate ChangeLog file
Ivan Maidanski [Fri, 11 Oct 2019 08:51:55 +0000 (11:51 +0300)]
Update ChangeLog file

4 years agoUpdate ChangeLog file (v8.0 changes)
Ivan Maidanski [Thu, 10 Oct 2019 23:04:02 +0000 (02:04 +0300)]
Update ChangeLog file (v8.0 changes)

4 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Thu, 10 Oct 2019 22:54:09 +0000 (01:54 +0300)]
Update ChangeLog file (v7.6 changes)

4 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Thu, 10 Oct 2019 22:21:41 +0000 (01:21 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

4 years agoUpdate AUTHORS file
Ivan Maidanski [Mon, 7 Oct 2019 05:45:53 +0000 (08:45 +0300)]
Update AUTHORS file

4 years agoFix a typo in 'primitives' word in ChangeLog
Sorawee Porncharoenwase [Tue, 2 Jul 2019 04:52:31 +0000 (21:52 -0700)]
Fix a typo in 'primitives' word in ChangeLog
(a cherry-pick of 34c88d306 from 'racket_gc')

* ChangeLog (6.2alpha4): Fix typo ("primitives").

4 years agoAdd dummy target for mono client
Jonathan Chambers [Mon, 16 Sep 2019 22:40:44 +0000 (18:40 -0400)]
Add dummy target for mono client
(a cherry-pick of commit b762dda6 from Unity-Technologies/bdwgc)

* Makefile.am (test-bundle): New target (empty).

4 years agoWorkaround 'condition is redundant or null deref is possible' cppcheck FP
Ivan Maidanski [Fri, 4 Oct 2019 20:43:09 +0000 (23:43 +0300)]
Workaround 'condition is redundant or null deref is possible' cppcheck FP

* cord/cordprnt.c (MACRO_BLKSTMT_BEGIN, MACRO_BLKSTMT_END): New macro.
* cord/tests/de.c (MACRO_BLKSTMT_BEGIN, MACRO_BLKSTMT_END): Likewise.
* include/private/gc_priv.h (MACRO_BLKSTMT_BEGIN, MACRO_BLKSTMT_END):
Likewise.
* cord/cordprnt.c (OUT_OF_MEMORY): Use MACRO_BLKSTMT_BEGIN/END instead
of "do {" and "} while (0)".
* cord/tests/de.c (OUT_OF_MEMORY): Likewise.
* include/private/gc_priv.h (ABORT_ARG1, ABORT_ARG2, ABORT_ARG3):
Likewise.

4 years agoWorkaround 'condition *flh==0 is always true' cppcheck false positive
Ivan Maidanski [Fri, 4 Oct 2019 20:25:19 +0000 (23:25 +0300)]
Workaround 'condition *flh==0 is always true' cppcheck false positive

* alloc.c [CPPCHECK] (GC_allocobj): Call GC_noop1(flh) between *flh==0
checks.

4 years agoFix GC_new_hblk prototype in a comment
Ivan Maidanski [Fri, 4 Oct 2019 19:08:07 +0000 (22:08 +0300)]
Fix GC_new_hblk prototype in a comment

* new_hblk.c: Specify the 2nd argument (kind) of GC_new_hblk in the
head comment.

4 years agoCheck thread is alive on each SuspendThread loop iteration (Win32)
Ivan Maidanski [Fri, 4 Oct 2019 17:42:54 +0000 (20:42 +0300)]
Check thread is alive on each SuspendThread loop iteration (Win32)
(fix of commit 449eda034)

* win32_threads.c [!GC_NO_THREADS_DISCOVERY]
(GC_delete_gc_thread_no_free): Reset suspended if GC_win32_dll_threads.
* win32_threads.c [!MSWINCE] (GC_suspend): Move comment near exitCode
declaration to be near GetExitCodeThread() call; adjust comment.
* win32_threads.c [!MSWINCE && RETRY_GET_THREAD_CONTEXT] (GC_suspend):
Call GetExitCodeThread() on each iteration of the suspend loop; refine
ABORT message on ResumeThread failure.

4 years agoDo not hold GC_fault_handler_lock when in Sleep (Win32)
Ivan Maidanski [Thu, 3 Oct 2019 21:38:28 +0000 (00:38 +0300)]
Do not hold GC_fault_handler_lock when in Sleep (Win32)
(fix of commits 0c0e4cd0b449eda034)

Also, reduce a period between GetExitCodeThread and SuspendThread.

* win32_threads.c [DEBUG_THREADS] (GC_suspend): Call GC_log_printf()
before UNPROTECT_THREAD().
* win32_threads.c [DEBUG_THREADS && !MSWINCE] (GC_suspend): Call
GC_acquire_dirty_lock() before GetExitCodeThread(); call
GC_release_dirty_lock() immediately if GetExitCodeThread() failed.
* win32_threads.c [MSWINCE || RETRY_GET_THREAD_CONTEXT] (GC_suspend):
Wrap Sleep() call with GC_release/acquire_dirty_lock().

4 years agoWorkaround 'label handle_thr_start is not used' cppcheck style warning
Ivan Maidanski [Thu, 3 Oct 2019 07:17:37 +0000 (10:17 +0300)]
Workaround 'label handle_thr_start is not used' cppcheck style warning
(fix of commit 03109f287)

* mark.c [WRAP_MARK_SOME && GC_WIN32_THREADS && !GC_PTHREADS]
(GC_mark_some): Define handle_thr_start label only if MSWIN32 or
MSWINCE is defined.

4 years agoUse CreateThread without GC_ prefix in gctest
Ivan Maidanski [Wed, 2 Oct 2019 22:03:51 +0000 (01:03 +0300)]
Use CreateThread without GC_ prefix in gctest
(code refactoring)

* tests/test.c (GC_NO_THREAD_REDIRECTS): Do not undefine unless
GC_NO_THREADS_DISCOVERY is defined.
* tests/test.c [GC_WIN32_THREADS] (fork_a_thread, WinMain): Call
CreateThread() instead of GC_CreateThread().

4 years agoFix 'ACCESS_VIOLATION in marker' GC warning on Win32 async thread start
Ivan Maidanski [Wed, 2 Oct 2019 21:23:31 +0000 (00:23 +0300)]
Fix 'ACCESS_VIOLATION in marker' GC warning on Win32 async thread start
(fix of commit 38d07c167)

* mark.c [WRAP_MARK_SOME && (MSWIN32 || MSWINCE) && GC_WIN32_THREADS
&& !GC_PTHREADS] (GC_mark_some): If GC_started_thread_while_stopped()
then goto handle_thr_start instead of handle_ex.
* mark.c [WRAP_MARK_SOME && GC_WIN32_THREADS && !GC_PTHREADS]
(GC_mark_some): Define handle_thr_start label right after WARN() call.

4 years agoWorkaround 'condition appendToFile is always false' cppcheck false positive
Ivan Maidanski [Thu, 26 Sep 2019 08:31:27 +0000 (11:31 +0300)]
Workaround 'condition appendToFile is always false' cppcheck false positive

* misc.c [(MSWIN32 && !CONSOLE_LOG || MSWINCE) && !MSWINRT_FLAVOR
&& NO_GETENV_WIN32 && CPPCHECK] (GC_CreateLogFile): Define appendToFile
as macro (to FALSE) instead of a local variable; undefine appendToFile
at the function.

4 years agoSet GC_collecting hint for GC_collect_a_little_inner calls (pthreads)
Ivan Maidanski [Wed, 25 Sep 2019 08:28:41 +0000 (11:28 +0300)]
Set GC_collecting hint for GC_collect_a_little_inner calls (pthreads)

* alloc.c (GC_try_to_collect_inner, GC_collect_a_little): Wrap
GC_collect_a_little_inner() call into ENTER/EXIT_GC().
* gc_dlopen.c [!USE_PROC_FOR_LIBRARIES] (disable_gc_for_dlopen):
Likewise.
* malloc.c (GC_alloc_large): Likewise.

4 years agoPrevent use of unsaved thread context registers in incremental GC (Windows)
Ivan Maidanski [Wed, 25 Sep 2019 07:31:31 +0000 (10:31 +0300)]
Prevent use of unsaved thread context registers in incremental GC (Windows)
(fix of commits 449eda034190e18c75)

During incremental collection GC_push_all_stacks() may be called when
the world is not stopped.  If the context registers and sp value are
saved during thread suspension then GC_push_all_stacks() gets these
values of the previous GC cycle or, even, gets all zeros instead the
context registers and sp on the first GC after the thread creation.
This commit fixes this by calling GetThreadContext in GC_push_stack_for
if thread is not suspended.

* win32_threads.c (first_thread): Refine the comment.
* win32_threads.c [!GC_NO_THREADS_DISCOVERY && RETRY_GET_THREAD_CONTEXT]
(GC_delete_gc_thread_no_free): Reset context_sp if GC_win32_dll_threads.
* win32_threads.c (GC_push_stack_for): Change the assertion expression
from thread->suspended to thread->suspended||!GC_world_stopped (the
assertion is off unless THREAD_LOCAL_ALLOC).
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_push_stack_for): If
thread is not suspended then call GetThreadContext(), if it fails then
use sp value and the context registers saved during the latest
stop-the-world; add comments.
* win32_threads.c (GC_push_all_stacks): Add the title comment (copied
from pthread_stop_world.c).

4 years agoRemove redundant GC_with_callee_saves_pushed call in multi-threaded builds
Ivan Maidanski [Tue, 24 Sep 2019 07:52:51 +0000 (10:52 +0300)]
Remove redundant GC_with_callee_saves_pushed call in multi-threaded builds

In GC_push_regs_and_stack, if cold_gc_frame is null and threads
support is on then there is no need to call
GC_with_callee_saves_pushed(GC_push_current_stack) as
GC_push_current_stack is no-op in this case.

* mark_rts.c (GC_push_current_stack): Reformat title comment.
* mark_rts.c [THREADS] (GC_push_current_stack): Do not check that
cold_gc_frame is non-zero; add comment about it.
* mark_rts.c [THREADS] (GC_push_regs_and_stack): If cold_gc_frame is
null then do not call GC_with_callee_saves_pushed().

4 years agoReformat code of GC_push_roots
Ivan Maidanski [Mon, 23 Sep 2019 06:51:53 +0000 (09:51 +0300)]
Reformat code of GC_push_roots

* mark_rts.c (GC_push_roots): Refine title comment; reformat comments;
adjust code and comments indentation.

4 years agoAdd assertion that thread is suspended when using context registers
Ivan Maidanski [Mon, 16 Sep 2019 08:39:42 +0000 (11:39 +0300)]
Add assertion that thread is suspended when using context registers

* win32_threads.c (GC_push_stack_for): Add assertion that thread is
suspended (before using context registers) if thread is not self and
not blocked.

4 years agoAdd debug messages on thread suspend/resume (Win32)
Ivan Maidanski [Mon, 16 Sep 2019 07:41:11 +0000 (10:41 +0300)]
Add debug messages on thread suspend/resume (Win32)

The messages are similar to the ones for Darwin.

* win32_threads.c [DEBUG_THREADS] (GC_suspend): Log a message that the
thread is going to be suspended.
* win32_threads.c [DEBUG_THREADS] (GC_start_world): Log a message
whether the thread is going to be resumed or it cannot be resumed
because it is not suspended.

4 years agoCollapse multiple includes of windows.h
Ivan Maidanski [Sat, 14 Sep 2019 12:34:59 +0000 (15:34 +0300)]
Collapse multiple includes of windows.h
(code refactoring)

* dyn_load.c [MSWIN32 || MSWINCE || CYGWIN32]: Do not define
WIN32_LEAN_AND_MEAN and NOSERVICE macros; do not include windows.h.
* include/private/gc_locks.h [GC_WIN32_THREADS && !USE_PTHREAD_LOCKS]:
Likewise.
* include/private/gc_priv.h [!NO_CLOCK && !BSD_TIME && (MSWIN32
|| MSWINCE || WINXP_USE_PERF_COUNTER)]: Likewise.
* include/private/thread_local_alloc.h [!USE_PTHREAD_SPECIFIC
&& !USE_COMPILER_TLS && !USE_WIN32_COMPILER_TLS && USE_WIN32_SPECIFIC]:
Likewise.
* mallocx.c [MSWINCE]: Likewise.
* misc.c [MSWIN32 || MSWINCE || CYGWIN32 && GC_READ_ENV_FILE]: Likewise.
* os_dep.c [MSWIN32 || MSWINCE || CYGWIN32]: Likewise.
* tests/test.c [MSWIN32 || MSWINCE]: Likewise.
* tools/setjmp_t.c [!OS2 && (MSWIN32 || MSWINCE || CYGWIN32)]: Likewise.
* win32_threads.c [GC_WIN32_THREADS]: Likewise.
* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]
(WIN32_LEAN_AND_MEAN, NOSERVICE): Define macro (before include
windows.h).
* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]: Inclde
windows.h and winbase.h before include gc_locks.h (instead of just
before GC_sysinfo declaration).

4 years agoEliminate 'static GC_sysinfo definition has incomplete type' Clang warning
Ivan Maidanski [Sat, 14 Sep 2019 09:00:38 +0000 (12:00 +0300)]
Eliminate 'static GC_sysinfo definition has incomplete type' Clang warning

Tentative definition of variable with internal linkage has incomplete
non-array type 'struct _SYSTEM_INFO'.

The warning observed only in single-threaded shared builds by Clang.

* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]
(WIN32_LEAN_AND_MEAN, NOSERVICE): Define macro.
* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]: Include
windows.h (wrapped into EXTERN_C_END/BEGIN) before GC_sysinfo
declaration.
* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]
(_SYSTEM_INFO): Do not declare.
* include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32]
(GC_sysinfo): Change type from struct _SYSTEM_INFO to SYSTEM_INFO.

4 years agoAppVeyor CI: Test mingw build with -D CONSOLE_LOG
Ivan Maidanski [Thu, 12 Sep 2019 07:11:09 +0000 (10:11 +0300)]
AppVeyor CI: Test mingw build with -D CONSOLE_LOG

4 years agoNew macro (CONSOLE_LOG) to enable logging to console on Win32
Ivan Maidanski [Thu, 12 Sep 2019 07:08:06 +0000 (10:08 +0300)]
New macro (CONSOLE_LOG) to enable logging to console on Win32

The macro is effective only on the Win32 (MSWIN32) target.  It changes
the logging facility to be the same as on Cygwin and other Unix-like
targets.

* doc/README.macros (CONSOLE_LOG): Document new macro.
* include/private/gc_priv.h [THREADS && MSWIN32 && CONSOLE_LOG]
(GC_write_cs): Do not declare.
* include/private/gc_priv.h [THREADS && MSWIN32 && CONSOLE_LOG
&& GC_ASSERTIONS] (GC_write_disabled): Likewise.
* misc.c [CONSOLE_LOG && MSWIN32]: Include fcntl.h, sys/types.h,
sys/stat.h.
* misc.c [GC_WIN32_THREADS && MSWIN32 && CONSOLE_LOG] (GC_write_cs):
Do not define.
* win32_threads.c [GC_ASSERTIONS && MSWIN32 && CONSOLE_LOG]
(GC_write_disabled): Likewise.
* misc.c [MSWIN32 && CONSOLE_LOG] (GC_stdout, GC_stderr, GC_log): Define
STATIC variable (of int type).
* misc.c [GC_WIN32_THREADS && MSWIN32 && CONSOLE_LOG] (GC_init): Do not
call InitializeCriticalSection(&GC_write_cs); handle GC_LOG_FILE and
GC_ONLY_LOG_TO_FILE environment variables.
* misc.c [GC_WIN32_THREADS && MSWIN32 && CONSOLE_LOG] (GC_deinit): Do
not call DeleteCriticalSection(&GC_write_cs).
* misc.c [MSWIN32 && CONSOLE_LOG] (IF_NEED_TO_LOCK, getWinRTLogPath,
GC_CreateLogFile): Do not define.
* misc.c [!PCR && !SMALL_CONFIG && !GC_ANDROID_LOG && GC_WIN32_THREADS
&& GC_ASSERTIONS MSWIN32 && CONSOLE_LOG] (GC_default_on_abort): Do not
use GC_write_disabled.
* win32_threads.c [MSWIN32 && CONSOLE_LOG] (GC_stop_world): Do not use
GC_write_disabled and GC_write_cs.

4 years agoDo not define GC_write_cs for Xbox One target
Ivan Maidanski [Wed, 11 Sep 2019 20:03:49 +0000 (23:03 +0300)]
Do not define GC_write_cs for Xbox One target
(fix of commit d16debf3e)

Issue #173 (bdwgc).

GC_write_cs is not used in GC_write thus there is no need to define
and use it in GC_stop_world.

* include/private/gc_priv.h [THREADS && MSWIN_XBOX1] (GC_write_cs):
Do not declare.
* misc.c [THREADS && MSWIN_XBOX1] (GC_write_cs): Do not define.
* win32_threads.c (GC_stop_world): Call EnterCriticalSection() and
LeaveCriticalSection() only if MSWIN32 or MSWINCE.

4 years agoWorkaround 'argument to function is always 1' cppcheck false positives
Ivan Maidanski [Tue, 10 Sep 2019 22:11:04 +0000 (01:11 +0300)]
Workaround 'argument to function is always 1' cppcheck false positives

* allchblk.c (GC_print_hblkfreelist): Replace "while(p!=0)" with
"while(p)"; add a marker that the change is for cppcheck.
* allchblk.c (GC_free_block_ending_at, GC_add_to_fl, GC_split_block,
GC_allochblk_nth, GC_freehblk): Replace "if(p!=0)" with "if(p)".
* alloc.c (GC_set_fl_marks): Likewise.
* extra/MacOS.c (GC_MacFreeTemporaryMemory): Likewise.
* mallocx.c (GC_generic_malloc_many): Likewise.
* allchblk.c (GC_allochblk_nth): Replace "if(0==p)" with "if(p){}else".
* malloc.c (GC_free): Likewise.
* malloc.c (GC_generic_malloc_uncollectable): Replace
"if(0==p)return 0;<code>;return p;" with "if(p){<code>}return p;".
* mallocx.c (GC_generic_malloc_many): Replace "p+=v;while((p2=*p)!=0)"
with "for(p+=v;(p2=*p)!=0;)".
* reclaim.c (GC_continue_reclaim, GC_reclaim_all): Likewise.

4 years agoWorkaround 'redundant initialization for r' cppcheck false positive
Ivan Maidanski [Tue, 10 Sep 2019 20:35:14 +0000 (23:35 +0300)]
Workaround 'redundant initialization for r' cppcheck false positive

* mark.c (GC_mark_and_push_stack): Replace "if(a&&b)" with
"if(a) if(b)" where b is an expression which contains r variable
assignment.

4 years agoWorkaround 'cnt var assigned but not used' cppcheck FP in copy_ptr_regs
Ivan Maidanski [Tue, 10 Sep 2019 20:28:15 +0000 (23:28 +0300)]
Workaround 'cnt var assigned but not used' cppcheck FP in copy_ptr_regs
(fix of commit 912ec408d)

* win32_threads.c [!I386 && !X86_64 && !ARM32 && !AARCH64 && !SHx
&& !MIPS && !PPC && !ALPHA && CPPCHECK] (copy_ptr_regs): Set sp to cnt
value (with a cast); add comment.

4 years agoRemove redundant check of GC_free argument in register_finalizer
Ivan Maidanski [Tue, 10 Sep 2019 20:09:29 +0000 (23:09 +0300)]
Remove redundant check of GC_free argument in register_finalizer
(code refactoring)

This also works around "Argument new_fo to function GC_free is always 1"
cppcheck false positive.

* finalize.c [!DBG_HDRS_ALL] (GC_register_finalizer_inner): Do not
check new_fo is non-NULL before GC_free(new_fo) call.

4 years agoReplace push_one calls with push_many_regs one for Win32 thread context
Ivan Maidanski [Tue, 10 Sep 2019 08:09:42 +0000 (11:09 +0300)]
Replace push_one calls with push_many_regs one for Win32 thread context
(code refactoring)

Also, do not define GC_push_one except for Darwin (and some ancient
targets that use the function).

* include/private/gc_priv.h [MSWIN32 || MSWINCE] (GC_push_one): Do not
declare.
* include/private/gc_priv.h [!MSWIN32 && !MSWINCE] (GC_push_one):
Declare only if AMIGA or MACOS or GC_DARWIN_THREADS.
* include/private/gc_priv.h [GC_WIN32_THREADS] (GC_push_many_regs):
Declare function; add comment.
* mark.c (GC_push_one): Define only if AMIGA or MACOS or
GC_DARWIN_THREADS.
* mark.c [GC_WIN32_THREADS] (GC_push_many_regs): New GC_INNER function.
* win32_threads.c (GC_push_stack_for): Remove i local variable; call
GC_push_many_regs() instead of a loop with GC_push_one() calls (ignore
2 first registers if WOW64_THREAD_CONTEXT_WORKAROUND).

4 years agoFix incorrect code generation by MS VC caused by excessive Thread_Rep size
Ivan Maidanski [Tue, 10 Sep 2019 08:01:09 +0000 (11:01 +0300)]
Fix incorrect code generation by MS VC caused by excessive Thread_Rep size
(fix of commit 449eda034)

The gctest crashes were observed in debug builds produced by MS VC.

In addition, this change greatly reduces memory usage by GC_threads[]
and dll_thread_table[] (compared to the solution that stores the full
CONTEXT in GC_Thread_Rep).

* win32_threads.c (copy_ptr_regs): Declare static function.
* win32_threads.c (PUSHED_REGS_COUNT): Define macro.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT]
(GC_Thread_Rep.saved_context): Move down to be the last field; change
type from CONTEXT to word[PUSHED_REGS_COUNT]; rename to context_regs.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT]
(GC_Thread_Rep.context_sp): New field.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_suspend): Declare
context local variable and use it for GetThreadContext() call; if the
latter succeeds then call copy_ptr_regs(); update comment.
* win32_threads.c (copy_ptr_regs): Define static function (move
PUSH-related part of GC_push_stack_for code here); change PUSH1(reg) to
store reg to regs[]; define context as *pcontext; add assertion that
number of stored registers is equal to PUSHED_REGS_COUNT.
* win32_threads.c [WOW64_THREAD_CONTEXT_WORKAROUND] (copy_ptr_regs):
Store ContextFlags and SegFs as the first elements of regs[].
* win32_threads.c (GC_push_stack_for): Declare i local variable (set
to 0).
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_push_stack_for):
Replace pcontext and context with word *regs; set sp from
thread->context_sp; remove undef context.
* win32_threads.c [!RETRY_GET_THREAD_CONTEXT] (GC_push_stack_for):
Declare regs[PUSHED_REGS_COUNT]; call copy_ptr_regs() to initialize
regs[] and sp; limit context scope to GetThreadContext() and
copy_ptr_regs() calls only.
* win32_threads.c (GC_push_stack_for): Call GC_push_one() for each
regs[] element (except for the first 2 ones if
WOW64_THREAD_CONTEXT_WORKAROUND).
* win32_threads.c [WOW64_THREAD_CONTEXT_WORKAROUND]
(GC_push_stack_for): Define ContextFlags, SegFs local variables
(the values are obtained from regs[]); use these variables instead of
context one; do not overwrite sp local variable value so that not to
use context.Esp directly (i.e. not to use context out of its scope).

4 years agoAppVeyor CI: Test mingw64 build with -D NO_RETRY_GET_THREAD_CONTEXT
Ivan Maidanski [Thu, 5 Sep 2019 09:17:04 +0000 (12:17 +0300)]
AppVeyor CI: Test mingw64 build with -D NO_RETRY_GET_THREAD_CONTEXT

4 years agoPrevent GetThreadContext failure (Windows)
Jonathan Chambers [Thu, 5 Sep 2019 09:15:35 +0000 (12:15 +0300)]
Prevent GetThreadContext failure (Windows)
(a cherry-pick of commits 3f39ea8ab3699da from 'unity-master')

Calls to GetThreadContext may fail.  Work around this by putting
access in suspend/resume loop to advance thread past problematic areas
where suspend fails.  Capture context in per thread structure at
suspend time rather than retreiving it during the push logic.

* include/private/gcconfig.h [(I386 || X86_64) && (CYGWIN32 || MSWIN32)]
(RETRY_GET_THREAD_CONTEXT): Define macro.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT]
(MAX_SUSPEND_THREAD_RETRIES): Likewise.
* include/private/gcconfig.h [NO_RETRY_GET_THREAD_CONTEXT]
(RETRY_GET_THREAD_CONTEXT): Undefine macro (for test purposes).
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_Thread_Rep): Add
saved_context field; add comment.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_suspend): Define
retry_cnt local variable; set ContextFlags and call GetThreadContext()
after invocation of SuspendThread(); call ResumeThread() and proceed to
SuspendThread() if GetThreadContext() failed (the limit of iterations
is MAX_SUSPEND_THREAD_RETRIES); call Sleep(0) after ResumeThread() or
failed SuspendThread() except for the first 2 iterations.
* win32_threads.c [RETRY_GET_THREAD_CONTEXT] (GC_push_stack_for):
Declare pcontext local variable (which refers to thread->saved_context);
define context as a macro (to *pcontext) instead of a local variable;
add comment; do not set ContextFlags and do not call GetThreadContext();
undefine context after last use of PUSHn().

4 years agoRefactoring of WoW64 workaround (Win32)
Ivan Maidanski [Thu, 5 Sep 2019 08:44:27 +0000 (11:44 +0300)]
Refactoring of WoW64 workaround (Win32)
(code refactoring of commit 9483d5bba)

Issue #262 (bdwgc).

* include/private/gcconfig.h [I386 && (CYGWIN32 || MSWIN32)]
(WOW64_THREAD_CONTEXT_WORKAROUND): Define macro.
* win32_threads.c [!CONTEXT_EXCEPTION_ACTIVE] (CONTEXT_EXCEPTION_ACTIVE,
CONTEXT_EXCEPTION_REQUEST, CONTEXT_EXCEPTION_REPORTING): Move macro
definition upper to be before GC_suspend(); define only if
WOW64_THREAD_CONTEXT_WORKAROUND is defined (instead of I386).
* win32_threads.c (isWow64): Move static variable upper to be before
GC_suspend(); define only if WOW64_THREAD_CONTEXT_WORKAROUND.
* win32_threads.c (GET_THREAD_CONTEXT_FLAGS): New macro.
* win32_threads.c (GC_push_stack_for): Always set context.ContextFlags
to GET_THREAD_CONTEXT_FLAGS.
* win32_threads.c [I386] (GC_push_stack_for): Always store context.Esp
to sp (as the initial value).
* win32_threads.c (GC_push_stack_for): Use WoW64 workaround only
if WOW64_THREAD_CONTEXT_WORKAROUND (instead of I386).
* win32_threads.c (GC_thr_init): Set isWow64 only if
WOW64_THREAD_CONTEXT_WORKAROUND (instead of I386).

4 years agoDefine OS_TYPE and DATAEND for UWP targets
Ivan Maidanski [Wed, 4 Sep 2019 06:03:14 +0000 (09:03 +0300)]
Define OS_TYPE and DATAEND for UWP targets
(fix of commit 1471f940e9)

* include/private/gcconfig.h [AARCH64 && MSWIN32] (OS_TYPE, DATAEND):
Define macro; add TODO about GWW_VDB and MPROTECT_VDB.
* include/private/gcconfig.h [ARM32 && MSWIN32] (OS_TYPE, DATAEND):
Likewise.

4 years agoPrevent WARN of incompatible incremental GC if default or manual VDB
Ivan Maidanski [Thu, 29 Aug 2019 21:46:43 +0000 (00:46 +0300)]
Prevent WARN of incompatible incremental GC if default or manual VDB

Incremental GC based on mprotect is considered incompatible with /proc
roots but the default and manual VDB modes are OK.

* mark.c [WRAP_MARK_SOME && !MSWIN32 && !MSWINCE] (GC_mark_some):
Do not WARN about incompatibility of incremental GC with /proc roots
if DEFAULT_VDB or GC_auto_incremental is false (i.e. manual VDB is on).

4 years agoDisable mprotect-based incremental GC if /proc roots are used (Linux)
Ivan Maidanski [Thu, 29 Aug 2019 21:28:23 +0000 (00:28 +0300)]
Disable mprotect-based incremental GC if /proc roots are used (Linux)

The incremental GC is considered incompatible with /proc roots.

* include/private/gcconfig.h [USE_PROC_FOR_LIBRARIES
&& GC_LINUX_THREADS] (MPROTECT_VDB): Undefine; add comment.

4 years agoFix a typo in GC_init comment
Ivan Maidanski [Thu, 29 Aug 2019 05:36:03 +0000 (08:36 +0300)]
Fix a typo in GC_init comment

* misc.c [USE_PROC_FOR_LIBRARIES && GC_LINUX_THREADS] (GC_init): Fix
typo in comment ("will").

4 years agoUpdate ChangeLog file
Ivan Maidanski [Tue, 27 Aug 2019 06:55:17 +0000 (09:55 +0300)]
Update ChangeLog file

4 years agoUpdate ChangeLog file (v8.0 changes)
Ivan Maidanski [Mon, 26 Aug 2019 21:16:58 +0000 (00:16 +0300)]
Update ChangeLog file (v8.0 changes)

4 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Mon, 26 Aug 2019 19:36:53 +0000 (22:36 +0300)]
Update ChangeLog file (v7.6 changes)

4 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Mon, 26 Aug 2019 06:46:26 +0000 (09:46 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

4 years agoTravis CI: Test cmake build w/o threads, test it w/o shared libs on OS X
Ivan Maidanski [Thu, 22 Aug 2019 22:27:58 +0000 (01:27 +0300)]
Travis CI: Test cmake build w/o threads, test it w/o shared libs on OS X

4 years agoAppVeyor CI: Test cmake build with "DllMain to track threads"
Ivan Maidanski [Thu, 22 Aug 2019 22:19:48 +0000 (01:19 +0300)]
AppVeyor CI: Test cmake build with "DllMain to track threads"

4 years agoEnable multi-threaded builds by CMake
Ivan Maidanski [Thu, 22 Aug 2019 22:14:25 +0000 (01:14 +0300)]
Enable multi-threaded builds by CMake

Now, enable_threads option is on by default.

* CMakeLists.txt (enable_threads): Change option default to ON; remove
TODO item; set proper option message.
* CMakeLists.txt (libatomic_ops/src): Specify include directory only
if enable_threads.
* CMakeLists.txt (LIBS): Rename to THREADDLLIBS.
* CMakeLists.txt [enable_threads]: Change message level and content.
* CMakeLists.txt [enable_threads] (THREADDLLIBS): Set to
CMAKE_THREAD_LIBS_INIT value (instead of Threads_LIBRARIES).
* CMakeLists.txt [enable_threads && !(APPLE || CYGWIN || MSYS || WIN32
|| HOST MATCHES mips-.*-irix6.*)] (THREADDLLIBS): Append -ldl; add
comment.
* CMakeLists.txt [Threads_FOUND]: Remove commented out code.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT]: Update comments; remove
TODO items.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT
&& (HOST MATCHES .*-.*-hpux10.*)]: Change message level to fatal error.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT] (GC_BUILTIN_ATOMIC): Define
C macro; add comment.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT] (GC_THREADS, _REENTRANT):
Define C macro unconditionally.
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && !ANDROID && !MSYS
&& !APPLE && enable_handle_fork] (HANDLE_FORK): Define C macro.
* CMakeLists.txt [CMAKE_USE_WIN32_THREADS_INIT
&& enable_thread_local_alloc && !enable_parallel_mark]
(THREAD_LOCAL_ALLOC): Do not define if BUILD_SHARED_LIBS; add comment.
* CMakeLists.txt [CMAKE_HP_PTHREADS_INIT || CMAKE_USE_SPROC_INIT]:
Fatal error message.
* CMakeLists.txt [enable_gcj_support && enable_threads]
(GC_ENABLE_SUSPEND_THREAD): Do not define if enable_thread_local_alloc
and host is kfreebsd; add FIXME item.
* CMakeLists.txt [enable_threads] (gc): Specify THREADDLLIBS as target
link libraries.
* CMakeLists.txt [build_tests] (gctest): Likewise.
* CMakeLists.txt [build_tests && enable_disclaim] (disclaim_test,
disclaim_weakmap_test): Likewise.
* CMakeLists.txt [build_tests && enable_threads] (test_atomic_ops,
threadleaktest, subthreadcreate_test, initsecondarythread_test):
Specify test executable.
* CMakeLists.txt [build_tests && enable_threads && !WIN32]
(threadkey_test): Likewise.

4 years agoRefactoring of CMake script to use ANDROID/APPLE/CYGWIN/MSYS variables
Ivan Maidanski [Thu, 22 Aug 2019 20:30:34 +0000 (23:30 +0300)]
Refactoring of CMake script to use ANDROID/APPLE/CYGWIN/MSYS variables

* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT]: Replace
"HOST MATCHES .*-.*-android.*", "HOST MATCHES .*-.*-cygwin.*",
"HOST MATCHES .*-.*-darwin.*", "HOST MATCHES .*-.*-msys.*" with
ANDROID, CYGWIN, APPLE and MSYS variables, respectively; add comment
that ANDROID is defined only starting from cmake-3.7.0; remove
commented out darwin_threads variable assignment.

4 years agoCode refactoring of MAKE_BACK_GRAPH definition in CMake script
Ivan Maidanski [Thu, 22 Aug 2019 07:40:23 +0000 (10:40 +0300)]
Code refactoring of MAKE_BACK_GRAPH definition in CMake script
(refactoring of commit 32479d59c)

* CMakeLists.txt [enable_gc_debug] (MAKE_BACK_GRAPH, SRC): Remove
duplicate definition.

4 years agoFix cmake_minimum_required specification
Ivan Maidanski [Wed, 21 Aug 2019 21:56:22 +0000 (00:56 +0300)]
Fix cmake_minimum_required specification
(fix of commit e7dd50d19)

Otherwise CMake issues a warning about unset CMAKE_LEGACY_CYGWIN_WIN32
on Cygwin.

* CMakeLists.txt (cmake_minimum_required): Move the specification to
the top of the file.

4 years agoFix HOST determination in CMake script
Ivan Maidanski [Wed, 21 Aug 2019 21:48:30 +0000 (00:48 +0300)]
Fix HOST determination in CMake script

As per the configure script, HOST variable value should identify the
target, not build host.

* CMakeLists.txt (HOST): Set variable before find_package(Threads);
change message type to STATUS; report ${HOST} value as "TARGET".
* CMakeLists.txt (_HOST): Use CMAKE_SYSTEM_PROCESSOR instead
of CMAKE_HOST_SYSTEM_PROCESSOR; specify vendor as "unknown" (instead
of empty string); remove FIXME.

4 years agoCause fatal error in case of incompatible arguments passed to CMake script
Ivan Maidanski [Wed, 21 Aug 2019 21:38:42 +0000 (00:38 +0300)]
Cause fatal error in case of incompatible arguments passed to CMake script

* CMakeLists.txt [enable_checksums && (enable_munmap
|| enable_threads)]: Change message() type to FATAL_ERROR.

4 years agoFix tests build by CMake on Cygwin
Ivan Maidanski [Wed, 21 Aug 2019 08:52:23 +0000 (11:52 +0300)]
Fix tests build by CMake on Cygwin

* CMakeLists.txt [build_tests && WIN32] (de): Do not specify and add
"de" test executable if CYGWIN.

4 years agoAdd staticrootstest to CMake script
Ivan Maidanski [Wed, 21 Aug 2019 08:38:09 +0000 (11:38 +0300)]
Add staticrootstest to CMake script

* CMakeLists.txt [build_tests && !(BUILD_SHARED_LIBS && WIN32)]
(staticrootslib_test, staticrootslib2_test): Add library specification.
* CMakeLists.txt [build_tests && !(BUILD_SHARED_LIBS && WIN32)]
(staticrootstest): Add executable and test specification.
* CMakeLists.txt [build_tests && !(BUILD_SHARED_LIBS && WIN32)]
(staticrootslib2_test, staticrootstest): Specify target compile option.

4 years agoFix subexpression widening in memhash() of disclaim_weakmap_test
Ivan Maidanski [Wed, 21 Aug 2019 08:31:52 +0000 (11:31 +0300)]
Fix subexpression widening in memhash() of disclaim_weakmap_test
(fix of commit 0cc2c0e7e)

It would be more correct to widen the argument (from unsigned to
GC_word) of multiply operation instead of implicit widening of the
result.

* tests/disclaim_weakmap_test.c (memhash): Cast acc to GC_word before
multiplying by 2003; cast the whole expression to unsigned type (before
assigning it to acc).

4 years agoEliminate 'conversion from size_t to int' MSVC warning in cordprnt.c
Ivan Maidanski [Wed, 21 Aug 2019 08:13:36 +0000 (11:13 +0300)]
Eliminate 'conversion from size_t to int' MSVC warning in cordprnt.c

* cord/cordprnt.c (ec_len): Cast the expression to int explicitly.

4 years agoEliminate 'conversion from size_t to int' MSVC warning in subthread_create
Ivan Maidanski [Wed, 21 Aug 2019 08:08:11 +0000 (11:08 +0300)]
Eliminate 'conversion from size_t to int' MSVC warning in subthread_create
(fix of commit 0ccf1379e)

* tests/subthread_create.c [AO_HAVE_fetch_and_add1] (entry): Cast
result of AO_fetch_and_add1() to int explicitly.

4 years agoWorkaround 'condition (pred&1)==0 is always false' cppcheck false positive
Ivan Maidanski [Wed, 14 Aug 2019 09:42:08 +0000 (12:42 +0300)]
Workaround 'condition (pred&1)==0 is always false' cppcheck false positive

* backgraph.c [MAKE_BACK_GRAPH] (add_edge): Pass pred value via
COVERT_DATAFLOW() in ((word)pred&1)==0.

4 years agoFix 'condition pred!=NULL is always true' compiler warning
Ivan Maidanski [Wed, 14 Aug 2019 09:32:52 +0000 (12:32 +0300)]
Fix 'condition pred!=NULL is always true' compiler warning

Duplicate check of pred!=NULL is removed in add_edge.

* backgraph.c [MAKE_BACK_GRAPH] (add_edge): Remove pred!=NULL.

4 years agoTravis CI: Test CMake builds
Ivan Maidanski [Tue, 13 Aug 2019 08:19:52 +0000 (11:19 +0300)]
Travis CI: Test CMake builds

4 years agoFix gc_allocator.h compilation by Clang
Ivan Maidanski [Tue, 13 Aug 2019 08:05:06 +0000 (11:05 +0300)]
Fix gc_allocator.h compilation by Clang

Issue #273 (bdwgc).

Though clang may report __cplusplus as 201402L, it seems to be not
C++11 compliant fully.

* include/gc_allocator.h [!GC_ATTR_EXPLICIT && __clang__ && !CPPCHECK]
(GC_ATTR_EXPLICIT): Define to empty (instead of "explicit").
* tests/test_cpp.cc [!GC_ATTR_EXPLICIT && __clang__ && !CPPCHECK]
(GC_ATTR_EXPLICIT): Likewise.

4 years agoEliminate 'treating c input as c++ when in C++ mode' Clang warning (CMake)
Ivan Maidanski [Tue, 13 Aug 2019 07:48:28 +0000 (10:48 +0300)]
Eliminate 'treating c input as c++ when in C++ mode' Clang warning (CMake)

* CMakeLists.txt [build_tests && enable_cplusplus
&& !(BORLAND || MSVC || WATCOM)]: Add "-x c++" compile option.

4 years agoFix 'wrong finalization data' gctest failure on Windows
Ivan Maidanski [Fri, 2 Aug 2019 18:21:59 +0000 (21:21 +0300)]
Fix 'wrong finalization data' gctest failure on Windows
(fix of commit aefc738c1)

Issue #289 (bdwgc).

This commit workarounds some bug in MS compiler for x86 (v19.10.25017,
as of now) which causes generation of an incorrect code for
GC_normal_finalize_mark_proc() if code optimizations are on.

* finalize.c [_MSC_VER && I386] (GC_normal_finalize_mark_proc): Inline
GC_push_obj() manually; add comment.

4 years agoAppVeyor CI: Print .gc.log on gctest failure for mingw-shared-no-make
Ivan Maidanski [Tue, 30 Jul 2019 23:25:04 +0000 (02:25 +0300)]
AppVeyor CI: Print .gc.log on gctest failure for mingw-shared-no-make

4 years agoAppVeyor CI: Fix passing -D NO_MSGBOX_ON_ERROR to cmake build
Ivan Maidanski [Tue, 30 Jul 2019 23:07:47 +0000 (02:07 +0300)]
AppVeyor CI: Fix passing -D NO_MSGBOX_ON_ERROR to cmake build
(fix of commit a401e5475)

Space after -D is removed; %CFLAGS_EXTRA% are surrounded with double
quotes.

4 years agoFix passing CFLAGS_EXTRA to compiler in CMake script
Ivan Maidanski [Tue, 30 Jul 2019 23:01:57 +0000 (02:01 +0300)]
Fix passing CFLAGS_EXTRA to compiler in CMake script
(fix of commit b6ac6a5a4)

The previous solution does not work for MS VC target.

* CMakeLists.txt [CFLAGS_EXTRA] (CMAKE_C_FLAGS, CMAKE_CXX_FLAGS): Do
not set.
* CMakeLists.txt [CFLAGS_EXTRA]: Pass $(CFLAGS_EXTRA) to
add_compile_options.

4 years agoAppVeyor CI: Do not pass -v to cmake
Ivan Maidanski [Tue, 30 Jul 2019 22:17:05 +0000 (01:17 +0300)]
AppVeyor CI: Do not pass -v to cmake
(revert of commit 127d8be34)

Option -v is not supported by the cmake version on AppVeyor.

4 years agoAppVeyor CI: Pass -D NO_MSGBOX_ON_ERROR to CMake (MS VC) and MinGW builds
Ivan Maidanski [Tue, 30 Jul 2019 21:44:06 +0000 (00:44 +0300)]
AppVeyor CI: Pass -D NO_MSGBOX_ON_ERROR to CMake (MS VC) and MinGW builds

This prevents showing a dialog window on GC fatal errors.

4 years agoAppVeyor CI: Turn on verbose mode during cmake build
Ivan Maidanski [Tue, 30 Jul 2019 21:33:20 +0000 (00:33 +0300)]
AppVeyor CI: Turn on verbose mode during cmake build

4 years agoSupport CFLAGS_EXTRA to pass extra user-defined compiler flags (CMake)
Ivan Maidanski [Tue, 30 Jul 2019 08:40:57 +0000 (11:40 +0300)]
Support CFLAGS_EXTRA to pass extra user-defined compiler flags (CMake)

* CMakeLists.txt [CFLAGS_EXTRA] (CMAKE_C_FLAGS): Append $(CFLAGS_EXTRA).
* CMakeLists.txt [CFLAGS_EXTRA && enable_cplusplus] (CMAKE_CXX_FLAGS):
Likewise.

4 years agoFix test_cpp failure caused by arbitrary link order (Win32)
Ivan Maidanski [Fri, 26 Jul 2019 18:35:30 +0000 (21:35 +0300)]
Fix test_cpp failure caused by arbitrary link order (Win32)
(fix of commit 4a08ae983)

* Makefile.direct (test_cpp): Pass -D GC_NOT_DLL to $(CC) (except for
HP UX case).
* configure.ac [($enable_shared=no || $enable_static=yes)
&& $host=*-*-cygwin*|*-*-mingw*|*-*-msys*] (CXXFLAGS): Add
-D GC_NOT_DLL; add comment.

4 years agoPass -D GC_DLL -fvisibility=hidden if default configure build is requested
Ivan Maidanski [Fri, 26 Jul 2019 18:24:18 +0000 (21:24 +0300)]
Pass -D GC_DLL -fvisibility=hidden if default configure build is requested
(fix of commit c9964cfc0)

If --disable-shared and --enable-static are not passed to configure
then build generates only shared libraries, thus the internal symbols
visibility could be restricted.

* configure.ac [$enable_shared="" && $enable_static!=yes
|| $enable_shared=yes && $enable_static==""] (GC_DLL): Define AC macro.
* configure.ac [($enable_shared="" && $enable_static!=yes
|| $enable_shared=yes && $enable_static=="") && $GCC=yes
&& $ac_cv_fvisibility_hidden=yes] (CFLAGS): Add
-DGC_VISIBILITY_HIDDEN_SET -fvisibility=hidden.

4 years agoAppVeyor CI: Add builds based on NT_MAKEFILE
Ivan Maidanski [Thu, 25 Jul 2019 21:51:27 +0000 (00:51 +0300)]
AppVeyor CI: Add builds based on NT_MAKEFILE

4 years agoEliminate 'conversion from int to void*' MS VC warning in cordtest (x64)
Ivan Maidanski [Thu, 25 Jul 2019 21:28:09 +0000 (00:28 +0300)]
Eliminate 'conversion from int to void*' MS VC warning in cordtest (x64)

* cord/tests/cordtest.c (test_fn, test_basics): Cast 13 to void* thru
GC_word type.

4 years agoWorkaround 'typedef ignored on left of' MSVC warning in imagehlp.h (CMake)
Ivan Maidanski [Thu, 25 Jul 2019 07:07:58 +0000 (10:07 +0300)]
Workaround 'typedef ignored on left of' MSVC warning in imagehlp.h (CMake)

* CMakeLists.txt [enable_werror && MSVC]: Add /wd4091 compile option;
add comment.

4 years agoAppVeyor CI: Remove building redundant check-cpp target of Makefile.direct
Ivan Maidanski [Wed, 24 Jul 2019 22:39:48 +0000 (01:39 +0300)]
AppVeyor CI: Remove building redundant check-cpp target of Makefile.direct

Now check executes test_cpp, so check-cpp is a redundant target.

4 years agoTravis CI: Remove building redundant check-cpp target of Makefile.direct
Ivan Maidanski [Wed, 24 Jul 2019 22:19:54 +0000 (01:19 +0300)]
Travis CI: Remove building redundant check-cpp target of Makefile.direct

Now check executes test_cpp, so check-cpp is a redundant target.

4 years agoCompile gc.c unless building static libraries (NT_MAKEFILE, WCC_MAKEFILE)
Ivan Maidanski [Wed, 24 Jul 2019 21:55:22 +0000 (00:55 +0300)]
Compile gc.c unless building static libraries (NT_MAKEFILE, WCC_MAKEFILE)

This is to match the behavior of CMake and configure scripts.

* NT_MAKEFILE [!ENABLE_STATIC] (OBJS): Set to extra\gc.obj,
extra\msvc_dbg.obj.
* WCC_MAKEFILE (OBJS): Define only if ENABLE_STATIC.
* WCC_MAKEFILE [!ENABLE_STATIC] (gc.obj): New target.
* WCC_MAKEFILE [!ENABLE_STATIC] (gc.dll): Depend on and append gc.obj
instead of $(OBJS) elements.

4 years agoBuild cord.lib by Makefile.direct, NT_MAKEFILE, OS2_MAKEFILE, WCC_MAKEFILE
Ivan Maidanski [Wed, 24 Jul 2019 08:11:29 +0000 (11:11 +0300)]
Build cord.lib by Makefile.direct, NT_MAKEFILE, OS2_MAKEFILE, WCC_MAKEFILE

Note: Makefile.direct builds cord.a (not libcord.a or cord.lib).

* Makefile.direct: Update header comment about all and cords targets.
* Makefile.direct (all): Depend also on cords.
* Makefile.direct (cord.a): New target (duplicates cords target).
* Makefile.direct (cords): Do not depend on base_lib; create cord.a
instead of updating gc.a.
* Makefile.direct (cordtest, de): Depend on cords instead of
$(CORD_OBJS); pass cord.a (instead of $(CORD_OBJS)) to $(CC).
* NT_MAKEFILE (CFLAGS_MT): Move variable definition (which uses cvarsmt) to
be after CORDFLAG one.
* NT_MAKEFILE (CORDFLAG, COBJS): New variable.
* WCC_MAKEFILE (CORDFLAG, COBJS): Likewise.
* NT_MAKEFILE [!ENABLE_STATIC] (cvarsmt): Set variable value to empty;
add comment.
* NT_MAKEFILE (all): Depend also on cord.lib.
* OS2_MAKEFILE (all): Likewise.
* WCC_MAKEFILE (all): Likewise.
* NT_MAKEFILE (check): Depend also on cordtest.exe; run also cordtest.
* WCC_MAKEFILE (check): Likewise.
* NT_MAKEFILE (.c.obj): Remove -DCORD_NOT_DLL; add $(CORDFLAG).
* NT_MAKEFILE (cord.lib, cordtest.exe): New target.
* OS2_MAKEFILE (cord.lib, cordtest.exe, clean): Likewise.
* WCC_MAKEFILE (cord.lib, cordtest.exe, cordbscs.obj, cordxtra.obj,
cordprnt.obj, cordtest.obj): Likewise.
* WCC_MAKEFILE [!ENABLE_STATIC] (cord.dll): Likewise.
* NT_MAKEFILE (de.exe): Depend on cord.lib instead of cordbscs.obj and
cordxtra.obj.
* NT_MAKEFILE (clean): Delete cordtst*.tmp files; delete *.lib, *.dll,
and *.exp files instead of gc*.lib, gc*.dll, gc*.exp, cord\*.exe,
cord\*.exp, cord\*.lib, cord\*.pdb.
* README.md (Installation and Portability): Update information about
"make cords".

4 years agoFix gccpp.lib dependency in NT_MAKEFILE
Ivan Maidanski [Tue, 23 Jul 2019 21:51:35 +0000 (00:51 +0300)]
Fix gccpp.lib dependency in NT_MAKEFILE
(fix of commit 4a08ae983)

Also, update README that Makefile.direct creates cord.a now (instead
of adding cord files to gc.a).

* NT_MAKEFILE [!ENABLE_STATIC] (gccpp.lib): Add dependency on gc.lib.
* README.QUICK (INSTALLATION): Update information about "make cords".

4 years ago.gitignore: Ignore all *.a files in the base folder
Ivan Maidanski [Tue, 23 Jul 2019 21:42:21 +0000 (00:42 +0300)]
.gitignore: Ignore all *.a files in the base folder

4 years agoCompile msvc_dbg.c by CMake script (MS VC)
Ivan Maidanski [Mon, 22 Jul 2019 06:53:32 +0000 (09:53 +0300)]
Compile msvc_dbg.c by CMake script (MS VC)

* CMakeLists.txt [MSVC] (SRC): Add extra/msvc_dbg.c; add comment.

4 years agoReplace _M_AMD64 macro with _M_X64
Ivan Maidanski [Mon, 22 Jul 2019 06:40:29 +0000 (09:40 +0300)]
Replace _M_AMD64 macro with _M_X64
(code refactoring)

Also, adjust strcat_s usage in msvc_dbg.c.

* extra/msvc_dbg.c [_MSC_VER]: Check _M_X64 instead of _M_AMD64.
* tests/test.c [CPPCHECK && _MSC_VER] (main): Likewise.
* extra/msvc_dbg.c [_M_X64 && _MSC_VER<1200] (GetModuleBase): Use
strcat() instead of strcat_s().

4 years agoRename make_as_lib option to enable_static in NT_MAKEFILE and WCC_MAKEFILE
Ivan Maidanski [Fri, 19 Jul 2019 21:44:38 +0000 (00:44 +0300)]
Rename make_as_lib option to enable_static in NT_MAKEFILE and WCC_MAKEFILE

This is to match the behavior of CMake script.

* NT_MAKEFILE: Update header comment (rename make_as_lib to
enable_static).
* NT_MAKEFILE (MAKE_AS_LIB): Rename to ENABLE_STATIC.
* WCC_MAKEFILE (MAKE_AS_DLL): Remove (check "ndef ENABLE_STATIC"
instead).
* WCC_MAKEFILE (MAKE_AS_LIB): Rename to ENABLE_STATIC; update comment.
* doc/README.win32 (Microsoft Tools): Rename make_as_lib to
enable_static.
* doc/README.win64: Likewise.

4 years agoBuild shared libraries by default (WCC_MAKEFILE)
Ivan Maidanski [Fri, 19 Jul 2019 18:27:34 +0000 (21:27 +0300)]
Build shared libraries by default (WCC_MAKEFILE)

This is to match the behavior of CMake script.

* WCC_MAKEFILE (MAKE_AS_DLL): Uncomment.
* WCC_MAKEFILE (MAKE_AS_LIB): Comment out.

4 years agoRename nothreads option to disable_threads in NT_MAKEFILE
Ivan Maidanski [Fri, 19 Jul 2019 18:17:18 +0000 (21:17 +0300)]
Rename nothreads option to disable_threads in NT_MAKEFILE

* NT_MAKEFILE: Change nothreads=1 to disable_threads=1 in the header
comment.
* NT_MAKEFILE (CFLAGS_MT): Rename NOTHREADS to DISABLE_THREADS.
* doc/README.win32 (Microsoft Tools): Change nothreads=1 to
disable_threads=1.
* doc/README.win64: Likewise.

4 years agoBuild gccpp library by Makefile.direct, NT_MAKEFILE and WCC_MAKEFILE
Ivan Maidanski [Fri, 19 Jul 2019 17:42:38 +0000 (20:42 +0300)]
Build gccpp library by Makefile.direct, NT_MAKEFILE and WCC_MAKEFILE

* Makefile.direct: Update header comment about all, gc.a (base_lib),
c++, check, check-cpp targets.
* Makefile.direct (CXX): Refine comment.
* Makefile.direct (all): Depend also on c++.
* Makefile.direct (bsd-libgccpp.a): New target (duplicates bsd-libgc.a
one).
* Makefile.direct (bsd-libgc.a): Add a rename of gccpp.a to
bsd-libgccpp.a.
* Makefile.direct (BSD-pkg-install): Copy bsd-libgccpp.a file to
libgccpp.a, install the latter one.
* Makefile.direct (test_cpp): Depend on c++ instead of gc_cpp.o; pass
gccpp.a (instead of gc_cpp.o) to $(CXX).
* Makefile.direct (gccpp.a): New target (duplicates c++ one).
* Makefile.direct (c++): Do not depend on gc_cpp.h and base_lib;
create gccpp.a instead of updating gc.a.
* Makefile.direct (clean): Delete *.a files instead of gc.a.
* Makefile.direct (check): Depend also on test_cpp$(EXEEXT); run also
test_cpp.
* NT_MAKEFILE (LINK_GC, LINK_DLL_FLAGS): Remove variable.
* NT_MAKEFILE (OBJS): Remove gc_cpp.obj.
* NT_MAKEFILE (all, test_cpp.exe): Depend also on gccpp.lib.
* WCC_MAKEFILE (all, test_cpp.exe): Likewise.
* NT_MAKEFILE (gccpp.lib): New target (depending on gc_cpp.obj).
* WCC_MAKEFILE (gccpp.lib): Likewise.
* WCC_MAKEFILE [MAKE_AS_DLL] (gccpp.dll): Likewise.
* NT_MAKEFILE (test_cpp.exe): Pass gccpp.lib to $(link).
* WCC_MAKEFILE [MAKE_AS_LIB] (MAKE_AS_LIB): Set to -DGC_NOT_DLL.
* WCC_MAKEFILE (gc.lib): Do not depend gc_cpp.obj.
* WCC_MAKEFILE [MAKE_AS_DLL] (gc.lib): Do not add gc_cpp.obj to gc.lib.
* WCC_MAKEFILE [MAKE_AS_DLL] (gc.dll): Specify "op case".

4 years agoUpdate README.cmake regarding Unix, C++ and tests
Ivan Maidanski [Wed, 17 Jul 2019 08:52:26 +0000 (11:52 +0300)]
Update README.cmake regarding Unix, C++ and tests

Issue #105 (bdwgc).

* doc/README.cmake: Mention that Unix targets are also supported;
remove not that support is not yet complete; update the list of
supported targets (that CMake is able to generate for); use Visual
Studio 9 instead of Visual Studio 8 in the examples; document
enable_cplusplus and build_tests options; provide an example with
--config option; change "build" artifacts folder to "out" one in
the example.

4 years agoRemove gc.mak script (MS VC)
Ivan Maidanski [Wed, 17 Jul 2019 08:39:26 +0000 (11:39 +0300)]
Remove gc.mak script (MS VC)

Issue #105 (bdwgc).

CMake script or NT_MAKEFILE should be used instead of gc.mak.

* ChangeLog (8.1.0): Remove item about gc.mak.
* Makefile.am (EXTRA_DIST): Remove gc.mak.
* gc.mak: Remove file.
* doc/README.win32 (Threads): Remove gc.mak usage information; mention
that CMake script is the preferred way of building for Windows.

4 years ago.gitattributes: Update after BCC_MAKEFILE removal
Ivan Maidanski [Wed, 17 Jul 2019 07:31:46 +0000 (10:31 +0300)]
.gitattributes: Update after BCC_MAKEFILE removal

Issue #105 (bdwgc).

4 years agoRemove Borland-specific Makefile (BCC_MAKEFILE)
Ivan Maidanski [Wed, 17 Jul 2019 07:29:36 +0000 (10:29 +0300)]
Remove Borland-specific Makefile (BCC_MAKEFILE)

Issue #105 (bdwgc).

CMake script should be used instead of BCC_MAKEFILE.

* BCC_MAKEFILE: Remove file.
* Makefile.am (EXTRA_DIST): Remove BCC_MAKEFILE.
* doc/README.win32 (Borland Tools): Remove "rarely tested" note; change
BCC_MAKEFILE to cmake -G "Borland Makefiles"; remove note that
Borland 5.5 is assumed.

4 years agoEnable CMake-based build for Borland and Watcom compilers
Ivan Maidanski [Wed, 17 Jul 2019 07:08:12 +0000 (10:08 +0300)]
Enable CMake-based build for Borland and Watcom compilers

Issue #105 (bdwgc).

* CMakeLists.txt [BORLAND] (add_compile_options): Specify /a4 and
/w /w-pro /w-aus /w-par /w-ccc /w-inl /w-rch; add comment.
* CMakeLists.txt [WATCOM] (add_compile_options): Specify /zp4 and /wx.
* CMakeLists.txt [enable_werror && BORLAND] (add_compile_options):
Specify /w!.
* CMakeLists.txt [enable_werror && WATCOM] (add_compile_options):
Specify /we.
* CMakeLists.txt [!enable_single_obj_compilation && !BUILD_SHARED_LIBS
&& BORLAND] (add_compile_options): Specify /w-use; add comment.
* CMakeLists.txt [build_tests && WATCOM] (gctest): Specify /wcd=13
/wcd=201 /wcd=367 /wcd=368 /wcd=726 target compile options; add comment.
* doc/README.win32 (Watcom compiler): Mention that OpenWatcom 2.0 is
tested on; remove note that cord is not ported; add note about the
new way to build the collector using CMake script.