]> granicus.if.org Git - gc/log
gc
9 years agoAdd profiling callback events to indicate start/end of reclaim phase
Ivan Maidanski [Tue, 23 Jun 2015 11:52:41 +0000 (14:52 +0300)]
Add profiling callback events to indicate start/end of reclaim phase

* alloc.c (GC_finish_collection): Send GC_EVENT_RECLAIM_START and
GC_EVENT_RECLAIM_END to indicate objects marking phase start/end.
* include/gc.h (GC_EventType): Add GC_EVENT_RECLAIM_START/END.

9 years agoStandalone profiling callback for threads suspend/resume
Ivan Maidanski [Tue, 23 Jun 2015 11:39:29 +0000 (14:39 +0300)]
Standalone profiling callback for threads suspend/resume

* alloc.c (GC_on_collection_event, GC_set_on_collection_event,
GC_get_on_collection_event): Move from misc.c.
* alloc.c (GC_on_collection_event): Make STATIC.
* include/private/gc_priv.h (GC_on_collection_event): Remove
declaration.
* include/gc.h (GC_on_collection_event_proc): Remove 2nd argument of
the callback.
* alloc.c (GC_try_to_collect_inner, GC_stopped_mark): Likewise.
* darwin_stop_world.c (GC_suspend_thread_list, GC_stop_world,
GC_thread_resume): Use GC_on_thread_event instead of
GC_on_collection_event.
* pthread_stop_world.c (GC_suspend_all, GC_start_world): Likewise.
* win32_threads.c (GC_suspend, GC_start_world): Likewise.
* include/gc.h (GC_on_collection_event_proc): Update comment.
* include/gc.h (GC_set_on_collection_event,
GC_get_on_collection_event): Add comment.
* include/gc.h (GC_on_thread_event_proc): New callback type (only if
GC_THREADS).
* include/gc.h (GC_set_on_thread_event, GC_get_on_thread_event): New
API function declaration (only if GC_THREADS).
* include/private/gc_priv.h (GC_on_thread_event): New variable
declaration (only if THREADS).
* misc.c (GC_on_thread_event): New global variable (only if THREADS).
* misc.c (GC_set_on_thread_event, GC_get_on_thread_event): New API
function (only if THREADS).

9 years agoAdjust places where profiling callbacks invoked (to match Mono GC)
Ivan Maidanski [Sat, 20 Jun 2015 19:22:07 +0000 (22:22 +0300)]
Adjust places where profiling callbacks invoked (to match Mono GC)

* alloc.c (GC_try_to_collect_inner): Move sending of GC_EVENT_START to
the beginning of function (i.e. send right after GC_dont_gc check);
move sending of GC_EVENT_END from GC_finish_collection to the end of
this function (send it only if collection completed successfully); add
TODO note about GC_EVENT_ABANDON notification.
* alloc.c (start_world_inner): Remove.
* alloc.c (GC_stopped_mark): Send GC_EVENT_PRE_STOP_WORLD,
GC_EVENT_POST_STOP_WORLD, GC_EVENT_PRE_START_WORLD,
GC_EVENT_POST_START_WORLD only if THREADS.
* alloc.c (GC_stopped_mark): Send GC_EVENT_MARK_START before
minimizing junk left in registers/stack (instead of after).
* alloc.c (GC_stopped_mark): Do not send GC_EVENT_MARK_END in case of
abandoned collection (add TODO note about GC_EVENT_MARK_ABANDON).
* alloc.c (GC_stopped_mark): Send GC_EVENT_MARK_END after checking
debugged objects for consistency (instead of before it).
* darwin_stop_world.c (GC_suspend_thread_list): Send
GC_EVENT_THREAD_SUSPENDED (in addition to that in GC_stop_world).
* darwin_stop_world.c (GC_thread_resume): Move sending of
GC_EVENT_THREAD_UNSUSPENDED from GC_start_world().
* pthread_stop_world.c (GC_suspend_all, GC_start_world): Do not send
GC_EVENT_THREAD_SUSPENDED if pthread_kill/android_thread_kill failed.
* pthread_stop_world.c (GC_start_world): Send
GC_EVENT_THREAD_UNSUSPENDED after pthread_resume_np (in case of
GC_OPENBSD_UTHREADS).
* win32_threads.c (GC_stop_world): Move sending of
GC_EVENT_THREAD_SUSPENDED to GC_suspend().
* win32_threads.c (GC_suspend, GC_start_world): Remove redundant cast
to void* of THREAD_HANDLE().

9 years agoRename GCEventKind to GC_EventType (profiling event type)
Ivan Maidanski [Fri, 19 Jun 2015 21:26:07 +0000 (00:26 +0300)]
Rename GCEventKind to GC_EventType (profiling event type)

* include/gc.h (GCEventKind, GC_on_collection_event_proc): Rename
GCEventKind to GC_EventType.

9 years agoRename and reorder profiling callback events (to match Mono GC API)
Ivan Maidanski [Fri, 19 Jun 2015 16:23:29 +0000 (19:23 +0300)]
Rename and reorder profiling callback events (to match Mono GC API)

* include/gc.h (GCEventKind): Reorder events.
* include/gc.h (GCEventKind): Rename events (GC_EVENT_COLLECTION_BEGIN
to GC_EVENT_START, GC_EVENT_MARK_BEGIN to GC_EVENT_MARK_START,
GC_EVENT_COLLECTION_END to GC_EVENT_END,
GC_EVENT_STOPWORLD_BEGIN/END to GC_EVENT_PRE/POST_STOP_WORLD,
GC_EVENT_STARTWORLD_BEGIN/END to GC_EVENT_PRE/POST_START_WORLD).
* alloc.c (GC_try_to_collect_inner, start_world_inner, GC_stopped_mark,
GC_finish_collection): Likewise.

9 years agoMerge branch 'profiling-callbacks'
Ivan Maidanski [Sun, 17 May 2015 18:03:22 +0000 (21:03 +0300)]
Merge branch 'profiling-callbacks'

9 years agoCode refactoring of "event callbacks" functionality
Ivan Maidanski [Sun, 17 May 2015 15:23:52 +0000 (18:23 +0300)]
Code refactoring of "event callbacks" functionality

