platform/upstream/libgc.git
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)

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

10 years agoDo not put libatomic_ops to gc.tar by Makefile.direct
Ivan Maidanski [Thu, 12 Jun 2014 07:25:01 +0000 (11:25 +0400)]
Do not put libatomic_ops to gc.tar by Makefile.direct

* Makefile.direct (dist gc.tar): Do not add libatomic_ops to gc.tar.

10 years agoRemove dependency on 'Makefile' in Makefile.direct/dj
Ivan Maidanski [Thu, 12 Jun 2014 07:17:46 +0000 (11:17 +0400)]
Remove dependency on 'Makefile' in Makefile.direct/dj

* Makefile.direct (dyn_load_sunos53.o, gc_cpp.o, threadlibs): Remove
dependency on Makefile; remove comment.
* Makefile.dj (dyn_load_sunos53.o, gc_cpp.o, threadlibs): Likewise.
* Makefile.direct (Makefile): Remove rule.
* Makefile.direct (gc.tar): Do not include Makefile.

10 years agoFix 'illegal option -xassembler-with-cpp' error (Oracle SunCC)
Ivan Maidanski [Mon, 9 Jun 2014 22:25:31 +0000 (02:25 +0400)]
Fix 'illegal option -xassembler-with-cpp' error (Oracle SunCC)

* Makefile.am (ASM_CPP_OPTIONS): Move comment to configure.ac.
* Makefile.am (COMPILER_XLC): Rename to ASM_WITH_CPP_UNSUPPORTED.
* configure.ac (COMPILER_XLC): Likewise.
* configure.ac (compiler_suncc): New variable (set to "yes" if Solaris
Sun C compiler).
* configure.ac (ASM_WITH_CPP_UNSUPPORTED): Define not only for
compiler_xlc but also for compiler_suncc.

10 years agoFix CFLAGS in configure regarding -O flag passing to SunCC compiler
Ivan Maidanski [Sun, 8 Jun 2014 13:24:17 +0000 (17:24 +0400)]
Fix CFLAGS in configure regarding -O flag passing to SunCC compiler

* configure.ac (CFLAGS): Add -O flag if Solaris SunCC (i.e., not GCC)
regardless of threads support (i.e., even in case it is off).

10 years agoUpdate ChangeLog file (related to 7.5.0)
Ivan Maidanski [Wed, 4 Jun 2014 19:35:09 +0000 (23:35 +0400)]
Update ChangeLog file (related to 7.5.0)

10 years agoUpdate ChangeLog file
Ivan Maidanski [Mon, 2 Jun 2014 22:23:10 +0000 (02:23 +0400)]
Update ChangeLog file

10 years agoFix 'op_sz variable unused' warning in GC_core_finalized_malloc
Ivan Maidanski [Sat, 31 May 2014 09:40:23 +0000 (13:40 +0400)]
Fix 'op_sz variable unused' warning in GC_core_finalized_malloc
(fix commit 2a3cef3)

* fnlz_mlc.c (GC_core_finalized_malloc): Remove "op_sz" local variable.

10 years agoFix crash when using GC_malloc_many() as first allocation call
Bruce Hoult [Thu, 29 May 2014 06:16:50 +0000 (18:16 +1200)]
Fix crash when using GC_malloc_many() as first allocation call

* mallocx.c (GC_CALL GC_generic_malloc_many): Do not dereference
ok_reclaim_list if it is NULL.

10 years agoFix GC_finalized_malloc failure on disclaim_test
Petter Urkedal [Sun, 25 May 2014 13:57:03 +0000 (15:57 +0200)]
Fix GC_finalized_malloc failure on disclaim_test
(revert part of commit 63fd11d)

The finalizer closure is placed in the first word in order to use the
lower bits to distinguish live objects from objects on the free list.
The downside of this is that we need one-word offset interior pointers,
and that GC_base does not return the start of the user region.

* fnlz_mlc.c (GC_finalized_disclaim): Move finalizer closure for
finalized object kinds back to the start of objects.
* fnlz_mlc.c (GC_init_finalized_malloc): Call
GC_register_displacement_inner() as GC_finalized_malloc returns
displaced pointer.
* fnlz_mlc.c (GC_core_finalized_malloc, GC_finalized_malloc): Store
fclos in first word of created object (instead of the last word);
return pointer to object displaced by 1 word.

10 years agoUse magic header on objects to improve disclaim_test
Petter Urkedal [Mon, 19 May 2014 20:36:55 +0000 (22:36 +0200)]
Use magic header on objects to improve disclaim_test

