Commit Graph

2 Commits

Author SHA1 Message Date
Peter Wang
dcde485b51 Use spawn_native in thread_sbrk test.
The thread_sbrk test is only meaningful with OS threads so use
thread.spawn_native instead of thread.spawn now that it is available.

It was harmless to run the test with only concurrent Mercury threads
anyway, except that calling thread.yield leads to a crash in deep
profiling grades (whether or not concurrent Mercury threads *should*
work in deep profiling grades is another matter).

tests/hard_coded/thread_sbrk.m:
tests/hard_coded/thread_sbrk.exp2:
    Use thread.spawn_native instead of thread.spawn.

    Delete unnecessary thread.yield calls.
2018-08-09 18:48:35 +10:00
Peter Wang
d63a294e1f Use mmap for Boehm GC in threaded grades on Linux.
The glibc implementation of malloc (commonly used on Linux) can use sbrk
to acquire more memory, and so does Boehm GC in its default configuration
on Linux.  When both allocators are invoked simultaneously from different
threads then memory corruption may result.

configure.ac:
	Add --enable-gc-mmap option.

	Make --enable-gc-munmap imply --enable-gc-mmap.

	Detect mmap and set MR_HAVE_MMAP.

	Detect sbrk and set MR_HAVE_SBRK.

	On Linux (and potentially other platforms), build Boehm GC for
	threaded grades with -DUSE_MMAP if mmap was found.

Mmake.common.in:
	Add ENABLE_BOEHM_USE_MMAP.

runtime/mercury_conf.h.in:
	Add MR_HAVE_MMAP, although it is not used anywhere yet.

	Add MR_HAVE_SBRK.  It is only for used by the test program.

tests/hard_coded/Mmakefile:
tests/hard_coded/thread_sbrk.exp:
tests/hard_coded/thread_sbrk.exp2:
tests/hard_coded/thread_sbrk.m:
	Add test program.

NEWS:
	Announce changes.
2014-07-30 15:53:47 +10:00