* alloc.c (GC_on_collection_event): Remove declaration (moved to
gc_priv.h).
* darwin_stop_world.c (GC_on_collection_event): Likewise.
* pthread_stop_world.c (GC_on_collection_event): Likewise.
* win32_threads.c (GC_on_collection_event): Likewise.
* alloc.c (start_world): Rename to start_world_inner; inline it.
* darwin_stop_world.c (GC_start_world): Wrap long code lines.
* pthread_stop_world.c (GC_suspend_all, GC_start_world): Likewise.
* win32_threads.c (GC_stop_world, GC_start_world): Likewise.
* include/gc.h: Remove trailing space at EOLn.
* include/private/gc_priv.h (GC_on_collection_event): Declare global
variable (using GC_EXTERN).
* misc.c (GC_on_collection_event): Add GC_INNER; replace NULL to 0.

9 years agoFix logic/compile errors in "event callbacks" code (Darwin, Pthreads)
Ivan Maidanski [Sun, 17 May 2015 14:37:51 +0000 (17:37 +0300)]
Fix logic/compile errors in "event callbacks" code (Darwin, Pthreads)

* darwin_stop_world.c (GC_stop_world): Replace
GC_EVENT_THREAD_UNSUSPENDED to GC_EVENT_THREAD_SUSPENDED.
* pthread_stop_world.c (GC_on_collection_event): Declare.
* pthread_stop_world.c (GC_suspend_all): Change type of "thread_id"
local variable to pthread_t (or pid_t for Android) instead of int; fix
"threadid" parameter to "thread_id" in GC_on_collection_event call;
implement notification for NaCl target.
* pthread_stop_world.c (GC_start_world): Declare "thread_id" local
variable; implement notification for NaCl target.

9 years agoUpdate AUTHORS file
Ivan Maidanski [Sun, 17 May 2015 11:43:35 +0000 (14:43 +0300)]
Update AUTHORS file

9 years agoUpdate AUTHORS file
Ivan Maidanski [Sun, 17 May 2015 11:10:32 +0000 (14:10 +0300)]
Update AUTHORS file

9 years agoAdd build system plumbing for building with -Werror.
Alex Ronne Petersen [Tue, 10 Jun 2014 07:34:01 +0000 (09:34 +0200)]
Add build system plumbing for building with -Werror.

* Makefile.am (AM_CFLAGS): Add $(WERROR_CFLAGS).
* configure.ac (WERROR_CFLAGS): Define based on --enable-werror new
configure option value.

Conflicts:

    Makefile.am
    configure.ac

9 years agoUpdate ChangeLog file
Ivan Maidanski [Sat, 16 May 2015 10:56:03 +0000 (13:56 +0300)]
Update ChangeLog file

9 years agoUpdate ChangeLog file
Ivan Maidanski [Thu, 14 May 2015 22:00:01 +0000 (01:00 +0300)]
Update ChangeLog file
(Apply commit e2ed67b from 'release-7_4' branch.)

Conflicts:

    ChangeLog

9 years agoMerge branch 'jtotz-bdwgc-integrate-2'
Ivan Maidanski [Mon, 11 May 2015 16:16:08 +0000 (19:16 +0300)]
Merge branch 'jtotz-bdwgc-integrate-2'

9 years agoAvoid new[] debug variant definition for ancient MS VC++
Ivan Maidanski [Mon, 4 May 2015 20:21:06 +0000 (23:21 +0300)]
Avoid new[] debug variant definition for ancient MS VC++
(restore behavior broken in commit 3d784ed)

* include/gc_cpp.h (operator new[]): Update comment.
* include/gc_cpp.h (operator new[]): Do not define the debug variant
for MS VC pre-v7; add comment.

Conflicts:

    include/gc_cpp.h

9 years agoRe-enable gc_cpp.h usage for GC compiled without ATOMIC_UNCOLLECTABLE
Ivan Maidanski [Fri, 10 Apr 2015 23:01:41 +0000 (02:01 +0300)]
Re-enable gc_cpp.h usage for GC compiled without ATOMIC_UNCOLLECTABLE

GC_ATOMIC_UNCOLLECTABLE macro is recognized (in gc_cpp.h) to enable
GC_malloc_atomic_uncollectable functionality.

* include/gc_cpp.h (enum GCPlacement): Remove NoGCPointerFree alias.
* include/gc_cpp.h (enum GCPlacement): Do not declare PointerFreeNoGC
element unless GC_ATOMIC_UNCOLLECTABLE defined.
* include/gc_cpp.h (gc::operator new, operator new): Do not handle
PointerFreeNoGC (and do not call GC_MALLOC_ATOMIC_UNCOLLECTABLE) unless
GC_ATOMIC_UNCOLLECTABLE defined.

9 years agoReformat code of gc_cpp.cc/h
Ivan Maidanski [Mon, 11 May 2015 15:25:22 +0000 (18:25 +0300)]
Reformat code of gc_cpp.cc/h

* include/gc_cpp.h: Reformat code (and comments).
* gc_cpp.cc: Likewise.
* include/gc_cpp.h (operator new): Replace if-then-else with switch.

Conflicts:

    include/gc_cpp.h

9 years agoRestore definition of new/delete operators in gc_cpp.cc (for non-VC)
Ivan Maidanski [Mon, 4 May 2015 17:28:24 +0000 (20:28 +0300)]
Restore definition of new/delete operators in gc_cpp.cc (for non-VC)
(revert part of commit 3d784ed)

* gc_cpp.cc (new, delete, new[], delete[]): Add definition (unless
_MSC_VER defined).

Conflicts:

    gc_cpp.cc

9 years agoRemove commented out code in gc_cpp.cc/h
Ivan Maidanski [Mon, 11 May 2015 15:12:03 +0000 (18:12 +0300)]
Remove commented out code in gc_cpp.cc/h
(code refactoring)

* gc_cpp.cc: Remove commented out code.
* include/gc_cpp.h: Likewise.

Conflicts:

    gc_cpp.cc
    include/gc_cpp.h

9 years agoput all the cpp stuff in header
Johannes Totz [Tue, 13 Jul 2010 14:14:53 +0000 (15:14 +0100)]
put all the cpp stuff in header
otherwise vc9 will mix up new and delete operators (due to arbitrary ordering during linking)