* tests/disclaim_test.c (my_assert): Call fflush().
* tests/disclaim_test.c (pair_s): Replace is_valid with "magic" field.
* tests/disclaim_test.c (pair_magic): New const static variable.
* tests/disclaim_test.c (is_pair): New function.
* tests/disclaim_test.c (pair_dct, pair_new): Set "magic" field and
use is_pair() instead of is_valid for assertion checking.

10 years agoFix PARALLEL_MARK for Windows 7+
Ivan Maidanski [Thu, 29 May 2014 19:32:45 +0000 (23:32 +0400)]
Fix PARALLEL_MARK for Windows 7+
(revert part of commit f1b257a)

* doc/README.macros (DONT_USE_SIGNALANDWAIT): Remove.
* win32_threads.c (DONT_USE_SIGNALANDWAIT, GC_mark_mutex_waitcnt,
SignalObjectAndWait_type, signalObjectAndWait_func): Likewise.
* win32_threads.c (GC_marker_cv, GC_mark_thread, start_mark_threads,
GC_mark_mutex_state, GC_acquire_mark_lock, GC_release_mark_lock,
GC_wait_marker, GC_notify_all_marker, GC_thr_init): Do not check
DONT_USE_SIGNALANDWAIT macro (assume it is always on as multi-core
marker based on NT SignalObjectAndWait is broken in Windows 7+ leading
to a deadlock sometimes because the function is no longer atomic).

10 years agoFix 'Array subscript is above array bounds' GCC warning in GC_new_kind/proc
Ivan Maidanski [Wed, 28 May 2014 20:46:21 +0000 (00:46 +0400)]
Fix 'Array subscript is above array bounds' GCC warning in GC_new_kind/proc

* misc.c (GC_new_kind_inner, GC_new_proc_inner): Move ABORT call so
that to be immediately followed by return (to workaround
"array subscript is above array bounds" warning reported by MinGW
GCC 4.5.2); do not increase elements count in case of overflow.

10 years ago.gitignore: Ignore all .deps, .dirstamp
Ivan Maidanski [Wed, 28 May 2014 17:59:47 +0000 (21:59 +0400)]
.gitignore: Ignore all .deps, .dirstamp

10 years agoUpdate TODO (Android 'gold' linker issue fixed in b746e63)
Ivan Maidanski [Mon, 26 May 2014 20:07:32 +0000 (00:07 +0400)]
Update TODO (Android 'gold' linker issue fixed in b746e63)

10 years agoUpdate ChangeLog file (related to 7.5.0)
Ivan Maidanski [Sun, 25 May 2014 20:09:56 +0000 (00:09 +0400)]
Update ChangeLog file (related to 7.5.0)

10 years agoUpdate ChangeLog file
Ivan Maidanski [Sun, 25 May 2014 20:03:39 +0000 (00:03 +0400)]
Update ChangeLog file

10 years agoUpdate AUTHORS file
Ivan Maidanski [Thu, 22 May 2014 22:17:26 +0000 (02:17 +0400)]
Update AUTHORS file

10 years agoFix (enable) Cygwin-64 build
Bernd Edlinger [Thu, 22 May 2014 21:53:21 +0000 (01:53 +0400)]
Fix (enable) Cygwin-64 build

* include/gc.h (GC_DATASTART, GC_DATAEND): Define for Cygwin-64.
* include/private/gcconfig.h (X86_64): Likewise.
* include/private/gcconfig.h (OS_TYPE, DATASTART, DATAEND, STACK_GRAN,
NEED_FIND_LIMIT, USE_MMAP_ANON): Define for Cygwin-64 (code copied
from Cygwin-32 block).
* os_dep.c (GC_get_stack_base): Get the stack base for Cygwin-64
(implementation based on NtCurrentTeb call).

10 years agoFix 'source file in a subdirectory' Automake warnings
Ivan Maidanski [Thu, 22 May 2014 20:21:23 +0000 (00:21 +0400)]
Fix 'source file in a subdirectory' Automake warnings

* configure.ac (AM_INIT_AUTOMAKE): Enable subdir-objects (to avoid
future incompatibilities as "cord" and "tests" source files are in
subdirectories).

10 years agoRefine description in README how to build from source repository
Ivan Maidanski [Sun, 18 May 2014 07:37:01 +0000 (11:37 +0400)]
Refine description in README how to build from source repository

10 years agoMerge pull request #44 from jric/master
Ivan Maidanski [Sun, 18 May 2014 06:53:16 +0000 (23:53 -0700)]
Merge pull request #44 from jric/master

