platform/upstream/libgc.git
6 years agoFix missing curses.h in cord/de when compiling manually (MS VC, MinGW)
Ivan Maidanski [Fri, 7 Sep 2018 17:49:32 +0000 (20:49 +0300)]
Fix missing curses.h in cord/de when compiling manually (MS VC, MinGW)

* cord/tests/de.c [__MINGW32__ || __NT__ || _WIN32] (WIN32): Define.

6 years agoEliminate 'different const qualifiers' MS VC warnings in cordbscs
Ivan Maidanski [Thu, 6 Sep 2018 08:29:15 +0000 (11:29 +0300)]
Eliminate 'different const qualifiers' MS VC warnings in cordbscs
(fix of commit 2e7daad62)

* cord/cordbscs.c (CORD_cat_char_star, CORD_cat): Cast the first
argument of GC_PTR_STORE_AND_DIRTY() to void*.

6 years agoTravis CI: Output content of disclaim_test.log
Ivan Maidanski [Thu, 6 Sep 2018 07:19:49 +0000 (10:19 +0300)]
Travis CI: Output content of disclaim_test.log

6 years agoBump libgc version (for development of 8.2 release)
Ivan Maidanski [Thu, 6 Sep 2018 07:16:32 +0000 (10:16 +0300)]
Bump libgc version (for development of 8.2 release)

* README.md: Restore build status badges (Travis, AppVeyor, Codecov,
Coveralls, Coverity, LGTM).
* README.md: Bump version to 8.1.0.
* configure.ac: Likewise.
* include/gc_version.h (GC_TMP_VERSION_MINOR): Likewise.

6 years ago[8.0.0] v8.0.0
Ivan Maidanski [Tue, 4 Sep 2018 22:07:03 +0000 (01:07 +0300)]
[8.0.0]

Bump gc version to 8.0.0 (experimental release)

* ChangeLog (8.0.0): Set release date.
* Makefile.am (LIBGC_VER_INFO): Increment revision (change version info
of libgc.so to 5:1:4).
* Makefile.am (LIBGCCPP_VER_INFO): Increment current and age (change
version info of libgccpp.so to 5:0:4).
* README.md: Bump major version (set minor and micro to 0).
* configure.ac (AC_INIT): Likewise.
* include/gc_version.h (GC_TMP_VERSION_MAJOR, GC_TMP_VERSION_MINOR,
GC_TMP_VERSION_MICRO): Likewise.
* README.md: Remove build status badges (Travis, AppVeyor, Codecov,
Coveralls, Coverity, LGTM).
* cord/cord.am (LIBCORD_VER_INFO): Increment current and age (change
version info of libcord.so to 5:0:4).

6 years agoUpdate ChangeLog file
Ivan Maidanski [Tue, 4 Sep 2018 21:47:41 +0000 (00:47 +0300)]
Update ChangeLog file

6 years agoReally fix 'potential unsafe sign check of a bitwise operation' code defect
Ivan Maidanski [Tue, 4 Sep 2018 21:45:41 +0000 (00:45 +0300)]
Really fix 'potential unsafe sign check of a bitwise operation' code defect
(fix of commit af00c4d)

* mark.c [!OS2] (GC_mark_from): Replace (signed_word)v>=0 to (v&SIGNB)==0
(anyway, the compiler generates the same code).

6 years agoAdd Codecov.io badge to README
Ivan Maidanski [Tue, 4 Sep 2018 07:11:29 +0000 (10:11 +0300)]
Add Codecov.io badge to README

6 years agoTravis CI: Send code coverage reports to Codecov as well
Ivan Maidanski [Tue, 4 Sep 2018 07:10:04 +0000 (10:10 +0300)]
Travis CI: Send code coverage reports to Codecov as well

6 years agoFix comment typos in backgraph.c, de.c, gcconfig.h
Max Mouratov [Sun, 2 Sep 2018 20:08:43 +0000 (01:08 +0500)]
Fix comment typos in backgraph.c, de.c, gcconfig.h

* ChangeLog (5.0alpha6): Fix typo ("DATASTART").
* include/private/gcconfig.h: Likewise.
* backgraph.c: Fix typo in comment ("If").
* cord/tests/de.c: Fix typo in comment ("Unbounded").

6 years agoReplace some FIXME items with TODO ones
Ivan Maidanski [Fri, 31 Aug 2018 20:22:15 +0000 (23:22 +0300)]
Replace some FIXME items with TODO ones
(code refactoring)

* alloc.c (GC_maybe_gc, GC_collect_a_little_inner,
GC_finish_collection): Replace FIXME item with TODO one.
* gcj_mlc.c (maybe_finalize): Likewise.
* include/gc.h [!GC_DEBUG || !__GNUC__] (GC_PTR_ADD): Likewise.
* include/private/gcconfig.h [X86_64 && LINUX && __GLIBC__
&& !__UCLIBC__] (GETCONTEXT_FPU_EXCMASK_BUG): Likewise.
* mach_dep.c (GC_with_callee_saves_pushed): Likewise.
* mark_rts.c (GC_push_current_stack): Likewise.
* misc.c [MSWIN32 || MSWINCE] (WRITE): Likewise.
* os_dep.c [ECOS] (ecos_gc_memory): Likewise.
* os_dep.c (GC_get_stack_base, GC_page_was_ever_dirty): Likewise.
* reclaim.c (GC_reclaim_clear): Likewise.
* include/private/gcconfig.h [OPENBSD && m68k]: Remove FIXME item.

6 years agoEliminate 'unused variable old_maps_size' compiler warning in get_maps
Ivan Maidanski [Fri, 31 Aug 2018 20:06:56 +0000 (23:06 +0300)]
Eliminate 'unused variable old_maps_size' compiler warning in get_maps
(fix of commit b3eee14)

* os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Do not declare old_maps_size
local variable unless THREADS.

6 years agoRemove MIN_WORDS macro from gc_priv.h
Ivan Maidanski [Fri, 31 Aug 2018 19:38:52 +0000 (22:38 +0300)]
Remove MIN_WORDS macro from gc_priv.h
(code refactoring)

* include/private/gc_priv.h (MIN_WORDS): Move macro to test.c; remove
FIXME.
* tests/test.c: Update comment for include gc_priv.h.

6 years agoWorkaround 'bad pointer arithmetic' false waring in check_annotated_obj
Ivan Maidanski [Fri, 31 Aug 2018 17:00:33 +0000 (20:00 +0300)]
Workaround 'bad pointer arithmetic' false waring in check_annotated_obj

* dbg_mlc.c [!SHORT_DBG_HDRS] (GC_check_annotated_obj): Change
(word*)ptr+ofs expressions to &((word*)ptr)[ofs].