Conflicts:

gc_cpp.cc
include/gc_cpp.h

9 years agoenable atomic-uncollectable
Johannes Totz [Mon, 24 Jan 2011 17:56:37 +0000 (17:56 +0000)]
enable atomic-uncollectable
pretty much the same as system's malloc, but is useful in force-include scenarios

Conflicts:

    include/gc.h
    include/gc_cpp.h
    vc9/libgc.vcproj

9 years agoEnable gc.h inclusion by client without implicit include windows.h (Win32)
Ivan Maidanski [Fri, 8 May 2015 06:26:36 +0000 (09:26 +0300)]
Enable gc.h inclusion by client without implicit include windows.h (Win32)

* doc/README.macros (GC_DONT_INCLUDE_WINDOWS_H): Document.
* include/gc.h: Include windows.h unless GC_DONT_INCLUDE_WINDOWS_H
(only for Win32).
* include/gc.h (DECLSPEC_NORETURN): Define to __declspec(noreturn) by
default if windows.h not included (instead of empty).
* include/gc.h (GC_WIN32_SIZE_T): Define to DWORD (or unsigned long)
unless _WIN64 (instead of GC_uintptr_t which is unsigned int for
32-bit target).
* include/gc.h (GC_DllMain, GC_CreateThread, GC_ExitThread): If WINAPI
undefined (i.e., if windows.h not included by or prior to gc.h) then
declare the prototype using built-in C types instead of Windows types.

9 years agoAdjust code indentation of malloc/calloc/str[n]dup
Ivan Maidanski [Thu, 16 Apr 2015 07:33:16 +0000 (10:33 +0300)]
Adjust code indentation of malloc/calloc/str[n]dup
(and do not define GC_init_lib_bounds if unused)

* malloc.c (GC_debug_malloc_replacement): Do not define/undefine macro
if REDIRECT_MALLOC_IN_HEADER.
* malloc.c (GC_libpthread_start, GC_libpthread_start,
GC_libpthread_end, GC_libld_start, GC_init_lib_bounds): Do not define
if REDIRECT_MALLOC_IN_HEADER.
* malloc.c (GC_debug_malloc_replacement, malloc, GC_init_lib_bounds,
calloc, strdup, strndup, free): Reformat code (adjust indentation) and
comments.
* malloc (free): Do not call GC_free if IGNORE_FREE defined.

Conflicts:

malloc.c

9 years agoRecognize REDIRECT_MALLOC_IN_HEADER macro
Ivan Maidanski [Sun, 25 Nov 2012 08:07:13 +0000 (12:07 +0400)]
Recognize REDIRECT_MALLOC_IN_HEADER macro

* include/private/gcconfig.h: Do not issue error on REDIRECT_MALLOC
and THREADS if REDIRECT_MALLOC_IN_HEADER defined.
* malloc.c (malloc, calloc, strdup, strndup, free): Do not define if
REDIRECT_MALLOC_IN_HEADER.
* mallocx.c (realloc): Likewise.

Conflicts:

    include/gc.h
    include/private/gcconfig.h
    malloc.c
    mallocx.c

9 years agoDo not pass VC-specific 'pragma message' in gc.h to other compilers (Win64)
Ivan Maidanski [Sun, 5 Apr 2015 15:59:45 +0000 (18:59 +0300)]
Do not pass VC-specific 'pragma message' in gc.h to other compilers (Win64)

* include/gc.h: Pass pragma message (to identify missing predefined
symbols for Win64) only if _MSC_VER (as it is specific to VC); report
the message only on first gc.h inclusion; adjust related comment.

Conflicts:

    include/gc.h

9 years agodebug helper for preproc symbol mix up
Johannes Totz [Tue, 24 Aug 2010 19:40:51 +0000 (20:40 +0100)]
debug helper for preproc symbol mix up
i got bitten by it... for some reason _WIN64 is not defined all the time. glitch in vc9?

Conflicts:

    include/gc.h

9 years agoRemove erroneous GC_use_threads_discovery call from GC_DllMain
Ivan Maidanski [Sun, 25 Nov 2012 09:42:04 +0000 (13:42 +0400)]
Remove erroneous GC_use_threads_discovery call from GC_DllMain

* win32_threads.c (GC_use_threads_discovery): Uncomment assertion;
update comment.
* win32_threads.c (GC_DllMain): Remove erroneous
GC_use_threads_discovery call; add comment.
* windows-untested/vc9/libgc.vcproj (PreprocessorDefinitions): Add
GC_DISCOVER_TASK_THREADS (due to removal of GC_use_threads_discovery
from GC_DllMain).

Conflicts:

    win32_threads.c

9 years agovc9: Move to windows-untested; adjust scripts in *.vcproj
Ivan Maidanski [Sun, 18 Nov 2012 08:18:50 +0000 (12:18 +0400)]
vc9: Move to windows-untested; adjust scripts in *.vcproj

9 years agono _DLL should not be defined here! it's predefined by the compiler
Johannes Totz [Thu, 24 Mar 2011 12:36:25 +0000 (12:36 +0000)]
no _DLL should not be defined here! it's predefined by the compiler
depending on which runtime library option was enabled

Conflicts:

    vc9/libgc.vcproj

9 years agoadd two more test cases
Johannes Totz [Fri, 20 Aug 2010 01:09:56 +0000 (02:09 +0100)]
add two more test cases

Conflicts:

tests/huge_test.c

9 years agoadd x64
Johannes Totz [Thu, 29 Jul 2010 15:18:09 +0000 (16:18 +0100)]
add x64
note that size_t types are 64 bit wide on x64 whereas dword types stay fixed at being 32 bit wide

Conflicts:

    include/gc.h
    win32_threads.c

9 years agofix us some project files for vc9
Johannes Totz [Tue, 13 Jul 2010 14:15:27 +0000 (15:15 +0100)]
fix us some project files for vc9

Conflicts:

windows-untested/vc60/gc.dsp
windows-untested/vc60/libgc.dsp
windows-untested/vc60/libgcmt.dsp
windows-untested/vc70/gc.vcproj
windows-untested/vc70/libgc.vcproj
windows-untested/vc70/libgcmt.vcproj

