]> granicus.if.org Git - gc/log
gc
8 years agoUpdate AUTHORS file
Ivan Maidanski [Fri, 10 Jun 2016 18:09:54 +0000 (21:09 +0300)]
Update AUTHORS file

8 years agoWorkaround a bug in winpthreads causing parallel marks deadlock (MinGW)
Adrian Pop [Fri, 10 Jun 2016 17:39:18 +0000 (20:39 +0300)]
Workaround a bug in winpthreads causing parallel marks deadlock (MinGW)

The solution is to use Win32 threads for parallel markers while using
winpthreads to provide GC-aware pthread_create/join/detach and fork.

See details in GitHub issue #81 and issue #119.

* win32_threads.c (GC_PTHREADS_PARAMARK): Do not define if
GC_PTHREADS, PARALLEL_MARK and __MINGW32__ (to workaround a deadlock
in do_sema_b_wait() of winpthreads).

8 years ago[7.4.4] gc7_4_4
Ivan Maidanski [Wed, 25 May 2016 15:50:59 +0000 (18:50 +0300)]
[7.4.4]

Bump gc version to 7.4.4

* ChangeLog: Set release date.
* README.md: Bump micro version.
* configure.ac (AC_INIT): Likewise.
* include/gc_version.h (GC_TMP_VERSION_MICRO): Likewise.

8 years agoRemove reference to deleted TODO file from DJGPP-specific Makefile
Ivan Maidanski [Tue, 24 May 2016 21:39:22 +0000 (00:39 +0300)]
Remove reference to deleted TODO file from DJGPP-specific Makefile
(fix commit 7d8d526)

* Makefile.dj (OTHER_FILES): Remove "TODO" file.

8 years agoRemove reference to deleted TODO file from Makefile
Ivan Maidanski [Tue, 24 May 2016 21:28:08 +0000 (00:28 +0300)]
Remove reference to deleted TODO file from Makefile
(fix commit f511a85)

* Makefile.am (EXTRA_DIST): Remove "TODO" file.
* Makefile.direct (DOC_FILES): Likewise.