6 years agoEliminate 'potential unsafe sign check of a bitwise operation' code defect
Ivan Maidanski [Fri, 31 Aug 2018 16:14:18 +0000 (19:14 +0300)]
Eliminate 'potential unsafe sign check of a bitwise operation' code defect

* mark.c [!OS2] (GC_mark_from): Cast mark_stack_top-mark_stack to word
first, and cast bitwise OR operation result to signed_word, so that not
to apply bitwise OR operation to the value of ptrdiff_t.

6 years agoEliminate 'comparison is always false' code defect in get_maps
Ivan Maidanski [Fri, 31 Aug 2018 16:06:27 +0000 (19:06 +0300)]
Eliminate 'comparison is always false' code defect in get_maps

In case of a single-threaded build, the comparison is always false
because maps_size>=0 and old_maps_size<=0.

* os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Do not evaluate
maps_size<old_maps_size inside while expression if THREADS; remove
comment.

6 years agoEliminate 'poor global variable name' code defect in typd_mlc
Ivan Maidanski [Thu, 30 Aug 2018 19:20:25 +0000 (22:20 +0300)]
Eliminate 'poor global variable name' code defect in typd_mlc
(fix of commit a825a2d)

* typd_mlc.c (ld, ad, sd): Remove unused global variables.

6 years agoAdd LGTM.com code quality badges to README.md
Ivan Maidanski [Thu, 30 Aug 2018 13:39:12 +0000 (16:39 +0300)]
Add LGTM.com code quality badges to README.md

6 years agoUpdate AUTHORS file (add Demyan Kimitsa)
Ivan Maidanski [Thu, 30 Aug 2018 13:34:20 +0000 (16:34 +0300)]
Update AUTHORS file (add Demyan Kimitsa)

6 years agoFix start_world not resuming all threads on Darwin
Demyan Kimitsa [Tue, 28 Aug 2018 16:40:47 +0000 (19:40 +0300)]
Fix start_world not resuming all threads on Darwin

Issue #231 (bdwgc).

This happens due mach thread ports are released in GC_stop_world as
a result in some cases the system creates new one and GC_start_world
will not find the thread to resume; in turn, the threads will stay
suspended.  When this happens to GDC threads, the application is
terminated as the message loop is halt.

The high-level description of the change: thread mach port is not
deallocated when thread is saved in GC_mach_threads as it causes thread
not being resumed as thread port object can be changed; threads are now
being suspended without check of suspend_count (as it can be suspended
by client); the logic of resume is changed, now the primary cycle
iterates threads to resume in GC_mach_threads.

* darwin_stop_world.c (struct GC_mach_thread): Rename already_suspended
filed to suspended.
* darwin_stop_world.c [!GC_NO_THREADS_DISCOVERY]
(GC_suspend_thread_list): Add my_task argument; remove info an outCount
local variables; call mach_port_deallocate uless threaded is added to
GC_mach_threads; do not call thread_info; update the relevant comments.
* darwin_stop_world.c [!GC_NO_THREADS_DISCOVERY] (GC_stop_world):
Remove i local variable; do not call mach_port_deallocate for prevlist
items; add comment.
* darwin_stop_world.c (GC_thread_resume): Call WARN instead of ABORT
if thread_resume failed.
* darwin_stop_world.c [!GC_NO_THREADS_DISCOVERY] (GC_start_world):
Initialize j to listcount; iterate over GC_mach_threads in the outer
loop; if thread is suspended then find it in act_list; if found then
resume thread; call mach_port_deallocate for act_list items.

6 years agoFix indentation of 'define GC_DATAEND' in gc.h
Ivan Maidanski [Fri, 17 Aug 2018 16:45:44 +0000 (19:45 +0300)]
Fix indentation of 'define GC_DATAEND' in gc.h
(fix of commit 4e24d219d)

* include/gc.h [__CYGWIN__ && !__x86_64__] (GC_DATAEND): Fix
indentation.

6 years agoTravis CI: Fix missing semicolon at the end of GNU_DOWNLOAD_SITE assignment
Ivan Maidanski [Wed, 15 Aug 2018 16:52:36 +0000 (19:52 +0300)]
Travis CI: Fix missing semicolon at the end of GNU_DOWNLOAD_SITE assignment
(fix of commit a9690ac)

6 years agoUpdate ChangeLog file (add v7.6.8 release date)
Ivan Maidanski [Wed, 15 Aug 2018 16:47:59 +0000 (19:47 +0300)]
Update ChangeLog file (add v7.6.8 release date)

6 years agoTravis CI: Put GNU S/W download base URL in a dedicated variable
Ivan Maidanski [Wed, 15 Aug 2018 16:43:12 +0000 (19:43 +0300)]
Travis CI: Put GNU S/W download base URL in a dedicated variable
(code refactoring)

6 years agoUpdate ChangeLog file
Ivan Maidanski [Wed, 15 Aug 2018 16:36:00 +0000 (19:36 +0300)]
Update ChangeLog file

6 years agoRemove redundant checking of CPPCHECK macro in gc_cpp.h
Ivan Maidanski [Wed, 15 Aug 2018 16:33:18 +0000 (19:33 +0300)]
Remove redundant checking of CPPCHECK macro in gc_cpp.h
(fix of commit 5e51e8d)

Issue #229 (bdwgc).

* include/gc_cpp.h [(_MSC_VER || __DMC__ || (__CYGWIN32__ || __CYGWIN__
|| __MINGW32__) && !GC_BUILD && !GC_NOT_DLL) && __cplusplus>201103L
&& GC_OPERATOR_NEW_ARRAY] (operator delete[](void*,size_t)): Define
even in case of CPPCHECK.

6 years agoFix delete operator redirection if gc_cpp is built as .dll (Cygwin, MinGW)
Ivan Maidanski [Wed, 15 Aug 2018 07:23:33 +0000 (10:23 +0300)]
Fix delete operator redirection if gc_cpp is built as .dll (Cygwin, MinGW)

Issue #229 (bdwgc).

* include/gc_cpp.h [(__CYGWIN32__ || __CYGWIN__ || __MINGW32__)
&& !GC_BUILD && !GC_NOT_DLL && GC_OPERATOR_NEW_ARRAY] (operator new[],
operator delete[]): Define inline function.
* include/gc_cpp.h [(__CYGWIN32__ || __CYGWIN__ || __MINGW32__)
&& !GC_BUILD && !GC_NOT_DLL] (operator new, operator delete): Likewise.
* include/gc_cpp.h [_MSC_VER || __DMC__ || (__CYGWIN32__ || __CYGWIN__
|| __MINGW32__) && !GC_BUILD && !GC_NOT_DLL && __cplusplus>201103L]
(operator delete(void*,size_t)): Likewise.
* include/gc_cpp.h [_MSC_VER || __DMC__ || (__CYGWIN32__ || __CYGWIN__
|| __MINGW32__) && !GC_BUILD && !GC_NOT_DLL && __cplusplus>201103L
&& GC_OPERATOR_NEW_ARRAY && !CPPCHECK]
(operator delete[](void*,size_t)): Likewise.
* include/gc_cpp.h (operator new(size_t, int, const char*, int),
operator new[](size_t, int, const char*, int)): Do not define
for __DMC__.