9 years agoResolve MessageBoxA at run-time (if requested) in GC_init (Win32)
Ivan Maidanski [Sat, 2 Aug 2014 08:17:57 +0000 (12:17 +0400)]
Resolve MessageBoxA at run-time (if requested) in GC_init (Win32)
(and code refactoring of GC_abort)

* misc.c (GC_win32_MessageBoxA): New static routine (only if MSWIN32,
move code from GC_abort).
* misc.c (GC_init, GC_abort): Replace MessageBoxA with
GC_win32_MessageBoxA call (to resolve "MessageBoxA" at run-time if
DONT_USE_USER32_DLL).

Conflicts:

misc.c

9 years agoDo not show WoW64 warning message unless CHECK_NOT_WOW64 defined (Win32)
Ivan Maidanski [Sat, 2 Aug 2014 07:51:16 +0000 (11:51 +0400)]
Do not show WoW64 warning message unless CHECK_NOT_WOW64 defined (Win32)

* misc.c (GC_init): Do not show warning message box about WoW64 unless
CHECK_NOT_WOW64 (and GC_WIN32_THREADS); use GetModuleHandle instead of
GetModuleHandleA; check GetModuleHandle result; refine comment;
reformat code.

Conflicts:

misc.c

9 years agogc_init() is a better place for this warning
Johannes Totz [Mon, 24 Jan 2011 18:11:52 +0000 (18:11 +0000)]
gc_init() is a better place for this warning

Conflicts:

misc.c
win32_threads.c

9 years agoNew macro (NO_WINMAIN_ENTRY) to prefer main() instead of WinMain (Win32)
Ivan Maidanski [Mon, 7 Jul 2014 07:12:31 +0000 (11:12 +0400)]
New macro (NO_WINMAIN_ENTRY) to prefer main() instead of WinMain (Win32)

* tests/test.c (WinMain): Do not define if NO_WINMAIN_ENTRY (define
main() instead).
* tests/test_cpp.cc (WinMain): Define (instead of main()) for MSWIN32
and WinCE (but not for MinGW and not if NO_WINMAIN_ENTRY).

Conflicts:

tests/test.c
tests/test_cpp.cc

9 years agohuge_test: turn GC_WORD_MAX into a signed constant
Ivan Maidanski [Thu, 10 Jul 2014 21:03:54 +0000 (01:03 +0400)]
huge_test: turn GC_WORD_MAX into a signed constant

* tests/huge_test.c (GC_IGNORE_WARN): Refine comment.
* tests/huge_test.c (GC_WORD_MAX): Replace with GC_SWORD_MAX; change
type to GC_signed_word.

9 years agoEnable huge_test for Win64 (and LLP64 target)
Ivan Maidanski [Sun, 18 Nov 2012 08:32:34 +0000 (12:32 +0400)]
Enable huge_test for Win64 (and LLP64 target)

* tests/huge_test.c (GC_WORD_MAX): New macro
* tests/huge_test.c (main): Do not check for long has the same size as
pointer; use unsigned GC_WORD_MAX instead of LONG_MAX; use NULL
instead of 0 for pointers.

Conflicts:

tests/huge_test.c

9 years agoRename ATOMIC_UNCOLLECTABLE to GC_ATOMIC_UNCOLLECTABLE
Ivan Maidanski [Sat, 11 Apr 2015 07:25:45 +0000 (10:25 +0300)]
Rename ATOMIC_UNCOLLECTABLE to GC_ATOMIC_UNCOLLECTABLE
(code refactoring)

* Makefile.direct (CFLAGS): Add GC_ prefix to ATOMIC_UNCOLLECTABLE.
* SMakefile.amiga: Likewise.
* configure.ac (enable_atomic_uncollectible): Likewise.
* dbg_mlc.c (GC_print_obj, GC_debug_malloc_atomic_uncollectable,
GC_debug_free, GC_debug_realloc): Likewise.
* doc/README.Mac: Likewise.
* doc/README.macros (ATOMIC_UNCOLLECTABLE): Likewise.
* extra/AmigaOS.c (GC_amiga_allocwrapper_any): Likewise.
* include/new_gc_alloc.h: Likewise.
* include/private/gc_priv.h (struct _GC_arrays, AUNCOLLECTABLE):
Likewise.
* mallocx.c (GC_auobjfreelist_ptr, GC_generic_or_special_malloc,
GC_malloc_atomic_uncollectable): Likewise.
* mark.c (GC_obj_kinds, GC_N_KINDS_INITIAL_VALUE): Likewise.
* include/private/gc_priv.h (GC_ATOMIC_UNCOLLECTABLE): Define if
ATOMIC_UNCOLLECTABLE defined (for compatibility with the clients that
do not use GC makefiles).

9 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 agoRemove commented out code in AmigaOS.c, gcconfig.h and os_dep.c
Ivan Maidanski [Mon, 6 Apr 2015 17:27:02 +0000 (20:27 +0300)]
Remove commented out code in AmigaOS.c, gcconfig.h and os_dep.c

* doc/README.amiga: Remove note about "#if 0'ed" code.
* extra/AmigaOS.c: Remove "#if 0'ed" code.
* include/private/gcconfig.h: Likewise.
* os_dep.c: Likewise.

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 agoGC_stack_range_for code refactoring for Darwin/arm64
Ivan Maidanski [Tue, 17 Mar 2015 23:32:30 +0000 (02:32 +0300)]
GC_stack_range_for code refactoring for Darwin/arm64

* darwin_stop_world.c (GC_stack_range_for): Replace "__" register name
prefix with THREAD_FLD(); roll x[0..28] push statements in a loop (for
AARCH64).

9 years agoAdd incremental GC support for Darwin/arm64
Ivan Maidanski [Tue, 17 Mar 2015 22:06:02 +0000 (01:06 +0300)]
Add incremental GC support for Darwin/arm64

* os_dep.c (DARWIN_EXC_STATE, DARWIN_EXC_STATE_COUNT,
DARWIN_EXC_STATE_T, DARWIN_EXC_STATE_DAR): Define for AARCH64 target.

9 years agoInitial support for iOS ARM64 (Aarch64)
Niklas Therning [Fri, 12 Dec 2014 14:58:45 +0000 (15:58 +0100)]
Initial support for iOS ARM64 (Aarch64)