Added instructions to README.md for building from git.

10 years agoMerge branch 'ancient-releases'
Ivan Maidanski [Sat, 17 May 2014 15:01:45 +0000 (19:01 +0400)]
Merge branch 'ancient-releases'

10 years agogc6.3alpha6 tarball import gc6_3alpha6
Hans Boehm [Thu, 6 May 2004 00:00:00 +0000 (00:00 +0000)]
gc6.3alpha6 tarball import

10 years agoMerge tag 'gc6_3alpha5' into ancient-releases
Ivan Maidanski [Sat, 17 May 2014 14:52:39 +0000 (18:52 +0400)]
Merge tag 'gc6_3alpha5' into ancient-releases

10 years agogc6.2alpha6 tarball import gc6_2alpha6
Hans Boehm [Thu, 5 Jun 2003 00:00:00 +0000 (00:00 +0000)]
gc6.2alpha6 tarball import

10 years agogc6.2alpha5 tarball import gc6_2alpha5
Hans Boehm [Wed, 14 May 2003 00:00:00 +0000 (00:00 +0000)]
gc6.2alpha5 tarball import

10 years agogc6.2alpha4 tarball import gc6_2alpha4
Hans Boehm [Mon, 10 Mar 2003 00:00:00 +0000 (00:00 +0000)]
gc6.2alpha4 tarball import

10 years agogc6.2alpha3 tarball import gc6_2alpha3
Hans Boehm [Thu, 30 Jan 2003 00:00:00 +0000 (00:00 +0000)]
gc6.2alpha3 tarball import

10 years agoMerge tag 'gc6_1' into ancient-releases
Ivan Maidanski [Sat, 17 May 2014 14:37:27 +0000 (18:37 +0400)]
Merge tag 'gc6_1' into ancient-releases

10 years agogc6.1alpha2 tarball import gc6_1alpha2
Hans Boehm [Thu, 20 Dec 2001 00:00:00 +0000 (00:00 +0000)]
gc6.1alpha2 tarball import

10 years agogc6.1alpha1 tarball import gc6_1alpha1
Hans Boehm [Sat, 22 Sep 2001 00:00:00 +0000 (00:00 +0000)]
gc6.1alpha1 tarball import

10 years agoMerge tag 'gc6_0' into ancient-releases
Ivan Maidanski [Sat, 17 May 2014 14:30:04 +0000 (18:30 +0400)]
Merge tag 'gc6_0' into ancient-releases

10 years agogc6.0alpha8 tarball import gc6_0alpha8
Hans Boehm [Fri, 15 Jun 2001 00:00:00 +0000 (00:00 +0000)]
gc6.0alpha8 tarball import

10 years agogc6.0alpha3 tarball import gc6_0alpha3
Hans Boehm [Tue, 26 Sep 2000 00:00:00 +0000 (00:00 +0000)]
gc6.0alpha3 tarball import

10 years agoMerge tag 'gc5_3' into ancient-releases
Ivan Maidanski [Sat, 17 May 2014 14:10:33 +0000 (18:10 +0400)]
Merge tag 'gc5_3' into ancient-releases

10 years agogc5.0alpha4 tarball import gc5_0alpha4
Hans Boehm [Sat, 30 Oct 1999 00:00:00 +0000 (00:00 +0000)]
gc5.0alpha4 tarball import

10 years agoMerge tag 'gc5_0alpha3' into ancient-releases
Ivan Maidanski [Sat, 17 May 2014 13:59:17 +0000 (17:59 +0400)]
Merge tag 'gc5_0alpha3' into ancient-releases

10 years agogc5.0alpha2 tarball import gc5_0alpha2
Hans Boehm [Fri, 23 Jul 1999 00:00:00 +0000 (00:00 +0000)]
gc5.0alpha2 tarball import

10 years agogc5.0alpha1 tarball import gc5_0alpha1
Hans Boehm [Wed, 30 Jun 1999 00:00:00 +0000 (00:00 +0000)]
gc5.0alpha1 tarball import

10 years agoMerge tag 'gc4_14' into ancient-releases
Ivan Maidanski [Sat, 17 May 2014 13:51:17 +0000 (17:51 +0400)]
Merge tag 'gc4_14' into ancient-releases

10 years agogc4.14alpha2 tarball import gc4_14alpha2
Hans Boehm [Fri, 26 Mar 1999 00:00:00 +0000 (00:00 +0000)]
gc4.14alpha2 tarball import