6 years agoFix 'undefined reference to GC_incremental' linker error in pthread_start
Ivan Maidanski [Wed, 15 Aug 2018 06:29:23 +0000 (09:29 +0300)]
Fix 'undefined reference to GC_incremental' linker error in pthread_start
(fix of commit 73d30d2)

GC_incremental is declared as static in case of NO_DEBUGGING.

* pthread_start.c [GC_PTHREADS && !GC_WIN32_THREADS]
(GC_inner_start_routine): Call GC_end_stubborn_change instead of
GC_dirty; add comment.

6 years agoUse include gc.h with the angle brackets in the man page synopsis
Ivan Maidanski [Wed, 15 Aug 2018 06:21:29 +0000 (09:21 +0300)]
Use include gc.h with the angle brackets in the man page synopsis

* doc/gc.man (.TH): Update the date.
* doc/gc.man (SYNOPSIS): Replace include "gc.h" to include <gc.h>.

6 years agoTravis CI: Use TEST_MANUAL_VDB instead of MANUAL_VDB
Ivan Maidanski [Tue, 14 Aug 2018 21:52:57 +0000 (00:52 +0300)]
Travis CI: Use TEST_MANUAL_VDB instead of MANUAL_VDB

6 years agoNew API to turn on manual VDB at runtime
Ivan Maidanski [Tue, 14 Aug 2018 21:50:59 +0000 (00:50 +0300)]
New API to turn on manual VDB at runtime

Manual VDB is now enabled by GC_set_manual_vdb_allowed(1) if called
before entering the GC incremental mode.

* alloc.c (GC_allocobj): Expand TRUE_INCREMENTAL macro.
* darwin_stop_world.c [MPROTECT_VDB] (GC_stop_world, GC_start_world):
Use GC_auto_incremental instead of GC_incremental.
* mark.c (alloc_mark_stack): Likewise.
* mark.c [PROC_VDB] (GC_push_all): Likewise.
* mark.c [!NEED_FIXUP_POINTER && THREADS && MPROTECT_VDB]
(GC_push_all_stack): Likewise.
* pthread_support.c [CAN_HANDLE_FORK && GC_DARWIN_THREADS
&& MPROTECT_VDB] (GC_atfork_prepare): Likewise.
* win32_threads.c [MPROTECT_VDB && !CYGWIN32]
(GC_register_my_thread_inner): Likewise.
* win32_threads.c [MPROTECT_VDB] (UNPROTECT_THREAD): Likewise.
* doc/gcdescr.md (Generational Collection and Dirty Bits): Update
documentation for the manual VDB.
* include/gc.h (GC_end_stubborn_change): Update comment.
* mark_rts.c (GC_push_all_stack_partially_eager): Likewise.
* include/gc.h (GC_set_manual_vdb_allowed, GC_get_manual_vdb_allowed):
New public function.
* include/private/gc_priv.h (GC_grungy_pages, GC_dirty_pages): Define
for all VDB modes.
* include/private/gc_priv.h (GC_auto_incremental, GC_manual_vdb):
Define.
* include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL] (GC_dirty): Use
GC_manual_vdb instead of GC_incremental.
* include/private/gcconfig.h (GWW_VDB, MPROTECT_VDB, PCR_VDB): Do not
undefine if MANUAL_VDB.
* mallocx.c (GC_generic_malloc_many): Always allocate a single object
(and call GC_dirty_inner/REACHABLE_AFTER_DIRTY) if GC_manual_vdb.
* misc.c [!CAN_HANDLE_FORK && DARWIN && MPROTECT_VDB && !THREADS
&& !SMALL_CONFIG] (GC_set_handle_fork): Do not ABORT if GC_manual_vdb.
* misc.c [!SMALL_CONFIG] (manual_vdb_allowed): New static variable.
* misc.c [!SMALL_CONFIG] (GC_set_manual_vdb_allowed,
GC_get_manual_vdb_allowed): Implement.
* misc.c [!CHECKSUMS && !SMALL_CONFIG] (GC_init,
GC_enable_incremental): Set GC_manual_vdb and GC_incremental to true
if manual_vdb_allowed; do not call GC_dirty_init if manual_vdb_allowed.
* os_dep.c: Update comment about MANUAL_VDB.
* os_dep.c [MANUAL_VDB] (GC_dirty_init,
async_set_pht_entry_from_index): Remove.
* os_dep.c [!GC_DISABLE_INCREMENTAL] (GC_manual_vdb): Define global
variable.
* os_dep.c [!GC_DISABLE_INCREMENTAL] (GC_dirty_inner): Define
regardless of the VDB mode; add FIXME.
* os_dep.c [!GC_DISABLE_INCREMENTAL] (GC_read_dirty, GC_page_was_dirty,
GC_remove_protection): Implement for the case of GC_manual_vdb is true;
do not depend on MANUAL_VDB.
* tests/disclaim_test.c [TEST_MANUAL_VDB] (main): Call
GC_set_manual_vdb_allowed(1) before GC_INIT.
* tests/staticrootslib.c [TEST_MANUAL_VDB] (libsrl_init): Likewise.
* tests/test_cpp.cc [TEST_MANUAL_VDB] (main): Likewise.
* tests/test.c (INIT_MANUAL_VDB_ALLOWED): New macro.
* tests/test.c (GC_COND_INIT): Invoke INIT_MANUAL_VDB_ALLOWED (before
GC_OPT_INIT).
* tests/test.c [!SMALL_CONFIG] (main): Call GC_get_manual_vdb_allowed.

6 years agoUpdate ChangeLog file (add v7.4.14 release date)
Ivan Maidanski [Sat, 11 Aug 2018 12:43:13 +0000 (15:43 +0300)]
Update ChangeLog file (add v7.4.14 release date)

6 years agoUpdate ChangeLog file (add v7.2l release date)
Ivan Maidanski [Fri, 10 Aug 2018 15:52:35 +0000 (18:52 +0300)]
Update ChangeLog file (add v7.2l release date)