* darwin_stop_world.c (GC_stack_range_for): Handle AARCH64 case.
* include/private/gc_priv.h (GC_THREAD_STATE_T, GC_MACH_THREAD_STATE,
GC_MACH_THREAD_STATE_COUNT): Define for AARCH64.
* include/private/gcconfig.h (OS_TYPE, DYNAMIC_LOADING, DATASTART,
DATAEND, STACKBOTTOM, USE_MMAP, USE_MMAP_ANON, MPROTECT_VDB,
GETPAGESIZE, NO_PTHREAD_TRYLOCK, NO_DYLD_BIND_FULLY_IMAGE): Likewise.
* include/private/gcconfig.h (AARCH64, mach_type_known,
DARWIN_DONT_PARSE_STACK): Define for Darwin/AArch64.

9 years agoMerge branch 'master' into ios-unified-ts-fix
Ivan Maidanski [Sat, 28 Feb 2015 20:01:14 +0000 (23:01 +0300)]
Merge branch 'master' into ios-unified-ts-fix

Conflicts:
include/private/gc_priv.h

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 agoAdd AArch64-32 target support
Andrew Pinski [Fri, 13 Feb 2015 17:44:37 +0000 (20:44 +0300)]
Add AArch64-32 target support
(Implement boehm-gc for AARCH64:ILP32)

* include/private/gcconfig.h (CPP_WORDSZ, ALIGNMENT): Correct for
AARCH64:ILP32.

9 years agoGC_stack_range_for code refactoring (Darwin/arm)
Ivan Maidanski [Fri, 23 Jan 2015 08:20:53 +0000 (11:20 +0300)]
GC_stack_range_for code refactoring (Darwin/arm)

* darwin_stop_world.c (GC_stack_range_for): Roll GC_push_one() calls
to a loop (for ARM32 only).
* os_dep.c: Remove redundant include mach/thread_status.h as already
included from gc_priv.h (for DARWIN only).

9 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.

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)

10 years agoGC_stack_range_for iOS 32/64-bit code refactoring (Darwin/arm)
Ivan Maidanski [Mon, 17 Nov 2014 20:02:16 +0000 (23:02 +0300)]
GC_stack_range_for iOS 32/64-bit code refactoring (Darwin/arm)

* darwin_stop_world.c (kCFCoreFoundationVersionNumber_iOS_8_0): Move
definition out of GC_stack_range_for.
* darwin_stop_world.c (GC_stack_range_for): Refine comment and abort
message; eliminate code duplication regarding thread_get_state call.

10 years agoAvoid explicit use of machine-specific x_THREAD_STATE macros (Darwin)
Ivan Maidanski [Tue, 4 Nov 2014 14:55:18 +0000 (17:55 +0300)]
Avoid explicit use of machine-specific x_THREAD_STATE macros (Darwin)
(code refactoring)

* include/private/gc_priv.h (GC_MACH_THREAD_STATE,
GC_MACH_THREAD_STATE_COUNT): Remove explicit definition to
PPC_THREAD_STATE[_COUNT], ARM_THREAD_STATE[_COUNT] (as the correct
values are defined via MACHINE_THREAD_STATE[_COUNT] macro).

10 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).

10 years agoMerge remote-tracking branch 'robovm/thread_get_state_stack_corruption_on_ios7_64bit_...
Ivan Maidanski [Tue, 4 Nov 2014 08:14:24 +0000 (11:14 +0300)]
Merge remote-tracking branch 'robovm/thread_get_state_stack_corruption_on_ios7_64bit_and_ios8'

Conflicts:
darwin_stop_world.c

10 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).

10 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.

10 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.

10 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).

10 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).

10 years agoFix missing error handling of pthreads_mutex_init and cond_wait
Ivan Maidanski [Sat, 27 Sep 2014 15:30:06 +0000 (19:30 +0400)]
Fix missing error handling of pthreads_mutex_init and cond_wait

* include/private/darwin_semaphore.h (sem_init): Destroy sem->mutex if
sem->cond initialization failed.
* include/private/darwin_semaphore.h (sem_post): Ignore
pthread_mutex_unlock result in case of pthread_cond_signal.
* include/private/darwin_semaphore.h (sem_wait): Unlock mutex and
return error (-1) if pthread_cond_wait failed.
* include/private/darwin_semaphore.h (sem_init): If pshared then
return -1 (with the appropriate errno code set) instead of ABORT.
* include/private/darwin_semaphore.h (sem_init, sem_post, sem_wait):
Treat non-zero value returned by pthread functions as error (instead
of only negative values).
* include/private/darwin_semaphore.h (sem_init, sem_post, sem_wait):
Reformat code.
* misc.c (GC_init): Abort (with the appropriate message) if
pthread_mutex[attr]_init failed (SN_TARGET_PS3 case only).
* specific.c (GC_key_create_inner): If pthread_mutex_init failed then
return its error code.

10 years agoWorkaround 'unknown attribute __alloc_size__' warning for Clang 3.5 (trunk)
Ivan Maidanski [Wed, 24 Sep 2014 18:47:59 +0000 (22:47 +0400)]
Workaround 'unknown attribute __alloc_size__' warning for Clang 3.5 (trunk)

* include/gc_config_macros.h (GC_ATTR_ALLOC_SIZE): Define to empty if
clang 3.5.0 (workaround "unknown attribute '__alloc_size__' ignored"
warning in clang3.5 (trunk)).

10 years agoFix darwin_stop_world.c broken by 'thread_get_state fix' for other targets
Ivan Maidanski [Tue, 23 Sep 2014 20:04:39 +0000 (00:04 +0400)]
Fix darwin_stop_world.c broken by 'thread_get_state fix' for other targets

* darwin_stop_world.c: Include Darwin-specific headers (sys/sysctl.h,
mach/machine.h) only if GC_DARWIN_THREADS.

10 years agoAlso enable the TSX workaround for i386 (Linux)
Jan Alexander Steffens (heftig) [Thu, 11 Sep 2014 21:06:46 +0000 (23:06 +0200)]
Also enable the TSX workaround for i386 (Linux)

* include/private/gcconfig.h (GLIBC_2_19_TSX_BUG): Define for
LINUX/I386 (if __GLIBC__).