8 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Mon, 23 May 2016 22:34:56 +0000 (01:34 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

8 years agoRemove (deprecate) TODO file
Ivan Maidanski [Tue, 17 May 2016 21:13:18 +0000 (00:13 +0300)]
Remove (deprecate) TODO file
(Apply commit f511a85 from 'master' branch.)

ToDo/bug items are moved to "Issues" section on GitHub.

8 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Wed, 27 Apr 2016 08:22:01 +0000 (11:22 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

8 years agoFix GC_REALLOC to call GC_FREE if new size is zero and pointer is non-NULL
Ivan Maidanski [Tue, 5 Apr 2016 19:08:55 +0000 (22:08 +0300)]
Fix GC_REALLOC to call GC_FREE if new size is zero and pointer is non-NULL

* dbg_mlc.c (GC_debug_realloc): Call GC_debug_free (and return NULL)
if lb is zero and p is non-NULL.
* extra/AmigaOS.c (GC_amiga_realloc): Do not retry and do not call
WARN if new_size_in_bytes is zero.
* include/gc.h (GC_realloc): Refine comment (better document the cases
of NULL and/or zero arguments).
* mallocx.c (GC_realloc): Call GC_free (skip it if IGNORE_FREE) and
return NULL if lb is zero and p is non-NULL.

8 years agoUpdate AUTHORS file
Ivan Maidanski [Thu, 31 Mar 2016 21:10:05 +0000 (00:10 +0300)]
Update AUTHORS file

8 years ago[Hurd] Use mmap instead of sbrk
Thomas Schwinge [Wed, 30 Mar 2016 08:52:43 +0000 (10:52 +0200)]
[Hurd] Use mmap instead of sbrk

* include/private/gcconfig.h [I386 && HURD]: Define USE_MMAP, USE_MMAP_ANON.

8 years agoFix 'GC_generic_malloc_inner_ignore_off_page not used' compiler warning
Ivan Maidanski [Fri, 18 Mar 2016 18:06:53 +0000 (21:06 +0300)]
Fix 'GC_generic_malloc_inner_ignore_off_page not used' compiler warning
(for GC_NO_FINALIZATION case)
(Apply commit d6c3457 from 'master' branch.)

* include/private/gc_priv.h (GC_generic_malloc_inner_ignore_off_page):
Do not declare unless DBG_HDRS_ALL or GC_GCJ_SUPPORT, or
!GC_NO_FINALIZATION.
* malloc.c (GC_generic_malloc_inner_ignore_off_page): Do not define
unless DBG_HDRS_ALL or GC_GCJ_SUPPORT, or !GC_NO_FINALIZATION.

8 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Fri, 18 Mar 2016 07:32:05 +0000 (10:32 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

8 years agoFix filename printing in cordtest
Ivan Maidanski [Wed, 2 Mar 2016 07:47:24 +0000 (10:47 +0300)]
Fix filename printing in cordtest

* cord/tests/cordtest.c (test_extras): Do not quote FNAME1 and FNAME2.

8 years agoFix assertion on mark_lock_holder for non-unique NUMERIC_THREAD_ID
Ivan Maidanski [Fri, 22 Aug 2014 10:54:53 +0000 (14:54 +0400)]
Fix assertion on mark_lock_holder for non-unique NUMERIC_THREAD_ID
(Apply commit 8cdc862 from 'master' branch.)

* pthread_support.c (GC_acquire_mark_lock): Avoid assertion that
GC_mark_lock_holder != NUMERIC_THREAD_ID(pthread_self()) unless
NUMERIC_THREAD_ID_UNIQUE.
* win32_threads.c (GC_acquire_mark_lock): Likewise.
* win32_threads.c (NUMERIC_THREAD_ID): Add comment.

8 years agoFix pthreads-win32 name in comments and documentation
Ivan Maidanski [Sun, 10 Aug 2014 07:47:09 +0000 (11:47 +0400)]
Fix pthreads-win32 name in comments and documentation
(Apply commit b41c677 from 'master' branch.)

* configure.ac (GC_WIN32_PTHREADS): Fix pthreads-win32 name.
* doc/README.macros (GC_WIN32_PTHREADS): Likewise.
* doc/README.win32: Likewise.
* include/gc.h (GC_WIN32_THREADS): Likewise.
* include/gc_config_macros.h (GC_WIN32_PTHREADS): Likewise.
* include/private/gc_locks.h (NUMERIC_THREAD_ID): Likewise.
* win32_threads.c (GC_pthread_join): Likewise.
* doc/README.win32: Add information how to build for Win32 with
pthreads-win32 using configure.
* include/private/gc_locks.h (NUMERIC_THREAD_ID): Adjust comment
(capitalize 1st word of a sentence, add dot at sentence end).
* win32_threads.c (GC_pthread_join): Join adjacent GC_WIN32_PTHREADS
checks; refine comment about pthreads-win32 id.

8 years agoFix OSX issue with snprintf wrapper macro
Bruce Hoult [Sun, 4 Jan 2015 15:32:29 +0000 (04:32 +1300)]
Fix OSX issue with snprintf wrapper macro
(bug introduced in commit 7bef74b)

OS X for some reason has problems with defining snprintf as a macro
and including another macro expansion in its arguments.

* cord/tests/cordtest.c (GC_SNPRINTF_BUFSZ_ARG): Remove.
* cord/tests/cordtest.c (GC_SNPRINTF): Do not define if no snprintf()
available.
* cord/tests/cordtest.c (test_printf): If GC_SNPRINTF undefined then
use sprintf() instead.

8 years agoFix vsprintf_args initialization/cleanup in CORD_vsprintf for EMX
Ivan Maidanski [Sun, 22 Jun 2014 16:49:01 +0000 (20:49 +0400)]
Fix vsprintf_args initialization/cleanup in CORD_vsprintf for EMX

* cord/cordprnt.c (CORD_vsprintf): Do not use va_copy and va_end if
EMX (as the primitives are missing).

8 years agoFix 'implicit declaration of vsnprintf' GCC warning (if strict ANSI mode)
Ivan Maidanski [Sun, 22 Jun 2014 08:40:10 +0000 (12:40 +0400)]
Fix 'implicit declaration of vsnprintf' GCC warning (if strict ANSI mode)

* cord/tests/cordtest.c (GC_SNPRINTF): Redirect to sprintf also in
case of __STRICT_ANSI__ (i.e., if -ansi compiler option specified).
* misc.c (GC_VSNPRINTF): Redirect to vsprintf also in case of
__STRICT_ANSI__.

8 years agoFix unresolved vsnprintf in misc.c and snprintf in cordtest (DJGPP, VC)
Ivan Maidanski [Wed, 18 Jun 2014 23:04:28 +0000 (03:04 +0400)]
Fix unresolved vsnprintf in misc.c and snprintf in cordtest (DJGPP, VC)

* cord/tests/cordtest.c (GC_SNPRINTF, GC_SNPRINTF_BUFSZ_ARG): New
macro to workaround snprintf() missing in DJGPP and MS VC.
* cord/tests/cordtest.c (test_printf): Replace snprintf() with
GC_SNPRINTF and GC_SNPRINTF_BUFSZ_ARG.
* misc.c (GC_VSNPRINTF): Test DJGPP instead of NO_VSNPRINTF; refine
comment.

8 years agocord: Change no-argument functions declaration style to ANSI C
Ivan Maidanski [Sun, 16 Feb 2014 16:46:58 +0000 (20:46 +0400)]
cord: Change no-argument functions declaration style to ANSI C

* cord/cordbscs.c (CORD_init_min_len): Use ANSI C style of no-argument
function prototype.
* cord/tests/de.c (prune_map, normalize_display, fix_pos): Likewise.

8 years agoFix 'CORD_iter5 unused result' code defect in cordxtra
Ivan Maidanski [Wed, 2 Mar 2016 07:20:28 +0000 (10:20 +0300)]
Fix 'CORD_iter5 unused result' code defect in cordxtra

* cord/cordxtra.c (CORD_fill_buf): Return CORD_iter5() result (instead
of void); update description comment.
* cord/cordxtra.c (CORD_to_char_star): Do not execute CORD_fill_buf()
if cord is empty (CORD_fill_buf returns 0 in case of empty cord);
check CORD_fill_buf result (abort in case of unexpected result).

8 years agoRemove code duplication in GC_realloc
Ivan Maidanski [Tue, 1 Mar 2016 21:44:13 +0000 (00:44 +0300)]
Remove code duplication in GC_realloc

* mallocx.c (GC_realloc): Avoid code duplication for shrink and grow
cases.

8 years agoFix 'statement unreachable' compiler warning in memalign
Ivan Maidanski [Tue, 1 Mar 2016 21:11:22 +0000 (00:11 +0300)]
Fix 'statement unreachable' compiler warning in memalign

* mallocx.c (GC_memalign): Do not handle case of
offset >= VALID_OFFSET_SZ; add assertion for offset; add static
assertion for VALID_OFFSET_SZ value.

8 years agoWorkaround false warning about unreachable code path
Ivan Maidanski [Tue, 1 Mar 2016 09:11:19 +0000 (12:11 +0300)]
Workaround false warning about unreachable code path

* tests/test.c (FAIL): Remove useless void cast applied to abort()
and Amiga_Fail().

8 years agoFix unchecked pointer dereference in check_ints (gctest)
Ivan Maidanski [Mon, 29 Feb 2016 21:41:39 +0000 (00:41 +0300)]
Fix unchecked pointer dereference in check_ints (gctest)

* tests/test.c (check_ints): Fail (with the appropriate message) if
"list" argument is nil.

8 years agoFix unchecked sigdelset() result in pthread_support
Ivan Maidanski [Mon, 29 Feb 2016 21:13:57 +0000 (00:13 +0300)]
Fix unchecked sigdelset() result in pthread_support

* pthread_support.c (GC_pthread_sigmask): Abort in case of sigdelset
failure.

8 years agoFix unchecked pthread_join() result in threadkey_test
Ivan Maidanski [Mon, 29 Feb 2016 21:07:07 +0000 (00:07 +0300)]
Fix unchecked pthread_join() result in threadkey_test

* tests/threadkey_test.c: Include stdio.h (unconditionally), stdlib.h
for fprintf() and exit().
* tests/threadkey_test.c (main): Abort in case of GC_pthread_join
failure.

8 years agoSkip GC_DS_PER_OBJECT objects with negative descriptor in GC_mark_from
Niklas Therning [Wed, 17 Feb 2016 13:16:01 +0000 (14:16 +0100)]
Skip GC_DS_PER_OBJECT objects with negative descriptor in GC_mark_from

Added a check in GC_mark_from() for GC_DS_PER_OBJECT objects with
negative descriptors to prevent mistaking the free list pointers in
free objects for being type descriptor pointers.  If the specified
descriptor offset was larger than the object size this could lead to
arbitrary data from allocated objects being misinterpreted as
descriptors and the process crashing.

* mark.c (GC_mark_from): In case of GC_DS_PER_OBJECT, skip objects
those descriptor is outside object.

8 years agoFix unchecked fcntl() result
Ivan Maidanski [Thu, 18 Feb 2016 21:55:22 +0000 (00:55 +0300)]
Fix unchecked fcntl() result

* os_dep.c (GC_unix_mmap_get_mem, GC_dirty_init): Call WARN() if
fcntl() failed.

8 years agoFix 'unreachable code' compiler warning in GC_dirty_init (Solaris)
Ivan Maidanski [Wed, 17 Feb 2016 20:51:11 +0000 (23:51 +0300)]
Fix 'unreachable code' compiler warning in GC_dirty_init (Solaris)
(fix commit ba593b45)

* os_dep.c (GC_dirty_init): Remove duplicate check for GC_proc_fd (if
PROC_VDB).

8 years agoFix 'statement unreachable' compiler warning in GC_mark_from
Ivan Maidanski [Wed, 17 Feb 2016 07:54:31 +0000 (10:54 +0300)]
Fix 'statement unreachable' compiler warning in GC_mark_from

* mark.c (GC_mark_from): Initialize 'limit' local variable
unconditionally; add static assertion on GC_DS_TAGS (to check that it
corresponds to number of switch cases); remove switch default (as it
cannot happen).

8 years agoFix 'signed-to-bigger-unsigned value assignment' in GC_init_size_map
Ivan Maidanski [Wed, 17 Feb 2016 07:42:57 +0000 (10:42 +0300)]
Fix 'signed-to-bigger-unsigned value assignment' in GC_init_size_map

* misc.c (GC_init_size_map): Cast ROUNDED_UP_GRANULES() result to
unsigned int explicitly (which is, in turn, cast to size_t implicitly).

8 years agoFix 'signed-to-bigger-unsigned value assignment' warning in GC_setpagesize
Ivan Maidanski [Wed, 17 Feb 2016 07:23:55 +0000 (10:23 +0300)]
Fix 'signed-to-bigger-unsigned value assignment' warning in GC_setpagesize
(Apply commit 39e2468 from 'master' branch.)

* include/private/gcconfig.h (GETPAGESIZE): Cast getpagesize() and
sysconf() result to unsigned int.
* tools/setjmp_t.c (main): Change type of "ps" local variable from
long to unsigned int.

8 years agoFix 'signed-to-bigger-unsigned value assignment' warning for hb_map
Ivan Maidanski [Tue, 16 Feb 2016 20:34:43 +0000 (23:34 +0300)]
Fix 'signed-to-bigger-unsigned value assignment' warning for hb_map
(Apply commit 3883587 from 'master' branch.)

* include/private/gc_priv.h (hblkhdr): Change type of hb_map from
short to unsigned short.
* include/private/gc_priv.h (_GC_arrays): Change type of _obj_map from
short to unsigned short.
* obj_map.c (GC_add_map_entry): Change type of new_map local variable
from short to unsigned short.

8 years agoFix 'implicit declaration of function' compiler warnings in cord/de
Ivan Maidanski [Tue, 16 Feb 2016 08:09:34 +0000 (11:09 +0300)]
Fix 'implicit declaration of function' compiler warnings in cord/de

* cord/tests/de.c: Include stdlib.h (for "exit" prototype); include
ctype.h unconditionally (for "iscntrl", "isdigit" prototypes); include
unistd.h (for "sleep" prototype) unless WIN32 or MACINTOSH.

8 years agoFix null-pointer dereferences on out-of-memory in cord/de
Ivan Maidanski [Mon, 15 Feb 2016 21:32:01 +0000 (00:32 +0300)]
Fix null-pointer dereferences on out-of-memory in cord/de

* cord/tests/de.c (add_map, add_hist): Check GC_NEW() result for null.

8 years agoFix potential left shift overflows in finalize.c (64-bit targets)
Ivan Maidanski [Mon, 15 Feb 2016 21:18:54 +0000 (00:18 +0300)]
Fix potential left shift overflows in finalize.c (64-bit targets)

* finalize.c (HASH2, GC_grow_table): Cast 1 to word before shift to
avoid overflow.
* finalize.c (GC_dump_finalization_links, GC_dump_finalization,
ITERATE_DL_HASHTBL_BEGIN, GC_finalize): Cast 1 to size_t before
shift to avoid overflow.

8 years agoFix potential multiplication overflow in check_heap_stats (test)
Ivan Maidanski [Fri, 12 Feb 2016 18:36:08 +0000 (21:36 +0300)]
Fix potential multiplication overflow in check_heap_stats (test)

* tests/test.c (check_heap_stats): Cast n_tests to size_t before
multiplication by 2700000 (instead of implicit cast to size_t of the
result).

8 years agoFix missing numeric casts in cord
Ivan Maidanski [Fri, 12 Feb 2016 18:12:40 +0000 (21:12 +0300)]
Fix missing numeric casts in cord

* cord/cordprnt.c (CORD_vsprintf): Explicitly cast "prec" to unsigned
(to avoid assignment of a signed value to a variable of a bigger
unsigned integer type).
* cord/cordxtra.c (CORD_nul_func, CORD_chars): Cast between pointer
and char via GC_word (instead of long); explicitly cast char to
unsigned char (to avoid a signed value cast to a bigger unsigned one).
* cord/tests/de.c (replace_line): Explicitly cast COLS to unsigned
(when compared to "len" local variable).

8 years agocord/de: Change main() declaration style from K-R to ANSI C
Ivan Maidanski [Fri, 12 Feb 2016 16:49:31 +0000 (19:49 +0300)]
cord/de: Change main() declaration style from K-R to ANSI C

* cord/tests/de.c (main): Replace the K&R-style function definition
with the ANSI C one.
* cord/tests/de.c (main): Replace goto with a block.
* cord/tests/de.c (main): Replace exit(0) with return.

8 years agoFix 'unused label' compiler warning in cord/de
Ivan Maidanski [Fri, 12 Feb 2016 16:13:14 +0000 (19:13 +0300)]
Fix 'unused label' compiler warning in cord/de

* cord/tests/de.c (main): Remove unused "done" label.

8 years agoRemove duplicate new-line in OUT_OF_MEMORY message (cord)
Ivan Maidanski [Fri, 12 Feb 2016 09:20:36 +0000 (12:20 +0300)]
Remove duplicate new-line in OUT_OF_MEMORY message (cord)

* cord/cordbscs.c (OUT_OF_MEMORY): Remove '\n' in ABORT message.
* cord/cordxtra.c (OUT_OF_MEMORY): Likewise.

8 years agoEliminate 'divide by zero' compiler warning in cordtest
Ivan Maidanski [Fri, 12 Feb 2016 09:13:58 +0000 (12:13 +0300)]
Eliminate 'divide by zero' compiler warning in cordtest

* cord/tests/cordtest.c (ABORT): Remove "int x = 0; x = 1 / x" code.

8 years agoFix GC initialization in de_win for Cygwin
Ivan Maidanski [Fri, 12 Feb 2016 09:04:16 +0000 (12:04 +0300)]
Fix GC initialization in de_win for Cygwin
(make GC initialization portable)

* cord/tests/de_win.c (WinMain): Call GC_INIT() unconditionally.

8 years agoFix de_win WndProc prototype parameters for 64-bit (Win64)
Ivan Maidanski [Fri, 12 Feb 2016 08:46:06 +0000 (11:46 +0300)]
Fix de_win WndProc prototype parameters for 64-bit (Win64)

* cord/tests/de_win.h (WndProc): Change UINT type (for wParam) to
WPARAM; change LONG type to LPARAM.
* cord/tests/de_win.h (AboutBox): Remove unused declaration.

8 years agoFix null-pointer dereferences in case of out-of-memory in cord
Ivan Maidanski [Thu, 11 Feb 2016 21:22:44 +0000 (00:22 +0300)]
Fix null-pointer dereferences in case of out-of-memory in cord

* cord/cordprnt.c: Include <stdlib.h> (for abort() declaration).
* cord/cordprnt.c (OUT_OF_MEMORY): New macro.
* cord/tests/de.c (OUT_OF_MEMORY): Likewise.
* cord/cordprnt.c (CORD_vsprintf): Execute OUT_OF_MEMORY if
GC_MALLOC_ATOMIC returns NULL.
* cord/cordxtra.c (CORD_ec_flush_buf): Likewise.
* cord/tests/de.c (replace_line, main): Likewise.
* tests/cordtest.c (test_extras): Declare "u" local variable; do ABORT
if CORD_substr returns NULL (to avoid null pointer dereference in
strcmp).
* cord/tests/de_win.c (plain_chars, control_chars): Return NULL if
GC_MALLOC_ATOMIC returns NULL.
* cord/tests/de_win.c (WndProc): Execute de_error() (with the
appropriate message) if plain_chars() or control_chars() returned
NULL (and do not call the corresponding TextOutA in such a case).

8 years agoFix Unicode Win32 API calls in cord de_win
Ivan Maidanski [Sat, 2 Aug 2014 08:56:27 +0000 (12:56 +0400)]
Fix Unicode Win32 API calls in cord de_win

* cord/tests/de_win.c (FullAppName): Remove global variable.
* cord/tests/de_win.c (szAppName): Turn into macro; use TEXT().
* cord/tests/de_win.c (de_error): Force calling ANSI version of
MessageBox; remove casts to LPSTR.
* cord/tests/de_win.c (WinMain): Use TEXT() for lpszMenuName field and
for CreateWindow agrument.
* cord/tests/de_win.c (WndProc): Use TEXT() for DialogBox argument;
force calling ANSI version of TextOut.

8 years agoEliminate warnings detected by Cppcheck in cord de[_win]
Ivan Maidanski [Sat, 14 Jun 2014 16:30:42 +0000 (20:30 +0400)]
Eliminate warnings detected by Cppcheck in cord de[_win]

* cord/tests/de.c (prune_map): Remove redundant first check of map for
NULL (as "map" variable has already been dereferenced at the point of
the check).
* cord/tests/de.c (replace_line): Do not define "len" local variable
if not used; eliminate duplicate CORD_len(s) call.
* cord/tests/de_win.c (WndProc): Cast char_width and char_height
global variables to unsigned int in division of unsigned xpos, ypos
local variables.

8 years agoFix null pointer dereference on out-of-memory in tests
Ivan Maidanski [Tue, 9 Feb 2016 20:35:33 +0000 (23:35 +0300)]
Fix null pointer dereference on out-of-memory in tests
(Apply commit 9c6d1b3 from 'master' branch.)

* tests/disclaim_bench.c (main): Check GC_MALLOC result for NULL
(abort in case of out-of-memory) before dereference.
* tests/test.c (run_one_test): Likewise.

8 years agoWorkaround 'identical expr on both sides of bitwise op' warning
Ivan Maidanski [Tue, 9 Feb 2016 06:51:22 +0000 (09:51 +0300)]
Workaround 'identical expr on both sides of bitwise op' warning
(Apply commit 76ec924 from 'master' branch.)

* gcj_mlc.c (GC_init_gcj_malloc): Comment out "0 |" (in the expression
of "0 | GC_DS_LENGTH").
* mark.c (GC_obj_kinds, GC_push_marked, GC_push_unconditionally):
Likewise.

8 years agoUpdate AUTHORS file
Ivan Maidanski [Wed, 3 Feb 2016 20:53:04 +0000 (23:53 +0300)]
Update AUTHORS file

8 years agoFix Cygwin64 build
Yuki Okumura [Tue, 2 Feb 2016 13:49:11 +0000 (22:49 +0900)]
Fix Cygwin64 build

On x86_64, Cygwin symbols do not have leading underscore anymore,
so an additional underscore is needed on linker-generated symbols
access from C.

* include/gc.h (GC_DATASTART, GC_DATAEND): Prefix _data_start__,
_bss_start__, _data_end__ and _bss_end__ with an extra underscore if
__x86_64__ (only if __CYGWIN__); reformat code.

8 years agoFix typo in GC_malloc_uncollectable comment
Ivan Maidanski [Wed, 13 Jan 2016 08:34:56 +0000 (11:34 +0300)]
Fix typo in GC_malloc_uncollectable comment

* ChangeLog: Fix typo ("was").
* malloc.c (GC_malloc_uncollectable): Fix typo ("was") in comment.

8 years agoFix typo in comment of ERROR_FL
Ivan Maidanski [Wed, 30 Dec 2015 09:13:55 +0000 (12:13 +0300)]
Fix typo in comment of ERROR_FL

* include/private/thread_local_alloc.h (ERROR_FL): Fix typo in comment
("gcj_freelists").

8 years agoFix typos in gc_priv.h
Ivan Maidanski [Wed, 30 Dec 2015 05:44:18 +0000 (08:44 +0300)]
Fix typos in gc_priv.h

* include/private/gc_priv.h (CPP_MAXOBJBYTES): Add missing ')' in
comment.
* include/private/gc_priv.h (obj_kind.ok_freelist): Fix typo in
comment ("list headers").
* include/private/gc_priv.h (obj_kind.ok_freelist,
obj_kind.ok_reclaim_list): Reformat comment.

8 years agoFix undefined PTRFREE/NORMAL in gc_inline.h
Ivan Maidanski [Mon, 28 Dec 2015 17:24:33 +0000 (20:24 +0300)]
Fix undefined PTRFREE/NORMAL in gc_inline.h

Allow to use gc_inline.h public header without include gc_priv.h.

* include/gc_inline.h (GC_I_PTRFREE, GC_I_NORMAL): New macro.
* include/gc_inline.h (GC_FAST_MALLOC_GRANS, GC_MALLOC_WORDS,
GC_MALLOC_ATOMIC_WORDS, GC_CONS): Use GC_I_PTRFREE and GC_I_NORMAL
instead of PTRFREE and NORMAL (private macros), respectively.

8 years agoPrefix PREFETCH_FOR_WRITE with GC_ as used in gc_inline.h public header
Ivan Maidanski [Mon, 28 Dec 2015 16:11:43 +0000 (19:11 +0300)]
Prefix PREFETCH_FOR_WRITE with GC_ as used in gc_inline.h public header

* doc/porting.html: Rename PREFETCH_FOR_WRITE to GC_PREFETCH_FOR_WRITE.
* fnlz_mlc.c (GC_finalized_malloc): Likewise.
* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Likewise.
* include/private/gcconfig.h: Likewise.
* new_hblk.c (GC_build_fl_clear4, GC_build_fl4, GC_build_fl): Likewise.
* include/gc_inline.h (GC_PREFETCH_FOR_WRITE): Define to no-op if
undefined.

8 years agoAllow GC_FAST_MALLOC_GRANS() multiple use in a function
Ivan Maidanski [Mon, 28 Dec 2015 15:34:57 +0000 (18:34 +0300)]
Allow GC_FAST_MALLOC_GRANS() multiple use in a function

Avoid goto statement in gc_inline.h public header (to fix
'duplicate label' compiler error in GC_FAST_MALLOC_GRANS if the macro
is used multiple times in a function).

* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Replace goto with break

8 years agoWorkaround 'comparison is always false' GCC warning in GC_FAST_MALLOC_GRANS
Ivan Maidanski [Mon, 28 Dec 2015 14:49:54 +0000 (17:49 +0300)]
Workaround 'comparison is always false' GCC warning in GC_FAST_MALLOC_GRANS

* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Refactoring of condition
expression for entry containing counter or is NULL to avoid
"comparison of unsigned expression < 0 is always false" warning
reported by GCC.

8 years agoUpdate AUTHORS file
Ivan Maidanski [Thu, 24 Dec 2015 20:46:56 +0000 (23:46 +0300)]
Update AUTHORS file

8 years agoFix CMake warning about CMP0054 by unquoting instances of HOST
Andrew Buss [Mon, 21 Dec 2015 10:20:01 +0000 (02:20 -0800)]
Fix CMake warning about CMP0054 by unquoting instances of HOST

See CMake v3.1 policy CMP0054.

* CMakeLists.txt: Use HOST variable without quotes.

8 years agoFix typo (items numbering) in GC_finalize_all documentation
Ivan Maidanski [Fri, 4 Dec 2015 08:20:41 +0000 (11:20 +0300)]
Fix typo (items numbering) in GC_finalize_all documentation

* include/javaxfc.h (GC_finalize_all): Fix 2nd item numbering in
comment.

8 years agoRemove references to missing linux_threads.c from documentation
Ivan Maidanski [Wed, 2 Dec 2015 21:08:02 +0000 (00:08 +0300)]
Remove references to missing linux_threads.c from documentation
(Apply commit 2118928 from 'master' branch.)

* README.md (copyright): Change linux_threads.c to pthread_stop_world.c
and pthread_support.c files.
* doc/README.DGUX386: Remove reference to linux-threads.c file.
* doc/README.environment (GC_RETRY_SIGNALS, GC_NO_RETRY_SIGNALS):
Likewise.
* doc/gcdescr.html: Likewise.
* doc/README.DGUX386: Update information how to pass DEBUG_THREADS to
make.
* doc/gcdescr.html: Update threads support information for Irix and
Solaris.
* include/private/gc_locks.h: Remove reference to linux-threads.c in
a comment.
* pthread_support.c: Likewise.

8 years agoRemove documentation about obsolete GC_REDIRECT_TO_LOCAL
Ivan Maidanski [Tue, 1 Dec 2015 08:49:02 +0000 (11:49 +0300)]
Remove documentation about obsolete GC_REDIRECT_TO_LOCAL

* doc/scale.html (GC_REDIRECT_TO_LOCAL): Remove documentation.
* doc/simple_example.html (GC_REDIRECT_TO_LOCAL): Likewise.

8 years agoFix missing GC_get_stack_base for Amiga
Ivan Maidanski [Thu, 26 Nov 2015 20:24:38 +0000 (23:24 +0300)]
Fix missing GC_get_stack_base for Amiga

* os_dep.c (GET_MAIN_STACKBASE_SPECIAL): Define if AMIGA (which, in
turn, causes default GC_get_stack_base to be defined).

8 years agoFix USE_COMPILER_TLS macro duplicate description in README
Ivan Maidanski [Tue, 17 Nov 2015 21:43:25 +0000 (00:43 +0300)]
Fix USE_COMPILER_TLS macro duplicate description in README

* doc/README.macros (USE_COMPILER_TLS): Remove duplicate description.

8 years agoAvoid unstructured procfs on Solaris
Rainer Orth [Thu, 27 Aug 2015 11:26:18 +0000 (11:26 +0000)]
Avoid unstructured procfs on Solaris
(Cherry-picked commit f9711f5 from 'gcc_boehmgc' branch.)

* os_dep.c [PROC_VDB] (GC_dirty_init): Use /proc/<pid>/pagedata
instead of PIOCOPENPD; remove fd local variable; increase buf[] size.

8 years agoWorkaround invalid '_end' symbol on Android clang 3.5+
Ivan Maidanski [Fri, 23 Oct 2015 09:24:21 +0000 (12:24 +0300)]
Workaround invalid '_end' symbol on Android clang 3.5+

* include/gc.h (GC_INIT_CONF_ROOTS): Handle Android clang (3.5-3.6)
case when "_end" symbol has incorrect address but "__end__" is defined
(by bfd linker only); declare "__end__" symbol as weak.
* include/private/gcconfig.h (DATAEND): Redefine for Android/clang;
define __end__ as weak symbol.
* os_dep.c (_end): Remove declaration (declared in gcconfig.h).
* os_dep.c (GC_init_linux_data_start): Define new local variable
(data_end); set it to DATAEND; use it instead of _end.

8 years agoFix gc.mak regarding msvc_dbg and test (MSVC)
Ivan Maidanski [Wed, 30 Sep 2015 21:46:06 +0000 (00:46 +0300)]
Fix gc.mak regarding msvc_dbg and test (MSVC)

* gc.mak (CLEAN, BSC32_SBRS, LINK32_OBJS): Rename msvc_dbg.* to
msvc_dbg.copied.* file names.
* gc.mak (CLEAN): Erase msvc_dbg.copied.c, test.copied.c.
* gc.mak (msvc_dbg.copied.c): New rule.
* gc.mak (CLEAN, LINK32_OBJS, BSC32_SBRS, test.c): Rename test.* to
test.copied.* file names.
* gc.mak (CPP_PROJ): Add /D for "ALL_INTERIOR_POINTERS".

8 years agoUpdate compiler options in gc.mak (Win32)
Ivan Maidanski [Mon, 14 Sep 2015 08:25:03 +0000 (11:25 +0300)]
Update compiler options in gc.mak (Win32)

* gc.mak (CFG): Fix info about default configuration.
* gc.mak (CPP_PROJ): Replace deprecated /GX option with /EHsc; remove
deprecated /YX option; add /D _CRT_SECURE_NO_DEPRECATE option (to
suppress warning about vsprintf usage).

8 years ago.gitignore: Ignore .copied.c, .dll.manifest, idb, ilk files (MSVC)
Ivan Maidanski [Wed, 23 Sep 2015 07:43:53 +0000 (10:43 +0300)]
.gitignore: Ignore .copied.c, .dll.manifest, idb, ilk files (MSVC)

8 years agoFix race (and potential deadlock) at marker threads initialization
Ivan Maidanski [Tue, 22 Sep 2015 05:42:40 +0000 (08:42 +0300)]
Fix race (and potential deadlock) at marker threads initialization

* include/private/gc_priv.h (GC_wait_for_markers_init): New prototype.
* mark.c (GC_wait_for_markers_init): New function (if PARALLEL_MARK).
* pthread_support.c (GC_mark_thread): Notify start_mark_threads()
about completion of marker data initialization.
* win32_threads.c (GC_mark_thread): Likewise.
* pthread_support.c (start_mark_threads): Add assertion about
GC_fl_builder_count; call GC_wait_for_markers_init.
* win32_threads.c (start_mark_threads): Likewise.
* win32_threads.c (GC_mark_thread): Reformat code.

8 years agoFix 'value truncated' compiler warning in CORD_cat (MS VC)
Ivan Maidanski [Fri, 18 Sep 2015 22:26:36 +0000 (01:26 +0300)]
Fix 'value truncated' compiler warning in CORD_cat (MS VC)

* cord/cordbscs.c (CORD_cat_char_star, CORD_cat): Cast "lenx" to
unsigned char (to workaround false compiler warning about value
truncation).

8 years agowindows-untested: Fix paths to msvc_dbg.c/h
Ivan Maidanski [Tue, 15 Sep 2015 07:49:01 +0000 (10:49 +0300)]
windows-untested: Fix paths to msvc_dbg.c/h

* windows-untested/vc60/gc.dsp (SOURCE): Fix paths to msvc_dbg.c and
msvc_dbg.h.
* windows-untested/vc60/libgc.dsp (SOURCE): Likewise.
* windows-untested/vc60/libgcmt.dsp (SOURCE): Likewise.
* windows-untested/vc60/libgcmt.dsp (File RelativePath): Likewise.
* windows-untested/vc70/libgc.vcproj (File RelativePath): Likewise.
* windows-untested/vc70/libgcmt.vcproj (File RelativePath): Likewise.
* windows-untested/vc71/gc.vcproj (File RelativePath): Likewise.
* windows-untested/vc71/libgc.vcproj (File RelativePath): Likewise.
* windows-untested/vc71/libgcmt.vcproj (File RelativePath): Likewise.

8 years agoUpdate AUTHORS file
Ivan Maidanski [Tue, 15 Sep 2015 07:15:35 +0000 (10:15 +0300)]
Update AUTHORS file

8 years agoFix typos in README for ews4800
Terrell Russell [Mon, 14 Sep 2015 18:48:41 +0000 (14:48 -0400)]
Fix typos in README for ews4800

* doc/README.ews4800: Fix typos ("information", "vendor", "the").

8 years ago.gitignore: Ignore .exp and .sbr also in subfolders (MSVC)
Ivan Maidanski [Mon, 14 Sep 2015 07:41:44 +0000 (10:41 +0300)]
.gitignore: Ignore .exp and .sbr also in subfolders (MSVC)

8 years agoFix abort message in GC_move_long_link
Ivan Maidanski [Thu, 10 Sep 2015 23:16:42 +0000 (02:16 +0300)]
Fix abort message in GC_move_long_link

* finalize.c (GC_move_long_link): Fix function name in abort message.

8 years agoFix 'comparison of non-null parameter is always false' warning (Clang)
Ivan Maidanski [Thu, 10 Sep 2015 08:48:05 +0000 (11:48 +0300)]
Fix 'comparison of non-null parameter is always false' warning (Clang)

* alloc.c (GC_set_stop_func, GC_try_to_collect): Use
NONNULL_ARG_NOT_NULL to check argument marked as non-null (in
function declaration) is actually non-null.
* finalize.c (GC_general_register_disappearing_link,
GC_register_long_link, GC_move_disappearing_link, GC_move_long_link):
Likewise.
* misc.c (GC_set_warn_proc, GC_set_abort_func, GC_set_oom_fn): Likewise.
* include/private/gc_priv.h (NONNULL_ARG_NOT_NULL): New macro.

8 years agoSupport Android API level 21
Ivan Maidanski [Wed, 9 Sep 2015 08:42:43 +0000 (11:42 +0300)]
Support Android API level 21
(fix 'link_map redefinition' error on Android with API level 21+)

* dyn_load.c (link_map, r_debug): Do not define if android-21 (or
higher) API is used; update comment.

8 years agoFix 'visibility attribute not supported' GCC warning (IBM AIX)
Ivan Maidanski [Wed, 2 Sep 2015 08:52:30 +0000 (11:52 +0300)]
Fix 'visibility attribute not supported' GCC warning (IBM AIX)

* configure.ac (enable_shared): Add -D GC_NO_VISIBILITY to CFLAGS if
not ac_cv_fvisibility_hidden.
* include/cord.h (CORD_API): Do not use visibility attribute if
GC_NO_VISIBILITY.
* include/gc_config_macros.h (GC_API): Likewise.
* include/private/gc_priv.h (GC_INNER, GC_API_OSCALL): Likewise.

8 years agoFix data race in GC_init_explicit_typing
Ivan Maidanski [Tue, 1 Sep 2015 06:57:38 +0000 (09:57 +0300)]
Fix data race in GC_init_explicit_typing

* typd_mlc.c: Force include atomic_ops.h if
GC_FORCE_INCLUDE_ATOMIC_OPS (by default it is included if
PARALLEL_MARK or pthreads are used).
* typd_mlc.c (GC_explicit_typing_initialized): Use AO_t if
AO_load_acquire() available.
* typd_mlc.c (GC_init_explicit_typing): Move locking (and
GC_explicit_typing_initialized access) outside to the caller
(GC_make_descriptor); remove comment; remove "register" keyword for
local variable.
* typd_mlc.c (GC_make_descriptor): Use AO_load_acquire (if available)
to fetch GC_explicit_typing_initialized value (to avoid data race and
avoid lock acquiring on each call).
* typd_mlc.c (GC_explicit_typing_initialized,
GC_malloc_explicitly_typed_ignore_off_page,
GC_calloc_explicitly_typed): Add assertion on
GC_explicit_typing_initialized is true.

8 years agoFix Makefile.direct for Cygwin
Paul Bone [Thu, 16 Jul 2015 17:31:24 +0000 (20:31 +0300)]
Fix Makefile.direct for Cygwin
(Apply commit d00b16a from 'master' branch.)

* Makefile.direct (CXX, AS): Add comment.
* Makefile.direct (LD): New variable.
* Makefile.direct (libalphagc.so, libirixgc.so, mach_dep.o): Use LD
variable.
* Makefile.direct (mach_dep.o): Replace "as $(AS_ABI_FLAG)" with $(AS).
* Makefile.direct (mach_dep.o, mark_rts.o): Add Cygwin-specific rules.

8 years agoUpdate AUTHORS file
Ivan Maidanski [Tue, 7 Jul 2015 22:48:57 +0000 (01:48 +0300)]
Update AUTHORS file

8 years agoFix GC_get_stack_base if called before GC_init (Win32)
Eli Barzilay [Tue, 7 Jul 2015 22:22:23 +0000 (01:22 +0300)]
Fix GC_get_stack_base if called before GC_init (Win32)
(Apply part of commit db2b9f1 from 'racket_gc' branch.)

* os_dep.c (GC_get_stack_base): Call GC_setpagesize if GC_page_size is
not initialized (only if MSWIN32 but not CYGWIN32).

8 years agoUpdate AUTHORS file
Ivan Maidanski [Sat, 4 Jul 2015 07:12:43 +0000 (10:12 +0300)]
Update AUTHORS file

8 years agoFix various spelling errors
David Van Horn [Wed, 2 Feb 2011 19:56:42 +0000 (14:56 -0500)]
Fix various spelling errors
(Apply commit 1efc418 from 'racket_gc' branch.)

* ChangeLog: Fix typo (accommodate).
* win32_threads.c (GC_pthread_create): Fix typo (interceptable).

Conflicts:

    Makefile.dj
    doc/README.changes
    dyn_load.c
    win32_threads.c

8 years agoEliminate warning about 64-bit pointer-to-int cast (Win64/pthreads-w32)
Ivan Maidanski [Wed, 24 Jun 2015 11:51:14 +0000 (14:51 +0300)]
Eliminate warning about 64-bit pointer-to-int cast (Win64/pthreads-w32)
(Apply commit 6936df7 from 'master' branch.)

* include/private/gc_locks.h (NUMERIC_THREAD_ID): Cast to unsigned long
through "word" type if GC_WIN32_PTHREADS but not winpthreads (to
suppress "cast from pointer to integer of different size" compiler
warning).
* win32_threads.c (NUMERIC_THREAD_ID): Likewise.
* win32_threads.c (NUMERIC_THREAD_ID): Do not define unless
GC_ASSERTIONS.

8 years ago.gitignore: Add *.vcproj.*.user (copied from .hgignore)
Ivan Maidanski [Sun, 18 Nov 2012 08:00:13 +0000 (12:00 +0400)]
.gitignore: Add *.vcproj.*.user (copied from .hgignore)

9 years agoUpdate ChangeLog file
Ivan Maidanski [Thu, 14 May 2015 22:00:01 +0000 (01:00 +0300)]
Update ChangeLog file

9 years agoDo not include sigcontext.h and asm/sigcontext.h
Ivan Maidanski [Mon, 6 Apr 2015 17:06:47 +0000 (20:06 +0300)]
Do not include sigcontext.h and asm/sigcontext.h
(these Linux headers define sigcontext which is no longer used as
replaced with ucontext_t in GC 7.0alpha1)

* os_dep.c: Do not include linux/version.h (do not test
LINUX_VERSION_CODE), asm/signal.h, sigcontext.h, asm/sigcontext.h
since struct sigcontext not used in GC v7+.

9 years agoRevert "Move asm machine-dependent files to 'src' folder" (partly)
Ivan Maidanski [Fri, 27 Feb 2015 18:32:22 +0000 (21:32 +0300)]
Revert "Move asm machine-dependent files to 'src' folder" (partly)

Asm files moved back to base folder to avoid build issues (reported
for NetBSD and Solaris on Sparc).  Alternative way is to adjust
configure.ac and Makefile.am properly but it requires more efforts
(including testing).

* .gitignore: Remove "src" from comment.
* Makefile.am (EXTRA_libgc_la_SOURCES): Remove "src/" prefix.
* Makefile.direct (SRCS, mach_dep.o): Likewise.
* src/ia64_save_regs_in_stack.s: Move to base folder.
* src/sparc_mach_dep.S: Likewise.
* src/sparc_netbsd_mach_dep.s: Likewise.
* src/sparc_sunos4_mach_dep.s: Likewise.

9 years agoFix OSX issue with pthread_attr_setstacksize failure
Bruce Hoult [Sun, 4 Jan 2015 15:33:35 +0000 (04:33 +1300)]
Fix OSX issue with pthread_attr_setstacksize failure
(bug introduced in commit 7bef74b)

* tests/test.c (main): Set stack size to 1000 KiB instead of
1000000 bytes (to avoid pthread_attr_setstacksize failure with
"stacksize is not a multiple of the system page size" error on
Darwin)

9 years agoFix mistyped ARM_THREAD_STATE macro (Darwin/arm)
Ivan Maidanski [Tue, 4 Nov 2014 14:01:08 +0000 (17:01 +0300)]
Fix mistyped ARM_THREAD_STATE macro (Darwin/arm)

* include/private/gc_priv.h (GC_MACH_THREAD_STATE,
GC_MACH_THREAD_STATE_COUNT): Define to ARM_THREAD_STATE[_COUNT],
respectively, instead of mistyped ARM_MACHINE_THREAD_STATE[_COUNT]
(if DARWIN and ARM32).

9 years agoFix FirstDLOpenedLinkMap for case libgc not 1st dynamically linked (NetBSD)
Tsugutomo Enami [Sun, 2 Nov 2014 07:46:17 +0000 (10:46 +0300)]
Fix FirstDLOpenedLinkMap for case libgc not 1st dynamically linked (NetBSD)

Current GC_FirstDLOpenedLinkMap() for NetBSD calls dlinfo(RTLD_SELF,
RTLD_DI_LINKMAP, &lm) to find link_map. So it will find link_map of
libgc.  With guile's case, libgc is link to libguile and libguile is
linked to the guile command, so libgc is not the first one in the
link_map chain.  That is why, data section of libguile, where
scm_protects exists, is not added to GC root and GC_is_visible fails.

* dyn_load.c (GC_FirstDLOpenedLinkMap): Iterate over link_map
(provided by dlinfo(RTLD_SELF)) to return 2nd element instead of the
provided one which might not always belong to libgc (only for NETBSD
and defined RTLD_DI_LINKMAP).

9 years agoFix missing cord_pos.h, ec.h among installed headers (Automake)
Ivan Maidanski [Tue, 21 Oct 2014 21:36:17 +0000 (01:36 +0400)]
Fix missing cord_pos.h, ec.h among installed headers (Automake)

* cord/cord.am (pkginclude_HEADERS): Add cord_pos.h, ec.h entries.

9 years agoFix missing msvc_dbg.h in dist_noinst_HEADERS (Automake)
Ivan Maidanski [Tue, 21 Oct 2014 06:31:11 +0000 (10:31 +0400)]
Fix missing msvc_dbg.h in dist_noinst_HEADERS (Automake)

* include/include.am (dist_noinst_HEADERS): Add msvc_dbg.h entry.

9 years agoFix missing error handling of pthread_attr_init/getstacksize
Ivan Maidanski [Mon, 20 Oct 2014 20:54:28 +0000 (00:54 +0400)]
Fix missing error handling of pthread_attr_init/getstacksize

* misc.c (GC_init): Explicitly ignore returned value of
pthread_mutexattr_destroy.
* os_dep.c (GC_get_main_stack_base, GC_get_stack_base, GC_dirty_init):
Likewise.
* pthread_support.c (start_mark_threads, pthread_create): Likewise.
* tests/test.c (main): Likewise.
* win32_threads.c (start_mark_threads): Likewise.
* pthread_support.c (pthread_create): ABORT (with the appropriate
message) in case of pthread_attr_getstacksize or pthread_attr_init
failure.
* tests/test.c (main): Print error code and FAIL if pthread_attr_init
or pthread_attr_setstacksize failed (only if GC_PTHREADS).

9 years agoFix __alloc_size__ availability detection (Clang)
Yusuke Suzuki [Wed, 1 Oct 2014 18:38:02 +0000 (03:38 +0900)]
Fix __alloc_size__ availability detection (Clang)

Since __clang_major__/__clang_minor__ etc. are vendor dependent values,
we cannot implement the feature detection based on it.
For example, Apple clang versioning is different from the FreeBSD clang.
(At this time, Apple clang version is "6.0 (clang-600.0.51)" and
__clang_major__ is 6.)
Instead of this, we can use the clang feature detection macro,
__has_attribute.

* include/gc_config_macros.h (GC_ATTR_ALLOC_SIZE): Replace predefined
__clang_major/minor__ testing with __has_attribute() one (in case of
clang).