6 years agoUpdate AUTHORS file
Ivan Maidanski [Tue, 7 Aug 2018 08:59:01 +0000 (11:59 +0300)]
Update AUTHORS file

6 years agoInitial single-threaded support of Interix subsystem
Martin Koeppe [Tue, 7 Aug 2018 08:55:23 +0000 (11:55 +0300)]
Initial single-threaded support of Interix subsystem

* include/private/gc_priv.h [__INTERIX] (_ALL_SOURCE): Define macro.
* include/private/gcconfig.h [__INTERIX] (I386, INTERIX,
mach_type_known): Likewise.
* include/private/gcconfig.h [I386 && INTERIX] (OS_TYPE, DATASTART,
DATAEND, STACKBOTTOM, USE_MMAP, USE_MMAP_ANON): Likewise.
* include/private/gcconfig.h [I386 && INTERIX] (_data_start__,
_bss_end__): Declare extern variable.

6 years agoUpdate ChangeLog file
Ivan Maidanski [Mon, 6 Aug 2018 20:19:59 +0000 (23:19 +0300)]
Update ChangeLog file

6 years agoUpdate ChangeLog file (v7.6 changes)
Ivan Maidanski [Mon, 6 Aug 2018 19:01:35 +0000 (22:01 +0300)]
Update ChangeLog file (v7.6 changes)