10 years agoUpdate AUTHORS file
Ivan Maidanski [Tue, 23 Sep 2014 19:42:17 +0000 (23:42 +0400)]
Update AUTHORS file

10 years agoRelax mark_mutex attribute needed to disable elision (Linux/x64)
Jan Alexander Steffens (heftig) [Thu, 11 Sep 2014 21:01:16 +0000 (23:01 +0200)]
Relax mark_mutex attribute needed to disable elision (Linux/x64)

* pthread_support.c (setup_mark_lock): Pass PTHREAD_MUTEX_NORMAL
(instead of PTHREAD_MUTEX_ERRORCHECK) to pthread_mutexattr_settype
(actually, any valid settype call disables lock elision in glibc 2.19).

10 years agoFix setup_mark_lock missing prototype
Ivan Maidanski [Tue, 23 Sep 2014 19:20:08 +0000 (23:20 +0400)]
Fix setup_mark_lock missing prototype
(and do not call it if no parallel marker)

* include/private/pthread_support.h (GC_setup_mark_lock): Remove
prototype.
* misc.c (GC_init): Remove GC_setup_mark_lock call (move it to
GC_thr_init).
* pthread_support.c (setup_mark_lock): Rename from GC_setup_mark_lock;
add prototype (only if PARALLEL_MARK).
* pthread_support.c (GC_thr_init): Call setup_mark_lock() unless
available_markers_m1 is 0.

10 years agoUse ARM_UNIFIED_THREAD_STATE in the call to thread_get_state() on iOS7 64-bit
Niklas Therning [Mon, 22 Sep 2014 12:56:18 +0000 (14:56 +0200)]
Use ARM_UNIFIED_THREAD_STATE in the call to thread_get_state() on iOS7 64-bit
and up and iOS8 32-bit and up.

10 years agoMerge pull request #52 from robovm/thread_get_state_stack_corruption_on_ios_64bit
Ivan Maidanski [Sat, 20 Sep 2014 18:12:09 +0000 (22:12 +0400)]
Merge pull request #52 from robovm/thread_get_state_stack_corruption_on_ios_64bit

Use ARM_THREAD_STATE32 as flavor in call to thread_get_state (Darwin/AArch64)

10 years agoUse the ARM_THREAD_STATE32 flavor in the call to thread_get_state() when
Niklas Therning [Thu, 18 Sep 2014 19:17:40 +0000 (21:17 +0200)]
Use the ARM_THREAD_STATE32 flavor in the call to thread_get_state() when
running on 64-bit iOS 7+. If we don't iOS will assume we pass it an
arm_unified_thread_state_t while we actually pass it an arm_thread_state_t
which is a lot smaller. Without this fix thread_get_state() will corrupt the
stack and the app will crash.

10 years agoModified darwin_stop_world.c to use an arm_unified_thread_state_t struct to
Niklas Therning [Wed, 17 Sep 2014 16:09:55 +0000 (18:09 +0200)]
Modified darwin_stop_world.c to use an arm_unified_thread_state_t struct to
store a thread's state when compiling against the iOS 7/8 SDK. Without this
patch GC_stack_range_for() crashes when running a 32-bit app on iOS 64-bit.
The old code passed an arm_thread_state_t and ARM_THREAD_STATE to
thread_get_state(). ARM_THREAD_STATE is the same as ARM_UNIFIED_THREAD_STATE
on iOS 7/8 and thread_get_state() actually expects an
arm_unified_thread_state_t. On iOS 32-bit it looks like thread_get_state()
only touches the first bytes corresponding to the size of arm_thread_state_t
so no crash there. On iOS 64-bit however it seems thread_get_state() writes to
the full arm_unified_thread_state_t which meant it would overflow the stack
allocated struct passed to it and mess up other values on the stack leading to
a crash later on.

10 years agoFix and code refactoring of lock elision workaround (Linux/x64)
Ivan Maidanski [Sat, 19 Jul 2014 08:52:54 +0000 (12:52 +0400)]
Fix and code refactoring of lock elision workaround (Linux/x64)

* configure.ac (HAVE_LIBC_VERSION_H, HAVE_GNU_GET_LIBC_VERSION): Remove
(revert change in previous commit).
* include/private/gcconfig.h (GLIBC_2_19_TSX_BUG): New macro defined
for Linux/x86_64 (if Glibc used) to workaround a bug in Glibc lock
elision implementation.
* pthread_support.c: Move include of gnu/libc-version.h to gcconfig.h
(used to check whether lock elision workaround needed).
* misc.c (GC_init): Reformat code.
* pthread_support.c (mark_mutex): Initialize (to
PTHREAD_MUTEX_INITIALIZER) even lock elision workaround is needed
(revert change in previous commit).
* pthread_support.c (parse_version): New static function (defined only
if GLIBC_2_19_TSX_BUG).
* pthread_support.c (GC_setup_mark_lock): Use parse_version to check
target Glibc version properly; do not reinitialize mutex unless
workaround needed; call ABORT (with the appropriate message) in case
of a failure in pthread_mutexattr_init/settype, pthread_mutex_init.

10 years agoWorkaround Linux NTPL lock elision bug.
Paul Bone [Wed, 25 Jun 2014 01:17:50 +0000 (11:17 +1000)]
Workaround Linux NTPL lock elision bug.

glibc 2.19 on Linux x86-64 platforms includes support for lock elision,
by using Intel's TSX support when it is available.  Without modifying an
application this converts suitable critical sections that use mutex into
transactional memory critical sections.  See http://lwn.net/Articles/534758/
If a problem occurs that means that transactional memory can't be used, such
as a system call or buffer overflow, the pthreads implementation will catch
this error and retry the critical section using a normal mutex.

I noticed that since upgrading glibc that programs using Boehm GC crash, one
of these crashes was an assertion that the owner field of a mutex was
invalid.  The assertion was generated by the pthreads implementation.
I believe that there is a bug in glibc that when a mutex cannot be used
safely for transactions that some series of events causes it's owner field
to be set incorrectly (or cleared when it shouldn't be).

I've found that I can work around this problem by having Boehm GC use an
error checking mutex, which I believe doesn't use lock elision and in my
testing doesn't crash.

XXX: This work-around mostly works except for linking the feature detection
in configure.ac to the conditional compilation in pthread_support.c as there
isn't an obvious way to make it work for automake and Makefile.direct.
Could I have some help updating the build system please?

include/private/pthread_support.h:
pthread_support.c:
    Define GC_setup_mark_lock()  This procedure creates the lock specifying a
    pthread_mutexattr_t structure.  This is used to disable lock elision on
    Linux with glibc 2.19 or greater.

configure.ac:
    If we're using Linux then check for the gnu extensions required to
    identify the version of glibc at runtime.

misc.c:
    Call GC_setup_mark_lock() when initialising the collector.

10 years agoFix getcontext usage on OpenRISC/or1k
Manuel A. Fernandez Montecelo [Sat, 23 Aug 2014 09:19:43 +0000 (13:19 +0400)]
Fix getcontext usage on OpenRISC/or1k

* include/private/gcconfig.h (NO_GETCONTEXT): Do not use getcontext(2)
on OpenRISC 1000 (or1k) as it is not implemented yet.

10 years agoUpdate AUTHORS file (update email for Peter Wang)
Ivan Maidanski [Sat, 23 Aug 2014 08:58:13 +0000 (12:58 +0400)]
Update AUTHORS file (update email for Peter Wang)

10 years agoSupport winpthreads
Peter Wang [Sat, 23 Aug 2014 08:48:37 +0000 (12:48 +0400)]
Support winpthreads

Winpthreads is a different pthread implementation for MinGW-w64.
This patch redefines GC_WIN32_PTHREADS to mean either pthreads-win32
or winpthreads.

* configure.ac (GC_WIN32_PTHREADS): Improve description to cover
"winpthreads" library.
* doc/README.macros (GC_WIN32_PTHREADS): Likewise.
* doc/README.win32: Likewise.
* include/gc_config_macros.h (GC_WIN32_THREADS): Mention "winpthreads"
library in comment.
* win32_threads.c (GC_pthread_join): Likewise.
* include/private/gc_locks.h (NUMERIC_THREAD_ID, THREAD_EQUAL,
NUMERIC_THREAD_ID_UNIQUE): Define to support winpthreads properly (if
GC_WIN32_PTHREADS).
* win32_threads.c (GC_PTHREAD_PTRVAL): Likewise.

10 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

* 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.

10 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

* 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.

10 years agoUpdate AUTHORS file
Ivan Maidanski [Sat, 2 Aug 2014 09:16:54 +0000 (13:16 +0400)]
Update AUTHORS file

10 years agoAdd support for OpenRISC/or1k
Manuel A. Fernandez Montecelo [Sat, 2 Aug 2014 09:12:08 +0000 (13:12 +0400)]
Add support for OpenRISC/or1k

* include/private/gcconfig.h (OR1K, mach_type_known, CPP_WORDSZ,
MACH_TYPE, OS_TYPE, DYNAMIC_LOADING, _end, DATAEND, __data_start,
DATASTART, ALIGNMENT, HBLKSIZE, LINUX_STACKBOTTOM): Define for __or1k__.

10 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.

10 years agoMerge branch 'Unity-Technologies-upstreaming/emscripten'
Ivan Maidanski [Sun, 13 Jul 2014 08:40:52 +0000 (12:40 +0400)]
Merge branch 'Unity-Technologies-upstreaming/emscripten'

10 years agoUpdate AUTHORS file
Ivan Maidanski [Sun, 13 Jul 2014 08:39:40 +0000 (12:39 +0400)]
Update AUTHORS file

10 years agoCode refactoring of Emscripten platform support (single-threaded)
Ivan Maidanski [Sun, 13 Jul 2014 08:18:16 +0000 (12:18 +0400)]
Code refactoring of Emscripten platform support (single-threaded)

* alloc.c (min_bytes_allocd): Test STACK_NOT_SCANNED macro instead
of __EMSCRIPTEN__ (stack size to scan is zero if STACK_NOT_SCANNED).
* include/private/gcconfig.h (ALIGNMENT): Remove duplicate definition
for _EMSCRIPTEN__.
* include/private/gcconfig.h (STACK_NOT_SCANNED): New macro defined
for __EMSCRIPTEN__ target (in addition to  OS_TYPE, CPP_WORDSZ,
ALIGNMENT, DATASTART, DATAEND).
* mach_dep.c (GC_push_regs): Test STACK_NOT_SCANNED macro instead
of __EMSCRIPTEN__ (push nothing if STACK_NOT_SCANNED).
* mark_rts.c (GC_push_roots): Test STACK_NOT_SCANNED macro instead
of __EMSCRIPTEN__ (do not call GC_push_regs_and_stack if
STACK_NOT_SCANNED); mark cold_gc_frame argument as potentially unused.
* misc.c (GC_clear_stack): Test STACK_NOT_SCANNED macro instead
of __EMSCRIPTEN__ (do not clear stack if STACK_NOT_SCANNED).
* misc.c (GC_clear_stack): Reformat code.

10 years agoAdd support for emscripten platform
Jonathan Chambers [Fri, 16 May 2014 17:46:54 +0000 (13:46 -0400)]
Add support for emscripten platform

10 years agoImplement event callbacks to be used to profile the collector
Lucas Meijer [Tue, 1 Jul 2014 11:07:15 +0000 (13:07 +0200)]
Implement event callbacks to be used to profile the collector

10 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).

10 years agoUpdate TODO file (regarding Makefile.dj, build_atomic_ops.sh)
Ivan Maidanski [Sun, 22 Jun 2014 16:30:55 +0000 (20:30 +0400)]
Update TODO file (regarding Makefile.dj, build_atomic_ops.sh)

10 years agoFix EMX_MAKEFILE (adjust path to header files, add -I option)
Ivan Maidanski [Sun, 22 Jun 2014 16:26:02 +0000 (20:26 +0400)]
Fix EMX_MAKEFILE (adjust path to header files, add -I option)