6 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Mon, 6 Aug 2018 18:37:53 +0000 (21:37 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

6 years agoConsistently use AS_HELP_STRING for configure new options
Ivan Maidanski [Fri, 3 Aug 2018 18:30:39 +0000 (21:30 +0300)]
Consistently use AS_HELP_STRING for configure new options
(code refactoring)

* configure.ac (thread-local-alloc, threads-discovery, mmap,
dynamic-loading, register-main-static-data, gcov): Replace deprecated
AC_HELP_STRING to AS_HELP_STRING.

6 years agoFix incorrect roots order after root removal in remove_roots_subregion
Ivan Maidanski [Fri, 3 Aug 2018 16:43:18 +0000 (19:43 +0300)]
Fix incorrect roots order after root removal in remove_roots_subregion
(fix of commits 38d194a, e849b45)

Issue #218 (bdwgc).

* mark_rts.c [USE_PROC_FOR_LIBRARIES] (swap_static_roots): New inline
function.
* mark_rts.c [USE_PROC_FOR_LIBRARIES] (GC_remove_roots_subregion):
Use swap_static_roots (after GC_add_roots_inner); if there is
a temporary root after GC_remove_root_at_pos then swap it with the
appropriate non-temporary one to ensure all temporary roots are
grouped at the end.

6 years agoFix the build for Emscripten
Josh Peterson [Wed, 1 Aug 2018 21:00:56 +0000 (00:00 +0300)]
Fix the build for Emscripten
(part of commit 0f9ef2d from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* mark_rts.c [!CPPCHECK && __GNUC__>=4] (GC_approx_sp): Do not use
__builtin_frame_address if STACK_NOT_SCANNED.

6 years agoFix the build for N3DS
Josh Peterson [Wed, 1 Aug 2018 20:53:06 +0000 (23:53 +0300)]
Fix the build for N3DS
(part of commit 0f9ef2d from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* include/gc.h [GC_BUILD && NN_PLATFORM_CTR] (GC_on_thread_event_proc):
Define type.
* include/private/gc_locks.h [NN_PLATFORM_CTR || NINTENDO_SWITCH]
(GC_lock, GC_unlock): Declare function.
* include/private/gc_locks.h [NN_PLATFORM_CTR || NINTENDO_SWITCH]
(UNCOND_LOCK, UNCOND_UNLOCK): Define macro.
* include/private/gc_priv.h [THREADS && !SN_TARGET_ORBIS
&& !SN_TARGET_PSP2]: Do not include gc_atomic_ops.h if NN_PLATFORM_CTR.
* pthread_support.c [USE_SPIN_LOCK || !NO_PTHREAD_TRYLOCK] (GC_pause):
Call GC_noop1 instead of AO_compiler_barrier unless AO_CLEAR defined.

6 years agoUpdate AUTHORS file (add Josh Peterson)
Ivan Maidanski [Wed, 1 Aug 2018 19:31:08 +0000 (22:31 +0300)]
Update AUTHORS file (add Josh Peterson)

6 years agoFix the build for Orbis and PSP2
Josh Peterson [Wed, 1 Aug 2018 19:27:59 +0000 (22:27 +0300)]
Fix the build for Orbis and PSP2
(part of commit 0f9ef2d from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* include/private/pthread_stop_world.h [!GC_OPENBSD_UTHREADS && !NACL]
(thread_stop_info): Do not define last_stop_count if SN_TARGET_ORBIS
or SN_TARGET_PSP2.
* include/private/pthread_stop_world.h [!NACL && SN_TARGET_ORBIS]
(thread_stop_info): Declare registers field.

6 years agoFix compilation of darwin_stop_world for iOS 8+
Jonas Echterhoff [Tue, 31 Jul 2018 20:19:45 +0000 (23:19 +0300)]
Fix compilation of darwin_stop_world for iOS 8+
(part of commit c6e7e36 from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* darwin_stop_world.c [ARM32 && ARM_THREAD_STATE32]
(GC_stack_range_for): Set state to unified_state instead of
unified_state.ts_32.

6 years agoFix more compilation issues for XboxOne
Jonas Echterhoff [Tue, 31 Jul 2018 14:07:26 +0000 (17:07 +0300)]
Fix more compilation issues for XboxOne
(part of commit c6e7e36 from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* include/private/gc_priv.h [!CPPCHECK && !PCR && MSWIN_XBOX1
&& !DebugBreak] (DebugBreak): Define to __debugbreak.
* misc.c [MSWIN32] (GC_win32_MessageBoxA): Do not define if MSWIN_XBOX1.
* misc.c [!PCR && !SMALL_CONFIG && MSWIN32] (GC_default_on_abort): Do
not call GC_win32_MessageBoxA() if MSWINRT_FLAVOR or MSWIN_XBOX1.

6 years agoAllow register_main_static_data disabling in CMake script
Ivan Maidanski [Tue, 31 Jul 2018 06:58:31 +0000 (09:58 +0300)]
Allow register_main_static_data disabling in CMake script

* CMakeLists.txt (enable_register_main_static_data): New OPTION (on by
default).
* CMakeLists.txt [!enable_register_main_static_data]: Define
GC_DONT_REGISTER_MAIN_STATIC_DATA macro.

6 years agoAllow dynamic_loading disabling in CMake script
Ivan Maidanski [Tue, 31 Jul 2018 06:40:22 +0000 (09:40 +0300)]
Allow dynamic_loading disabling in CMake script

* CMakeLists.txt (enable_dynamic_loading): New OPTION (on by default).
* CMakeLists.txt [!enable_dynamic_loading]: Define
IGNORE_DYNAMIC_LOADING macro.

6 years agoAllow mmap enabling in CMake script
Ivan Maidanski [Tue, 31 Jul 2018 06:32:27 +0000 (09:32 +0300)]
Allow mmap enabling in CMake script

* CMakeLists.txt (enable_mmap): New OPTION (off by default).
* CMakeLists.txt [!enable_munmap && enable_mmap]: Define USE_MMAP macro.

6 years agoAllow threads_discovery disabling in CMake script
Ivan Maidanski [Mon, 30 Jul 2018 20:58:21 +0000 (23:58 +0300)]
Allow threads_discovery disabling in CMake script

* CMakeLists.txt (enable_threads_discovery): New OPTION (on by default).
* CMakeLists.txt [!enable_threads_discovery]: Define
GC_NO_THREADS_DISCOVERY macro.

6 years agoFix wrong expression for ENDIF in CMakeLists.txt
Ivan Maidanski [Mon, 30 Jul 2018 20:34:19 +0000 (23:34 +0300)]
Fix wrong expression for ENDIF in CMakeLists.txt
(fix of commit 1aabce0f9)

* CMakeLists.txt [enable_checksums]: Remove enable_threads for ENDIF.

6 years agoDefine DYNAMIC_LOADING for Darwin unless IGNORE_DYNAMIC_LOADING
Ivan Maidanski [Mon, 30 Jul 2018 07:59:56 +0000 (10:59 +0300)]
Define DYNAMIC_LOADING for Darwin unless IGNORE_DYNAMIC_LOADING

DYNAMIC_LOADING macro is now controlled by
configure --disable-dynamic-loading option.

* include/private/gcconfig.h [DARWIN && (I386 || AARCH64 || ARM32
|| X86_64)] (DYNAMIC_LOADING): Define even if
GC_DONT_REGISTER_MAIN_STATIC_DATA.

6 years agoNew configure --disable-register-main-static-data option
Michael DeRoy [Mon, 30 Jul 2018 07:48:00 +0000 (10:48 +0300)]
New configure --disable-register-main-static-data option
(part of commit 6be3fb4 from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* configure.ac (register-main-static-data): New AC_ARG_ENABLE.
* configure.ac [$enable_register_main_static_data=no]
(GC_DONT_REGISTER_MAIN_STATIC_DATA): Define AC macro.

6 years agoNew configure --disable-dynamic-loading option
Michael DeRoy [Mon, 30 Jul 2018 06:39:49 +0000 (09:39 +0300)]
New configure --disable-dynamic-loading option
(part of commit 6be3fb4 from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* configure.ac (dynamic-loading): New AC_ARG_ENABLE.
* configure.ac [$enable_dynamic_loading=no] (IGNORE_DYNAMIC_LOADING):
Define AC macro.

6 years agoNew configure --enable-mmap option
Michael DeRoy [Mon, 30 Jul 2018 06:19:33 +0000 (09:19 +0300)]
New configure --enable-mmap option
(part of commit 6be3fb4 from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* configure.ac (mmap): New AC_ARG_ENABLE (store the result to
gc_use_mmap).

6 years agoAdjust formatting of configure help messages and config.h comments
Ivan Maidanski [Sun, 29 Jul 2018 08:02:36 +0000 (11:02 +0300)]
Adjust formatting of configure help messages and config.h comments

* configure.ac (getcontext, execinfo.h, setjmp.h, GC_BUILTIN_ATOMIC):
Add trailing dot in AC_DEFINE comment message.
* configure.ac (gcj-support, java-finalization, atomic-uncollectable,
disclaim): Remove trailing dot in AC_HELP_STRING help message.
* configure.ac (gcj-support, sigrt-signals, java-finalization,
atomic-uncollectable, redirect-malloc, disclaim, large-config,
handle-fork, munmap, checksums, werror, single-obj-compilation,
gcov, docs): Start AC_HELP_STRING help message with a lowercase letter.
* configure.ac (werror): Wrap help message into AS_HELP_STRING.

6 years agoUpdate AUTHORS file (add Michael DeRoy)
Ivan Maidanski [Sun, 29 Jul 2018 07:21:04 +0000 (10:21 +0300)]
Update AUTHORS file (add Michael DeRoy)

6 years agoNew configure --disable-threads-discovery option
Michael DeRoy [Sat, 28 Jul 2018 15:09:06 +0000 (18:09 +0300)]
New configure --disable-threads-discovery option
(part of commit 7b2813c from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* configure.ac (threads-discovery): New AC_ARG_ENABLE.
* configure.ac [$enable_threads_discovery=no]
(GC_NO_THREADS_DISCOVERY): Define macro.

6 years agoTravis CI: Output content of disclaim_bench.log
Ivan Maidanski [Sat, 28 Jul 2018 08:45:10 +0000 (11:45 +0300)]
Travis CI: Output content of disclaim_bench.log

6 years agoExport stop/start_world_external only for multi-threaded builds
Ivan Maidanski [Fri, 27 Jul 2018 21:29:59 +0000 (00:29 +0300)]
Export stop/start_world_external only for multi-threaded builds
(fix of commit bb91f03)

Issue #173 (bdwgc).

Also, update GC_world_stopped value in GC_stop_world_external and
GC_start_world_external.

* include/gc.h (GC_stop_world_external, GC_start_world_external): Do not
declare unless GC_THREADS; add comment.
* misc.c (GC_stop_world_external, GC_start_world_external): Do not
define unless THREADS; add assertion that GC is initialized.
* misc.c [THREADS && THREAD_LOCAL_ALLOC] (GC_stop_world_external): Set
GC_world_stopped to true after STOP_WORLD; add assertion that the
world is not stopped.
* misc.c [THREADS && THREAD_LOCAL_ALLOC] (GC_start_world_external): Set
GC_world_stopped to false before START_WORLD; add assertion that the
world is stopped.
* tests/test.c [GC_PTHREADS && CPPCHECK] (main): Add UNTESTED for
GC_stop_world_external and GC_start_world_external.

6 years agoFix UNTESTED for multi-threaded API functions in gctest
Ivan Maidanski [Fri, 27 Jul 2018 21:21:18 +0000 (00:21 +0300)]
Fix UNTESTED for multi-threaded API functions in gctest
(fix of commits c5d4ef9c1857bb8ad6)

* tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK
&& THREADS] (main): Remove UNTESTED for GC_allow_register_threads,
GC_get_on_thread_event, GC_register_altstack, GC_set_on_thread_event.
* tests/test.c [GC_PTHREADS && CPPCHECK] (main): Add UNTESTED for
GC_allow_register_threads, GC_get_on_thread_event,
GC_register_altstack, GC_set_on_thread_event.

6 years agoNew API to stop and start the GC world externally
Jonas Echterhoff [Fri, 27 Jul 2018 15:11:03 +0000 (18:11 +0300)]
New API to stop and start the GC world externally
(part of commits 39e14be, 05e3377 from Unity-Technologies/bdwgc)

Issue #173 (bdwgc).

* include/gc.h (GC_stop_world_external, GC_start_world_external):
Declare new API function.
* misc.c (GC_stop_world_external, GC_start_world_external): Implement.

6 years agoUpdate AUTHORS file (add Jonas Echterhoff)
Ivan Maidanski [Fri, 27 Jul 2018 12:44:39 +0000 (15:44 +0300)]
Update AUTHORS file (add Jonas Echterhoff)

6 years agoFix the BDWGC build on XboxOne
Jonas Echterhoff [Thu, 14 Jun 2018 18:56:18 +0000 (20:56 +0200)]
Fix the BDWGC build on XboxOne
(fix of commit d16debf)

Issue #173 (bdwgc).

This fixes durango_get_mem() definition.

* os_dep.c [MSWIN_XBOX1] (durango_get_mem): Define even if
MMAP_SUPPORTED is not defined.

6 years agoFix suspend_thread_list in case of thread_suspend is interrupted
Ivan Maidanski [Fri, 27 Jul 2018 10:01:19 +0000 (13:01 +0300)]
Fix suspend_thread_list in case of thread_suspend is interrupted
(fix of commit e8cdc7c)

* darwin_stop_world.c [!GC_NO_THREADS_DISCOVERY]
(GC_suspend_thread_list): Retry thread_suspend if failed with
KERN_ABORTED.

6 years agoPerform thread_suspend in loop as it may be interrupted (Darwin)
Jonathan Chambers [Tue, 24 Jul 2018 20:46:52 +0000 (16:46 -0400)]
Perform thread_suspend in loop as it may be interrupted (Darwin)

* darwin_stop_world.c (GC_stop_world): Retry thread_suspend() on
KERN_ABORTED.

6 years agoRemove PUSH_CONTENTS_HDR multi-line macro
Ivan Maidanski [Thu, 26 Jul 2018 05:07:46 +0000 (08:07 +0300)]
Remove PUSH_CONTENTS_HDR multi-line macro
(code refactoring)

* include/private/gc_pmark.h (PUSH_CONTENTS): Use GC_push_contents_hdr
instead of PUSH_CONTENTS_HDR.
* mark.c (GC_mark_and_push, GC_mark_and_push_stack): Likewise.
* include/private/gc_pmark.h (PUSH_CONTENTS_HDR): Replace macro
definitions with a unified inline function (GC_push_contents_hdr);
return updated value of mark_stack_top; remove unnecessary type casts
and parentheses.
* include/private/gc_priv.h [!KEEP_BACK_PTRS] (GC_STORE_BACK_PTR): Cast
source argument to void (to avoid "unused argument" compiler warning).

6 years agoUpdate copyright information in alloc.c and gc.c
Ivan Maidanski [Thu, 26 Jul 2018 04:51:50 +0000 (07:51 +0300)]
Update copyright information in alloc.c and gc.c
(fix of commit 3bd265a)

* README.md (Copyright & Warranty): Adjust copyright date.
* alloc.c: Update header copyright (add Ivan Maidanski).
* extra/gc.c: Likewise.
* alloc.c (GC_copyright): Update copyright string value.

6 years agoAdd outermost parentheses to HCE definition
Ivan Maidanski [Wed, 25 Jul 2018 09:28:40 +0000 (12:28 +0300)]
Add outermost parentheses to HCE definition
(code refactoring)

* include/private/gc_hdrs.h [COUNT_HDR_CACHE_HITS] (HC_HIT, HC_MISS):
Cast result to void.
* include/private/gc_hdrs.h (HCE): Wrap the whole expression into
parentheses.

6 years agoUpdate copyright information in the documentation and gc.h files
Ivan Maidanski [Sun, 22 Jul 2018 09:17:42 +0000 (12:17 +0300)]
Update copyright information in the documentation and gc.h files

* AUTHORS: Add info about the maintainer.
* README.QUICK: Update header copyright (add Ivan Maidanski).
* include/gc.h: Likewise.
* README.md (Copyright & Warranty): Update copyright (add the
missing copyrights from the source code files).
* doc/gc.man (.TH): Update modification date.
* doc/gc.man (.SH AUTHOR): Update; add reference to AUTHORS file.

6 years agoRemove libatomic_ops license information
Ivan Maidanski [Sun, 22 Jul 2018 08:34:34 +0000 (11:34 +0300)]
Remove libatomic_ops license information

atomic_ops library is not included in BDWGC distribution since v7.4.

* README.md (Copyright & Warranty): Remove libatomic_ops license
information.

6 years agowindows-untested: Update copyright in gc.ver
Ivan Maidanski [Fri, 20 Jul 2018 21:14:20 +0000 (00:14 +0300)]
windows-untested: Update copyright in gc.ver

6 years agoRemove info how to send bugs from README.cords
Ivan Maidanski [Fri, 20 Jul 2018 21:07:17 +0000 (00:07 +0300)]
Remove info how to send bugs from README.cords

* doc/README.cords: Remove information about sending bugs from this
file (clients should refer to the base README regarding bugs
submission).

6 years agoDo not use NULL in gc_inline.h
Ivan Maidanski [Fri, 20 Jul 2018 20:44:50 +0000 (23:44 +0300)]
Do not use NULL in gc_inline.h
(fix of commits 64bed186f0ff8f033c)

* include/gc_inline.h (GC_FAST_MALLOC_GRANS, GC_CONS): Replace NULL
to 0.

6 years agoUpdate ChangeLog file
Ivan Maidanski [Fri, 20 Jul 2018 20:30:22 +0000 (23:30 +0300)]
Update ChangeLog file

6 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Thu, 19 Jul 2018 21:46:27 +0000 (00:46 +0300)]
Update ChangeLog file (v7.6 changes only)
(a cherry-pick of commit 0584756c from 'release-7_6')

6 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Thu, 19 Jul 2018 08:40:18 +0000 (11:40 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(a cherry-pick of commit d46e0fda from 'release-7_4')

6 years agoUpdate NT_MAKEFILE usage information in README files for Win32 and Win64
Ivan Maidanski [Thu, 12 Jul 2018 07:40:41 +0000 (10:40 +0300)]
Update NT_MAKEFILE usage information in README files for Win32 and Win64

Issue #223 (bdwgc).

* doc/README.win32 (Microsoft Tools): Provide a sample how to build
static library without threads support.
* doc/README.win64: Likewise.
* doc/README.win32 (Threads): Provide a sample how to build dynamic
collector with threads support using NT_MAKEFILE.
* doc/README.win64: Likewise.

6 years agoFix Borland version in documentation to match that in BCC_MAKEFILE
Ivan Maidanski [Thu, 12 Jul 2018 06:26:45 +0000 (09:26 +0300)]
Fix Borland version in documentation to match that in BCC_MAKEFILE

* doc/README.win32: Rename "Borland 4.5" to "Borland C++ Builder".
* doc/README.win32 (Borland Tools): Change version from 4.5 to 5.5.

6 years agoFix GC_is_valid_displacement and GC_is_visible for non-small objects
Ivan Maidanski [Wed, 11 Jul 2018 20:09:00 +0000 (23:09 +0300)]
Fix GC_is_valid_displacement and GC_is_visible for non-small objects

* ptr_chck.c (GC_is_valid_displacement): Remove redundant
IS_FORWARDING_ADDR_OR_NIL(hhdr) call if GC_all_interior_pointers.
* ptr_chck.c (GC_is_valid_displacement): Do not goto fail if
p+sz-offset > h+1 but IS_FORWARDING_ADDR_OR_NIL(HDR(h+1)).
* ptr_chck.c (GC_is_visible): Transform comment about GC_base to
a TODO item; set hhdr to HDR(base) instead of HDR(p)
if HBLKPTR(base)!=HBLKPTR(p).

6 years agoFix build for Android after enabling handle-fork by default
Ivan Maidanski [Wed, 11 Jul 2018 08:42:12 +0000 (11:42 +0300)]
Fix build for Android after enabling handle-fork by default
(fix of commit 686a667)

Issue #174 (bdwgc).

* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT]: Do not define HANDLE_FORK
macro for android host.
* configure.ac [$enable_handle_fork!=yes/no/manual && THREADS=xposix]:
Likewise.

6 years agoUpdate AUTHORS file (add woollybah)
Ivan Maidanski [Wed, 11 Jul 2018 07:41:36 +0000 (10:41 +0300)]
Update AUTHORS file (add woollybah)

6 years agoFix build for Nintendo platform
Bruce A Henderson [Wed, 11 Jul 2018 07:39:28 +0000 (10:39 +0300)]
Fix build for Nintendo platform
(fix of commit 9718229)

Issue #228 (bdwgc).

The NINTENDO_SWITCH defines in gcconfig.h were in the wrong section
(under ARM32).  Now they are under AARCH64 instead.

* include/private/gcconfig.h (__arm__): Remove checking of
NN_BUILD_TARGET_PLATFORM_NX.
* include/private/gcconfig.h [AARCH64 && NINTENDO_SWITCH] (__bss_end,
NO_HANDLE_FORK, DATASTART, DATAEND, switch_get_stack_bottom,
STACKBOTTOM): Move from ARM32 section.

6 years agoFix 'pointer arithmetic with NULL' code defect in print_callers
Ivan Maidanski [Wed, 11 Jul 2018 06:07:30 +0000 (09:07 +0300)]
Fix 'pointer arithmetic with NULL' code defect in print_callers

* os_dep.c [NEED_CALLINFO && LINUX && !SMALL_CONFIG] (GC_print_callers):
If nl is null then pass result_len (instead of nl-result_buf) to strncmp;
adjust code indentation.

6 years agoEliminate 'ptr arithmetic with NULL' cppcheck warning in alloc_mark_stack
Ivan Maidanski [Tue, 10 Jul 2018 21:41:33 +0000 (00:41 +0300)]
Eliminate 'ptr arithmetic with NULL' cppcheck warning in alloc_mark_stack

* mark.c (alloc_mark_stack): Wrap GC_mark_stack_limit (and
GC_mark_stack, GC_mark_stack_size) assignment into "else" block (after
EXIT).

6 years agoEliminate 'condition is always true' cppcheck warning in init_gcj_malloc
Ivan Maidanski [Tue, 10 Jul 2018 21:22:20 +0000 (00:22 +0300)]
Eliminate 'condition is always true' cppcheck warning in init_gcj_malloc

* gcj_mlc.c (GC_init_gcj_malloc): Define ignore_gcj_info as macro
if GC_IGNORE_GCJ_INFO; undefine ignore_gcj_info at the end of the
function.

6 years agoEliminate 'scope of var can be reduced' cppcheck warning in pthread_join
Ivan Maidanski [Tue, 10 Jul 2018 21:15:49 +0000 (00:15 +0300)]
Eliminate 'scope of var can be reduced' cppcheck warning in pthread_join

* win32_threads.c [GC_PTHREADS && GC_WIN32_PTHREADS] (GC_pthread_join):
Declare t local variable in the block where the variable is used.

6 years agoFix missing dirty and reachable_here calls in typed_test
Ivan Maidanski [Tue, 10 Jul 2018 05:58:08 +0000 (08:58 +0300)]
Fix missing dirty and reachable_here calls in typed_test
(fix of commits b52c140d3263ffbbfd2e7daad62)

* tests/test.c [!NO_TYPED_TEST] (typed_test): Call GC_PTR_STORE_AND_DIRTY
to store old value to newP[1].

6 years agoRemove PUSH_OBJ multi-line macro
Ivan Maidanski [Thu, 5 Jul 2018 17:00:49 +0000 (20:00 +0300)]
Remove PUSH_OBJ multi-line macro
(code refactoring)

* finalize.c (GC_normal_finalize_mark_proc): Call GC_push_obj instead
of PUSH_OBJ.
* include/private/gc_pmark.h (PUSH_CONTENTS_HDR): Likewise.
* mark.c (GC_push_marked): Likewise.
* mark.c [ENABLE_DISCLAIM] (GC_push_unconditionally): Likewise.
* finalize.c (GC_normal_finalize_mark_proc): Remove hhdr local
variable.
* include/private/gc_pmark.h (PUSH_OBJ): Transform macro to inline
function; rename to GC_push_obj; update comment; return mark_stack_top.

6 years agoFix test_cpp failure in case GC_DEBUG is defined
Ivan Maidanski [Thu, 5 Jul 2018 14:38:11 +0000 (17:38 +0300)]
Fix test_cpp failure in case GC_DEBUG is defined

Now GC_bytes_freed is updated even if the real deallocation of the
explicitly freed object is deferred.

* dbg_mlc.c (GC_debug_free): Increment GC_bytes_freed by hhdr->hb_sz
in case of GC_free is not called (when the object is filled with
GC_FREED_MEM_MARKER); add comment.

6 years agoRemove multi-line macros (ITERATE_DL_HASHTBL_*) in finalize
Ivan Maidanski [Thu, 5 Jul 2018 04:17:09 +0000 (07:17 +0300)]
Remove multi-line macros (ITERATE_DL_HASHTBL_*) in finalize
(code refactoring)

* finalize.c (ITERATE_DL_HASHTBL_BEGIN, ITERATE_DL_HASHTBL_END,
DELETE_DL_HASHTBL_ENTRY): Remove macro.
* finalize.c (GC_make_disappearing_links_disappear): Add
is_remove_dangling argument (true means removal of dangling disappearing
links, false means make the disappearing links disappear); rename curr
and next local variables to curr_dl and next_dl, respectively; expand
ITERATE_DL_HASHTBL_BEGIN, DELETE_DL_HASHTBL_ENTRY and
ITERATE_DL_HASHTBL_END macros; remove real_ptr local variable; reformat
code.
* finalize.c (GC_remove_dangling_disappearing_links): Remove.

6 years agoEliminate duplicate clear_mark_bit call when removing disappearing link
Ivan Maidanski [Wed, 4 Jul 2018 14:33:52 +0000 (17:33 +0300)]
Eliminate duplicate clear_mark_bit call when removing disappearing link
(fix of commit 8d13d52b6)

* finalize.c (GC_make_disappearing_links_disappear,
GC_remove_dangling_disappearing_links): Remove GC_clear_mark_bit call.

6 years agoRemove multi-line macro (FOR_EACH_PRED) in backgraph
Ivan Maidanski [Tue, 3 Jul 2018 14:10:26 +0000 (17:10 +0300)]
Remove multi-line macro (FOR_EACH_PRED) in backgraph
(code refactoring)

This change simplifies stepping thru backgraph code in gdb.

* backgraph.c (FOR_EACH_PRED): Remove macro.
* backgraph.c (add_edge): Rename old_back_ptr local variable to pred.
* backgraph.c (add_edge, backwards_height, update_max_height): Expand
FOR_EACH_PRED macro.
* backgraph.c (backwards_height): Rename back_ptr local variable to
pred.
* backgraph.c (backwards_height, update_max_height): Rename q local
variable to pred.
* backgraph.c (update_max_height): Rename q_height local variable to
this_height.

6 years agoTravis CI: Test with explicit -D GC_DEBUG
Ivan Maidanski [Sun, 1 Jul 2018 14:28:13 +0000 (17:28 +0300)]
Travis CI: Test with explicit -D GC_DEBUG

6 years agoNew public API (PTR_STORE_AND_DIRTY) to simplify store-and-dirty operation
Ivan Maidanski [Sun, 1 Jul 2018 13:53:15 +0000 (16:53 +0300)]
New public API (PTR_STORE_AND_DIRTY) to simplify store-and-dirty operation

* cord/cordbscs.c (CORD_cat_char_star, CORD_cat, CORD_from_fn_inner,
CORD_substr_closure): Replace the last store to the heap-allocated
object, GC_END_STUBBORN_CHANGE() and GC_reachable_here() with
GC_PTR_STORE_AND_DIRTY() call.
* cord/tests/de.c (prune_map, add_map, replace_line): Likewise.
* include/gc_inline.h (GC_CONS): Likewise.
* tests/disclaim_test.c (pair_dct, pair_new): Likewise.
* tests/test.c [!VERY_SMALL_CONFIG] (cons): Likewise.
* tests/test.c (small_cons, small_cons_uncollectable,
reverse_test_inner, mktree): Likewise.
* tests/test.c [GC_GCJ_SUPPORT] (gcj_cons): Likewise.
* tests/test.c [GC_PTHREADS && !SMALL_CONFIG && !GC_DEBUG]
(alloc8bytes): Likewise.
* tests/test.c [!NO_TYPED_TEST] (typed_test): Likewise.
* tests/test_cpp.cc (main): Likewise.
* dbg_mlc.c (GC_debug_ptr_store_and_dirty): Implement.
* mallocx.c (GC_ptr_store_and_dirty): Likewise.
* include/gc.h (GC_PTR_STORE_AND_DIRTY): New public macro.
* include/gc.h (GC_debug_ptr_store_and_dirty, GC_ptr_store_and_dirty):
Declare new public API function; add comment.
* tests/test.c (reverse_test_inner): Remove tmp local variable.
* tests/test.c (mktree): Remove right_left local variable.

6 years agoEliminate 'language extension used' Clang warning in gc.h
Ivan Maidanski [Sat, 30 Jun 2018 19:31:13 +0000 (22:31 +0300)]
Eliminate 'language extension used' Clang warning in gc.h

* include/gc.h [GC_DEBUG && __GNUC__] (GC_PTR_ADD, GC_PRE_INCR,
GC_POST_INCR, GC_POST_DECR): Replace typeof to __typeof__.

6 years agoEliminate 'GC_DEBUG redefined' compiler warning in smashtest
Ivan Maidanski [Sat, 30 Jun 2018 04:45:32 +0000 (07:45 +0300)]
Eliminate 'GC_DEBUG redefined' compiler warning in smashtest

* tests/smash_test.c (GC_DEBUG): Do not define if already done.

6 years agoCompute GC_CONS arguments just once
Ivan Maidanski [Sat, 30 Jun 2018 04:37:54 +0000 (07:37 +0300)]
Compute GC_CONS arguments just once
(fix of commit 8eb6f8d)

* include/gc_inline.h (GC_CONS): Declare l and r local variables;
compute first and second expression even in case of
GC_MALLOC_WORDS_KIND failure; pass l and r to GC_reachable_here (instead
of first and second).

6 years agoSame type casts for GC_PTR_STORE arguments regardless of GC_DEBUG
Ivan Maidanski [Fri, 29 Jun 2018 11:42:14 +0000 (14:42 +0300)]
Same type casts for GC_PTR_STORE arguments regardless of GC_DEBUG

* include/gc.h [GC_DEBUG] (GC_PTR_STORE): Cast p and q to void*.
* include/gc.h [!GC_DEBUG] (GC_PTR_STORE): Cast p to void**, cast q to
void*.

6 years agoWorkaround 'condition is always false' VC++ warning in test_cpp
Ivan Maidanski [Mon, 25 Jun 2018 04:00:21 +0000 (07:00 +0300)]
Workaround 'condition is always false' VC++ warning in test_cpp
(fix of commit 5524a425d)

* tests/test_cpp.cc (GC_CHECKED_DELETE): Remove "do" and "while (0)".