* EMX_MAKEFILE: Remove comment about renaming to Makefile.
* EMX_MAKEFILE (CFLAGS, SPECIALCFLAGS): Add "-I include" option.
* EMX_MAKEFILE (CXXFLAGS): New variable (set to CFLAGS value).
* EMX_MAKEFILE (CORD_INCLUDE_FILES, test.o, setjmp_test.exe): Adjust
path to gc.h.
* EMX_MAKEFILE (SHELL): Remove special variable (not needed for EMX).
* EMX_MAKEFILE (test.o): Adjust path to dependencies (gc_priv.h,
gc_hdrs.h, gcconfig.h, gc_typed.h).
* EMX_MAKEFILE (gc_cpp.o, c++): Adjust path to gc_cpp.h.
* EMX_MAKEFILE (gc_cpp.o): Use CXXFLAGS value instead of "-O".
* EMX_MAKEFILE (c++): Do not copy gc_cpp.h to "include" folder.

10 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__.

10 years agoFix 'cord' headers path in EMX_MAKEFILE and README.QUICK
Ivan Maidanski [Sat, 21 Jun 2014 17:06:27 +0000 (21:06 +0400)]
Fix 'cord' headers path in EMX_MAKEFILE and README.QUICK

* EMX_MAKEFILE (CORD_INCLUDE_FILES): Replace cord/*.h files with
include/*.h ones (all "cord" header files moved in gc4.8).
* EMX_MAKEFILE (cords): Do not copy cord/*.h files to "include"
folder.
* README.QUICK: Replace cord/cord.h with include/cord.h; move sentence
about cord.h to the relevant paragraph.

10 years agoRemove Makefile.dj (and README.dj) in favor of configure (DJGPP)
Ivan Maidanski [Wed, 18 Jun 2014 23:29:19 +0000 (03:29 +0400)]
Remove Makefile.dj (and README.dj) in favor of configure (DJGPP)

* Makefile.am (EXTRA_DIST): Remove Makefile.dj entry.
* Makefile.direct (OTHER_MAKEFILES): Likewise.
* Makefile.direct (DOC_FILES): Remove doc/README.dj entry.
* doc/doc.am (dist_pkgdata_DATA): Likewise.
* Makefile.dj: Remove file ("configure" is to be used to build libgc,
no special options needed).
* doc/README.dj: Likewise.

10 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.

10 years agoRemove build_atomic_ops.sh
Ivan Maidanski [Tue, 17 Jun 2014 20:11:11 +0000 (00:11 +0400)]
Remove build_atomic_ops.sh

* Makefile.am (EXTRA_DIST): Remove build_atomic_ops.sh,
build_atomic_ops.sh.cygwin entries.
* Makefile.direct (OTHER_MAKEFILES): Likewise.
* Makefile.direct (AO_SRC_DIR): Update comment.
* Makefile.direct (AO_INSTALL_DIR): Remove variable.
* Makefile.direct (CFLAGS_EXTRA): New variable (empty by default).
* Makefile.direct (CFLAGS, SPECIALCFLAGS): Replace
"$(AO_INSTALL_DIR)/include" with "$(AO_SRC_DIR)/src" include folder.
* Makefile.direct (CFLAGS): Add $(CFLAGS_EXTRA).
* Makefile.direct (OBJS): Add atomic_ops.o, atomic_ops_sysdeps.o
entries.
* Makefile.direct (AO_INSTALL_DIR): Remove rule (build essential .o
files of libatomic_ops directly instead of configure and make).
* Makefile.direct (atomic_ops.o, atomic_ops_sysdeps.o): Add rule.
* Makefile.direct (tests/test.o, setjmp_test): Remove dependency on
$(AO_INSTALL_DIR).
* Makefile.direct (gc.a): Do not copy contents of libatomic_ops.a to
gc.a.
* Makefile.direct (sunos5gc.so): Do not link with libatomic_ops.a.
* Makefile.direct (gc.tar): Do not make libatomic_ops.
* build_atomic_ops.sh: Remove file.
* build_atomic_ops.sh.cygwin: Likewise.

10 years agoFix signedness of char values passed to isspace, iscntrl, isxdigit
Ivan Maidanski [Sun, 15 Jun 2014 07:39:12 +0000 (11:39 +0400)]
Fix signedness of char values passed to isspace, iscntrl, isxdigit
(eliminate 'array subscript has type char' GCC warning)

* cord/tests/de_win.c (WinMain, plain_chars, control_chars): Cast char
value to unsigned char when passed to isspace(), iscntrl().
* os_dep.c (GC_parse_map_entry): Change type of "start_start",
"end_start", "maj_dev_start", "p" local variables from char* to
unsgined char* (as isspace(), isxdigit() expect non-negative values);
insert casts between char* and unsigned char* where needed.
* os_dep.c (GC_parse_map_entry): Remove "endp" local variable (use "p"
variable directly instead).

10 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.

10 years agoFix 'redundant assignment to itself' Cppcheck warning in GC_scratch_alloc
Ivan Maidanski [Sat, 14 Jun 2014 16:11:54 +0000 (20:11 +0400)]
Fix 'redundant assignment to itself' Cppcheck warning in GC_scratch_alloc

* headers.c (GC_scratch_alloc): Do not reassign "bytes_to_get" local
variable to avoid compiler warning in case of ROUNDUP_PAGESIZE_IF_MMAP
is a no-op (i.e., assign bytes_to_get only once directly to a rounded
value).

10 years agoFix 'variable unused' warning in GC_save_callers
Ivan Maidanski [Sat, 14 Jun 2014 15:55:15 +0000 (19:55 +0400)]
Fix 'variable unused' warning in GC_save_callers

* os_dep.c (GC_save_callers): Do not declare "i" local variable unless
it is used.

10 years agoEliminate side effect in assertion condition in disclaim_bench
Ivan Maidanski [Sat, 14 Jun 2014 15:28:09 +0000 (19:28 +0400)]
Eliminate side effect in assertion condition in disclaim_bench
(code refactoring)

* tests/disclaim_bench.c (testobj_finalize): Move "i" field increment
out of assertion condition; replace increment with assignment.

10 years agoFix file descriptor resource leak in GC_register_data_segments (OS/2)
Ivan Maidanski [Fri, 13 Jun 2014 14:22:30 +0000 (18:22 +0400)]
Fix file descriptor resource leak in GC_register_data_segments (OS/2)

* os_dep.c (GC_register_data_segments): Call fclose(myexefile) on
return (only if OS2).