summaryrefslogtreecommitdiff
path: root/libphobos/libdruntime
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2025-01-05 13:51:59 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2025-01-05 13:56:23 +0100
commit3dfad340cb140d64b8c0ecab05fa329238ebd06b (patch)
treef1a276a888f41e08b0009943c0e914814bf3f888 /libphobos/libdruntime
parent332cf038fda109ea0612eeba7a85441293ba6984 (diff)
libphobos: Merge upstream druntime c11e1d1708, phobos 303b9c9f7
Synchronizing the library with the upstream release of v2.108.1. D runtime changes: - Import druntime v2.108.1. - Removed all `collectNoStack' functions and API from the garbage collector. - The static method `core.thread.Thread.sleep' is now marked as `@trusted'. Phobos changes: - Import phobos v2.108.1. - Add `std.process.Config.preExecDelegate'. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime c11e1d1708. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_FREEBSD): Add core/sys/freebsd/mqueue.d. (DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/sys/mount.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 303b9c9f7. * testsuite/libphobos.exceptions/invalid_memory_operation.d: Adjust test.
Diffstat (limited to 'libphobos/libdruntime')
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/Makefile.am37
-rw-r--r--libphobos/libdruntime/Makefile.in63
-rw-r--r--libphobos/libdruntime/core/gc/gcinterface.d5
-rw-r--r--libphobos/libdruntime/core/internal/array/construction.d17
-rw-r--r--libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d73
-rw-r--r--libphobos/libdruntime/core/internal/gc/impl/manual/gc.d4
-rw-r--r--libphobos/libdruntime/core/internal/gc/impl/proto/gc.d4
-rw-r--r--libphobos/libdruntime/core/internal/gc/pooltable.d3
-rw-r--r--libphobos/libdruntime/core/internal/gc/proxy.d13
-rw-r--r--libphobos/libdruntime/core/internal/hash.d2
-rw-r--r--libphobos/libdruntime/core/internal/qsort.d46
-rw-r--r--libphobos/libdruntime/core/memory.d8
-rw-r--r--libphobos/libdruntime/core/runtime.d10
-rw-r--r--libphobos/libdruntime/core/stdc/limits.d5
-rw-r--r--libphobos/libdruntime/core/stdcpp/new_.d2
-rw-r--r--libphobos/libdruntime/core/sys/freebsd/mqueue.d19
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/mount.d63
-rw-r--r--libphobos/libdruntime/core/sys/posix/config.d2
-rw-r--r--libphobos/libdruntime/core/sys/posix/mqueue.d370
-rw-r--r--libphobos/libdruntime/core/sys/solaris/sys/priocntl.d2
-rw-r--r--libphobos/libdruntime/core/sys/solaris/sys/procset.d2
-rw-r--r--libphobos/libdruntime/core/sys/solaris/sys/types.d2
-rw-r--r--libphobos/libdruntime/core/thread/fiber.d46
-rw-r--r--libphobos/libdruntime/core/thread/osthread.d8
-rw-r--r--libphobos/libdruntime/object.d2
26 files changed, 490 insertions, 320 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index 44c7e3fc4dc..46d435ef8db 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-e60bfd11bd6a523418f94d1d821b7af71f5ad05b
+c11e1d1708646c9ac81ac2aafb57fa1ef5d289ad
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index c2027f1e16a..a20bf6bdff7 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -266,17 +266,18 @@ DRUNTIME_DSOURCES_ELF = core/sys/elf/package.d
DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \
core/sys/freebsd/dlfcn.d core/sys/freebsd/err.d \
core/sys/freebsd/execinfo.d core/sys/freebsd/ifaddrs.d \
- core/sys/freebsd/net/if_.d core/sys/freebsd/net/if_dl.d \
- core/sys/freebsd/netinet/in_.d core/sys/freebsd/pthread_np.d \
- core/sys/freebsd/stdlib.d core/sys/freebsd/string.d \
- core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \
- core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \
- core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \
- core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \
- core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \
- core/sys/freebsd/sys/mount.d core/sys/freebsd/sys/socket.d \
- core/sys/freebsd/sys/sysctl.d core/sys/freebsd/sys/types.d \
- core/sys/freebsd/time.d core/sys/freebsd/unistd.d
+ core/sys/freebsd/mqueue.d core/sys/freebsd/net/if_.d \
+ core/sys/freebsd/net/if_dl.d core/sys/freebsd/netinet/in_.d \
+ core/sys/freebsd/pthread_np.d core/sys/freebsd/stdlib.d \
+ core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \
+ core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \
+ core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \
+ core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \
+ core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \
+ core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \
+ core/sys/freebsd/sys/socket.d core/sys/freebsd/sys/sysctl.d \
+ core/sys/freebsd/sys/types.d core/sys/freebsd/time.d \
+ core/sys/freebsd/unistd.d
DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \
@@ -290,13 +291,13 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/stdio.d core/sys/linux/string.d \
core/sys/linux/sys/auxv.d core/sys/linux/sys/eventfd.d \
core/sys/linux/sys/file.d core/sys/linux/sys/inotify.d \
- core/sys/linux/sys/mman.d core/sys/linux/sys/prctl.d \
- core/sys/linux/sys/procfs.d core/sys/linux/sys/signalfd.d \
- core/sys/linux/sys/socket.d core/sys/linux/sys/sysinfo.d \
- core/sys/linux/sys/time.d core/sys/linux/sys/xattr.d \
- core/sys/linux/termios.d core/sys/linux/time.d \
- core/sys/linux/timerfd.d core/sys/linux/tipc.d core/sys/linux/uinput.d \
- core/sys/linux/unistd.d
+ core/sys/linux/sys/mman.d core/sys/linux/sys/mount.d \
+ core/sys/linux/sys/prctl.d core/sys/linux/sys/procfs.d \
+ core/sys/linux/sys/signalfd.d core/sys/linux/sys/socket.d \
+ core/sys/linux/sys/sysinfo.d core/sys/linux/sys/time.d \
+ core/sys/linux/sys/xattr.d core/sys/linux/termios.d \
+ core/sys/linux/time.d core/sys/linux/timerfd.d core/sys/linux/tipc.d \
+ core/sys/linux/uinput.d core/sys/linux/unistd.d
DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 8f1202cec9b..53c197e5d89 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -329,10 +329,11 @@ am__objects_11 = core/sys/bionic/err.lo core/sys/bionic/fcntl.lo \
@DRUNTIME_OS_ANDROID_TRUE@am__objects_12 = $(am__objects_11)
am__objects_13 = core/sys/freebsd/config.lo core/sys/freebsd/dlfcn.lo \
core/sys/freebsd/err.lo core/sys/freebsd/execinfo.lo \
- core/sys/freebsd/ifaddrs.lo core/sys/freebsd/net/if_.lo \
- core/sys/freebsd/net/if_dl.lo core/sys/freebsd/netinet/in_.lo \
- core/sys/freebsd/pthread_np.lo core/sys/freebsd/stdlib.lo \
- core/sys/freebsd/string.lo core/sys/freebsd/sys/_bitset.lo \
+ core/sys/freebsd/ifaddrs.lo core/sys/freebsd/mqueue.lo \
+ core/sys/freebsd/net/if_.lo core/sys/freebsd/net/if_dl.lo \
+ core/sys/freebsd/netinet/in_.lo core/sys/freebsd/pthread_np.lo \
+ core/sys/freebsd/stdlib.lo core/sys/freebsd/string.lo \
+ core/sys/freebsd/sys/_bitset.lo \
core/sys/freebsd/sys/_cpuset.lo core/sys/freebsd/sys/cdefs.lo \
core/sys/freebsd/sys/elf.lo core/sys/freebsd/sys/elf32.lo \
core/sys/freebsd/sys/elf64.lo \
@@ -377,13 +378,14 @@ am__objects_19 = core/sys/linux/config.lo core/sys/linux/dlfcn.lo \
core/sys/linux/stdio.lo core/sys/linux/string.lo \
core/sys/linux/sys/auxv.lo core/sys/linux/sys/eventfd.lo \
core/sys/linux/sys/file.lo core/sys/linux/sys/inotify.lo \
- core/sys/linux/sys/mman.lo core/sys/linux/sys/prctl.lo \
- core/sys/linux/sys/procfs.lo core/sys/linux/sys/signalfd.lo \
- core/sys/linux/sys/socket.lo core/sys/linux/sys/sysinfo.lo \
- core/sys/linux/sys/time.lo core/sys/linux/sys/xattr.lo \
- core/sys/linux/termios.lo core/sys/linux/time.lo \
- core/sys/linux/timerfd.lo core/sys/linux/tipc.lo \
- core/sys/linux/uinput.lo core/sys/linux/unistd.lo
+ core/sys/linux/sys/mman.lo core/sys/linux/sys/mount.lo \
+ core/sys/linux/sys/prctl.lo core/sys/linux/sys/procfs.lo \
+ core/sys/linux/sys/signalfd.lo core/sys/linux/sys/socket.lo \
+ core/sys/linux/sys/sysinfo.lo core/sys/linux/sys/time.lo \
+ core/sys/linux/sys/xattr.lo core/sys/linux/termios.lo \
+ core/sys/linux/time.lo core/sys/linux/timerfd.lo \
+ core/sys/linux/tipc.lo core/sys/linux/uinput.lo \
+ core/sys/linux/unistd.lo
@DRUNTIME_OS_LINUX_TRUE@am__objects_20 = $(am__objects_19)
am__objects_21 = core/sys/windows/accctrl.lo \
core/sys/windows/aclapi.lo core/sys/windows/aclui.lo \
@@ -943,17 +945,18 @@ DRUNTIME_DSOURCES_ELF = core/sys/elf/package.d
DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \
core/sys/freebsd/dlfcn.d core/sys/freebsd/err.d \
core/sys/freebsd/execinfo.d core/sys/freebsd/ifaddrs.d \
- core/sys/freebsd/net/if_.d core/sys/freebsd/net/if_dl.d \
- core/sys/freebsd/netinet/in_.d core/sys/freebsd/pthread_np.d \
- core/sys/freebsd/stdlib.d core/sys/freebsd/string.d \
- core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \
- core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \
- core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \
- core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \
- core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \
- core/sys/freebsd/sys/mount.d core/sys/freebsd/sys/socket.d \
- core/sys/freebsd/sys/sysctl.d core/sys/freebsd/sys/types.d \
- core/sys/freebsd/time.d core/sys/freebsd/unistd.d
+ core/sys/freebsd/mqueue.d core/sys/freebsd/net/if_.d \
+ core/sys/freebsd/net/if_dl.d core/sys/freebsd/netinet/in_.d \
+ core/sys/freebsd/pthread_np.d core/sys/freebsd/stdlib.d \
+ core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \
+ core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \
+ core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \
+ core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \
+ core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \
+ core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \
+ core/sys/freebsd/sys/socket.d core/sys/freebsd/sys/sysctl.d \
+ core/sys/freebsd/sys/types.d core/sys/freebsd/time.d \
+ core/sys/freebsd/unistd.d
DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \
@@ -967,13 +970,13 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/stdio.d core/sys/linux/string.d \
core/sys/linux/sys/auxv.d core/sys/linux/sys/eventfd.d \
core/sys/linux/sys/file.d core/sys/linux/sys/inotify.d \
- core/sys/linux/sys/mman.d core/sys/linux/sys/prctl.d \
- core/sys/linux/sys/procfs.d core/sys/linux/sys/signalfd.d \
- core/sys/linux/sys/socket.d core/sys/linux/sys/sysinfo.d \
- core/sys/linux/sys/time.d core/sys/linux/sys/xattr.d \
- core/sys/linux/termios.d core/sys/linux/time.d \
- core/sys/linux/timerfd.d core/sys/linux/tipc.d core/sys/linux/uinput.d \
- core/sys/linux/unistd.d
+ core/sys/linux/sys/mman.d core/sys/linux/sys/mount.d \
+ core/sys/linux/sys/prctl.d core/sys/linux/sys/procfs.d \
+ core/sys/linux/sys/signalfd.d core/sys/linux/sys/socket.d \
+ core/sys/linux/sys/sysinfo.d core/sys/linux/sys/time.d \
+ core/sys/linux/sys/xattr.d core/sys/linux/termios.d \
+ core/sys/linux/time.d core/sys/linux/timerfd.d core/sys/linux/tipc.d \
+ core/sys/linux/uinput.d core/sys/linux/unistd.d
DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \
@@ -1610,6 +1613,7 @@ core/sys/freebsd/dlfcn.lo: core/sys/freebsd/$(am__dirstamp)
core/sys/freebsd/err.lo: core/sys/freebsd/$(am__dirstamp)
core/sys/freebsd/execinfo.lo: core/sys/freebsd/$(am__dirstamp)
core/sys/freebsd/ifaddrs.lo: core/sys/freebsd/$(am__dirstamp)
+core/sys/freebsd/mqueue.lo: core/sys/freebsd/$(am__dirstamp)
core/sys/freebsd/net/$(am__dirstamp):
@$(MKDIR_P) core/sys/freebsd/net
@: > core/sys/freebsd/net/$(am__dirstamp)
@@ -1732,6 +1736,7 @@ core/sys/linux/sys/eventfd.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/file.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/inotify.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/mman.lo: core/sys/linux/sys/$(am__dirstamp)
+core/sys/linux/sys/mount.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/prctl.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/procfs.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/signalfd.lo: core/sys/linux/sys/$(am__dirstamp)
diff --git a/libphobos/libdruntime/core/gc/gcinterface.d b/libphobos/libdruntime/core/gc/gcinterface.d
index 5560c6229ca..fa3d859ce36 100644
--- a/libphobos/libdruntime/core/gc/gcinterface.d
+++ b/libphobos/libdruntime/core/gc/gcinterface.d
@@ -54,11 +54,6 @@ interface GC
void collect() nothrow;
/**
- *
- */
- void collectNoStack() nothrow;
-
- /**
* minimize free space usage
*/
void minimize() nothrow;
diff --git a/libphobos/libdruntime/core/internal/array/construction.d b/libphobos/libdruntime/core/internal/array/construction.d
index 0950b5a5aa9..8f0323a054b 100644
--- a/libphobos/libdruntime/core/internal/array/construction.d
+++ b/libphobos/libdruntime/core/internal/array/construction.d
@@ -526,7 +526,7 @@ Tarr _d_newarraymTX(Tarr : U[], T, U)(size_t[] dims, bool isShared=false) @trust
auto dim = dims[0];
- debug(PRINTF) printf("__allocateInnerArray(ti = %p, ti.next = %p, dim = %d, ndims = %d\n", ti, ti.next, dim, dims.length);
+ debug(PRINTF) printf("__allocateInnerArray(UnqT = %s, dim = %lu, ndims = %lu\n", UnqT.stringof.ptr, dim, dims.length);
if (dims.length == 1)
{
auto r = _d_newarrayT!UnqT(dim, isShared);
@@ -534,8 +534,9 @@ Tarr _d_newarraymTX(Tarr : U[], T, U)(size_t[] dims, bool isShared=false) @trust
}
auto allocSize = (void[]).sizeof * dim;
- auto info = __arrayAlloc!UnqT(allocSize);
- __setArrayAllocLength!UnqT(info, allocSize, isShared);
+ // the array-of-arrays holds pointers! Don't use UnqT here!
+ auto info = __arrayAlloc!(void[])(allocSize);
+ __setArrayAllocLength!(void[])(info, allocSize, isShared);
auto p = __arrayStart(info)[0 .. dim];
foreach (i; 0..dim)
@@ -579,6 +580,16 @@ unittest
}
}
+// https://issues.dlang.org/show_bug.cgi?id=24436
+@system unittest
+{
+ import core.memory : GC;
+
+ int[][] a = _d_newarraymTX!(int[][], int)([2, 2]);
+
+ assert(!(GC.getAttr(a.ptr) & GC.BlkAttr.NO_SCAN));
+}
+
version (D_ProfileGC)
{
/**
diff --git a/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d b/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d
index cb8df47507f..b1b270799aa 100644
--- a/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d
+++ b/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d
@@ -1252,12 +1252,6 @@ class ConservativeGC : GC
}
- void collectNoStack() nothrow
- {
- fullCollectNoStack();
- }
-
-
/**
* Begins a full collection, scanning all stack segments for roots.
*
@@ -1291,21 +1285,6 @@ class ConservativeGC : GC
/**
- * Begins a full collection while ignoring all stack segments for roots.
- */
- void fullCollectNoStack() nothrow
- {
- // Since a finalizer could launch a new thread, we always need to lock
- // when collecting.
- static size_t go(Gcx* gcx) nothrow
- {
- return gcx.fullcollect(true, true, true); // standard stop the world
- }
- runLocked!go(gcx);
- }
-
-
- /**
* Minimize free space usage.
*/
void minimize() nothrow
@@ -2556,14 +2535,11 @@ struct Gcx
}
// collection step 2: mark roots and heap
- void markAll(alias markFn)(bool nostack) nothrow
+ void markAll(alias markFn)() nothrow
{
- if (!nostack)
- {
- debug(COLLECT_PRINTF) printf("\tscan stacks.\n");
- // Scan stacks and registers for each paused thread
- thread_scanAll(&markFn);
- }
+ debug(COLLECT_PRINTF) printf("\tscan stacks.\n");
+ // Scan stacks registers, and TLS for each paused thread
+ thread_scanAll(&markFn);
// Scan roots[]
debug(COLLECT_PRINTF) printf("\tscan roots[]\n");
@@ -2584,14 +2560,11 @@ struct Gcx
}
version (COLLECT_PARALLEL)
- void collectAllRoots(bool nostack) nothrow
+ void collectAllRoots() nothrow
{
- if (!nostack)
- {
- debug(COLLECT_PRINTF) printf("\tcollect stacks.\n");
- // Scan stacks and registers for each paused thread
- thread_scanAll(&collectRoots);
- }
+ debug(COLLECT_PRINTF) printf("\tcollect stacks.\n");
+ // Scan stacks registers and TLS for each paused thread
+ thread_scanAll(&collectRoots);
// Scan roots[]
debug(COLLECT_PRINTF) printf("\tcollect roots[]\n");
@@ -2920,7 +2893,7 @@ struct Gcx
}
version (COLLECT_FORK)
- ChildStatus markFork(bool nostack, bool block, bool doParallel) nothrow
+ ChildStatus markFork(bool block, bool doParallel) nothrow
{
// Forking is enabled, so we fork() and start a new concurrent mark phase
// in the child. If the collection should not block, the parent process
@@ -2936,11 +2909,11 @@ struct Gcx
int child_mark() scope
{
if (doParallel)
- markParallel(nostack);
+ markParallel();
else if (ConservativeGC.isPrecise)
- markAll!(markPrecise!true)(nostack);
+ markAll!(markPrecise!true)();
else
- markAll!(markConservative!true)(nostack);
+ markAll!(markConservative!true)();
return 0;
}
@@ -2999,11 +2972,11 @@ struct Gcx
// do the marking in this thread
disableFork();
if (doParallel)
- markParallel(nostack);
+ markParallel();
else if (ConservativeGC.isPrecise)
- markAll!(markPrecise!false)(nostack);
+ markAll!(markPrecise!false)();
else
- markAll!(markConservative!false)(nostack);
+ markAll!(markConservative!false)();
} else {
assert(r == ChildStatus.done);
assert(r != ChildStatus.running);
@@ -3016,7 +2989,7 @@ struct Gcx
* Return number of full pages free'd.
* The collection is done concurrently only if block and isFinal are false.
*/
- size_t fullcollect(bool nostack = false, bool block = false, bool isFinal = false) nothrow
+ size_t fullcollect(bool block = false, bool isFinal = false) nothrow
{
// It is possible that `fullcollect` will be called from a thread which
// is not yet registered in runtime (because allocating `new Thread` is
@@ -3098,7 +3071,7 @@ Lmark:
{
version (COLLECT_FORK)
{
- auto forkResult = markFork(nostack, block, doParallel);
+ auto forkResult = markFork(block, doParallel);
final switch (forkResult)
{
case ChildStatus.error:
@@ -3125,14 +3098,14 @@ Lmark:
else if (doParallel)
{
version (COLLECT_PARALLEL)
- markParallel(nostack);
+ markParallel();
}
else
{
if (ConservativeGC.isPrecise)
- markAll!(markPrecise!false)(nostack);
+ markAll!(markPrecise!false)();
else
- markAll!(markConservative!false)(nostack);
+ markAll!(markConservative!false)();
}
thread_processGCMarks(&isMarked);
@@ -3184,7 +3157,7 @@ Lmark:
updateCollectThresholds();
if (doFork && isFinal)
- return fullcollect(true, true, false);
+ return fullcollect(true, false);
return freedPages;
}
@@ -3300,10 +3273,10 @@ Lmark:
shared uint stoppedThreads;
bool stopGC;
- void markParallel(bool nostack) nothrow
+ void markParallel() nothrow
{
toscanRoots.clear();
- collectAllRoots(nostack);
+ collectAllRoots();
if (toscanRoots.empty)
return;
diff --git a/libphobos/libdruntime/core/internal/gc/impl/manual/gc.d b/libphobos/libdruntime/core/internal/gc/impl/manual/gc.d
index b820adda1a2..36add7a2d6a 100644
--- a/libphobos/libdruntime/core/internal/gc/impl/manual/gc.d
+++ b/libphobos/libdruntime/core/internal/gc/impl/manual/gc.d
@@ -79,10 +79,6 @@ class ManualGC : GC
{
}
- void collectNoStack() nothrow
- {
- }
-
void minimize() nothrow
{
}
diff --git a/libphobos/libdruntime/core/internal/gc/impl/proto/gc.d b/libphobos/libdruntime/core/internal/gc/impl/proto/gc.d
index 2286d17d9ce..dbe86007115 100644
--- a/libphobos/libdruntime/core/internal/gc/impl/proto/gc.d
+++ b/libphobos/libdruntime/core/internal/gc/impl/proto/gc.d
@@ -76,10 +76,6 @@ class ProtoGC : GC
{
}
- void collectNoStack() nothrow
- {
- }
-
void minimize() nothrow
{
}
diff --git a/libphobos/libdruntime/core/internal/gc/pooltable.d b/libphobos/libdruntime/core/internal/gc/pooltable.d
index 096633825a2..f9ec3d2a22b 100644
--- a/libphobos/libdruntime/core/internal/gc/pooltable.d
+++ b/libphobos/libdruntime/core/internal/gc/pooltable.d
@@ -181,9 +181,10 @@ package:
unittest
{
+ import core.internal.gc.impl.conservative.gc : PAGESIZE;
+
enum NPOOLS = 6;
enum NPAGES = 10;
- enum PAGESIZE = 4096;
static struct MockPool
{
diff --git a/libphobos/libdruntime/core/internal/gc/proxy.d b/libphobos/libdruntime/core/internal/gc/proxy.d
index abc8c6ac2ea..c7dab714e6c 100644
--- a/libphobos/libdruntime/core/internal/gc/proxy.d
+++ b/libphobos/libdruntime/core/internal/gc/proxy.d
@@ -106,18 +106,7 @@ extern (C)
case "none":
break;
case "collect":
- // NOTE: There may be daemons threads still running when this routine is
- // called. If so, cleaning memory out from under then is a good
- // way to make them crash horribly. This probably doesn't matter
- // much since the app is supposed to be shutting down anyway, but
- // I'm disabling cleanup for now until I can think about it some
- // more.
- //
- // NOTE: Due to popular demand, this has been re-enabled. It still has
- // the problems mentioned above though, so I guess we'll see.
-
- instance.collectNoStack(); // not really a 'collect all' -- still scans
- // static data area, roots, and ranges.
+ instance.collect();
break;
case "finalize":
instance.runFinalizers((cast(ubyte*)null)[0 .. size_t.max]);
diff --git a/libphobos/libdruntime/core/internal/hash.d b/libphobos/libdruntime/core/internal/hash.d
index ef9f1e525c0..80fdc320032 100644
--- a/libphobos/libdruntime/core/internal/hash.d
+++ b/libphobos/libdruntime/core/internal/hash.d
@@ -36,7 +36,7 @@ private enum hasCallableToHash(T) = __traits(compiles,
@nogc nothrow pure @safe unittest
{
- static struct S { size_t toHash() { return 4; } }
+ static struct S { size_t toHash() const { return 4; } }
assert(hasCallableToHash!S);
assert(!hasCallableToHash!(shared const S));
}
diff --git a/libphobos/libdruntime/core/internal/qsort.d b/libphobos/libdruntime/core/internal/qsort.d
index ada914c9ef4..0040f6b4609 100644
--- a/libphobos/libdruntime/core/internal/qsort.d
+++ b/libphobos/libdruntime/core/internal/qsort.d
@@ -56,17 +56,49 @@ static if (Glibc_Qsort_R)
}
else version (FreeBSD)
{
- alias extern (C) int function(scope void *, scope const void *, scope const void *) Cmp;
- extern (C) void qsort_r(scope void *base, size_t nmemb, size_t size, scope void *thunk, Cmp cmp);
+ import core.sys.freebsd.config : __FreeBSD_version;
- extern (C) void[] _adSort(return scope void[] a, TypeInfo ti)
+ static if (__FreeBSD_version >= 1400000)
{
- extern (C) int cmp(scope void* ti, scope const void* p1, scope const void* p2)
+ alias extern (C) int function(scope const void*, scope const void*, scope void*) Cmp;
+ extern (C) void qsort_r(scope void* base, size_t nmemb, size_t size, Cmp cmp, scope void* thunk);
+
+ // https://cgit.freebsd.org/src/tree/include/stdlib.h?h=stable/14#n350
+ pragma(mangle, "qsort_r@FBSD_1.0")
+ private extern (C) void __qsort_r_compat(scope void* base, size_t nmemb, size_t size, scope void* thunk, OldCmp cmp);
+ alias extern (C) int function(scope void*, scope const void*, scope const void*) OldCmp;
+
+ deprecated("In FreeBSD 14, qsort_r's signature was fixed to match POSIX. This extern(D) overload has been " ~
+ "provided to avoid breaking code, but code should be updated to use the POSIX version.")
+ extern (D) void qsort_r(scope void* base, size_t nmemb, size_t size, scope void* thunk, OldCmp cmp)
{
- return (cast(TypeInfo)ti).compare(p1, p2);
+ __qsort_r_compat(base, nmemb, size, thunk, cmp);
+ }
+
+ extern (C) void[] _adSort(return scope void[] a, TypeInfo ti)
+ {
+ extern (C) int cmp(scope const void* p1, scope const void* p2, scope void* ti)
+ {
+ return (cast(TypeInfo)ti).compare(p1, p2);
+ }
+ qsort_r(a.ptr, a.length, ti.tsize, &cmp, cast(void*)ti);
+ return a;
+ }
+ }
+ else
+ {
+ alias extern (C) int function(scope void *, scope const void *, scope const void *) Cmp;
+ extern (C) void qsort_r(scope void* base, size_t nmemb, size_t size, scope void* thunk, Cmp cmp);
+
+ extern (C) void[] _adSort(return scope void[] a, TypeInfo ti)
+ {
+ extern (C) int cmp(scope void* ti, scope const void* p1, scope const void* p2)
+ {
+ return (cast(TypeInfo)ti).compare(p1, p2);
+ }
+ qsort_r(a.ptr, a.length, ti.tsize, cast(void*)ti, &cmp);
+ return a;
}
- qsort_r(a.ptr, a.length, ti.tsize, cast(void*)ti, &cmp);
- return a;
}
}
else version (DragonFlyBSD)
diff --git a/libphobos/libdruntime/core/memory.d b/libphobos/libdruntime/core/memory.d
index 239d23ff01d..001c3159678 100644
--- a/libphobos/libdruntime/core/memory.d
+++ b/libphobos/libdruntime/core/memory.d
@@ -322,7 +322,7 @@ extern(D):
This can be used to manually allocate arrays. Initial slice size is 0.
Note: The slice's usable size will not match the block size. Use
- $(LREF capacity) to retrieve actual usable capacity.
+ $(REF1 capacity, object) to retrieve actual usable capacity.
Example:
----
@@ -611,7 +611,7 @@ extern(C):
* Note:
* Extend may also be used to extend slices (or memory blocks with
* $(LREF APPENDABLE) info). However, use the return value only
- * as an indicator of success. $(LREF capacity) should be used to
+ * as an indicator of success. $(REF1 capacity, object) should be used to
* retrieve actual usable slice capacity.
*/
version (D_ProfileGC)
@@ -1197,13 +1197,13 @@ $(UL
)
Note: Users should prefer $(REF1 destroy, object) to explicitly finalize objects,
-and only resort to $(REF __delete, core,memory) when $(REF destroy, object)
+and only resort to $(LREF __delete) when $(REF1 destroy, object)
wouldn't be a feasible option.
Params:
x = aggregate object that should be destroyed
-See_Also: $(REF1 destroy, object), $(REF free, core,GC)
+See_Also: $(REF1 destroy, object), $(LREF GC.free)
History:
diff --git a/libphobos/libdruntime/core/runtime.d b/libphobos/libdruntime/core/runtime.d
index 19bb61b0c22..4ff728cc38c 100644
--- a/libphobos/libdruntime/core/runtime.d
+++ b/libphobos/libdruntime/core/runtime.d
@@ -101,15 +101,15 @@ struct UnitTestResult
}
/// Legacy module unit test handler
-alias bool function() ModuleUnitTester;
+alias ModuleUnitTester = bool function();
/// Module unit test handler
-alias UnitTestResult function() ExtendedModuleUnitTester;
+alias ExtendedModuleUnitTester = UnitTestResult function();
private
{
- alias bool function(Object) CollectHandler;
- alias Throwable.TraceInfo function( void* ptr ) TraceHandler;
+ alias CollectHandler = bool function(Object);
+ alias TraceHandler = Throwable.TraceInfo function(void* ptr);
- alias void delegate( Throwable ) ExceptionHandler;
+ alias ExceptionHandler = void delegate(Throwable);
extern (C) void _d_print_throwable(Throwable t);
extern (C) void* thread_stackBottom() nothrow @nogc;
diff --git a/libphobos/libdruntime/core/stdc/limits.d b/libphobos/libdruntime/core/stdc/limits.d
index f3f88006a12..2684b22bfcd 100644
--- a/libphobos/libdruntime/core/stdc/limits.d
+++ b/libphobos/libdruntime/core/stdc/limits.d
@@ -90,8 +90,7 @@ version (Darwin)
///
enum PIPE_BUF = 512;
}
-
-version (DragonFlyBSD)
+else version (DragonFlyBSD)
{
///
enum MAX_CANON = 255;
@@ -182,3 +181,5 @@ else version (Windows)
///
enum PIPE_BUF = 5120;
}
+else
+ static assert(0, "unsupported OS");
diff --git a/libphobos/libdruntime/core/stdcpp/new_.d b/libphobos/libdruntime/core/stdcpp/new_.d
index de9e10ac47c..5f80b286223 100644
--- a/libphobos/libdruntime/core/stdcpp/new_.d
+++ b/libphobos/libdruntime/core/stdcpp/new_.d
@@ -33,7 +33,7 @@ extern (C++, "std")
{
@nogc:
///
- this() { super("bad allocation", 1); }
+ extern(D) this() { super("bad allocation", 1); }
}
}
diff --git a/libphobos/libdruntime/core/sys/freebsd/mqueue.d b/libphobos/libdruntime/core/sys/freebsd/mqueue.d
new file mode 100644
index 00000000000..448ead71d0f
--- /dev/null
+++ b/libphobos/libdruntime/core/sys/freebsd/mqueue.d
@@ -0,0 +1,19 @@
+//Written in the D programming language
+
+/++
+ D header file for FreeBSD's ifaddrs.h.
+
+ Copyright: Copyright 2024
+ License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
+ Authors: $(HTTP jmdavisprog.com, Jonathan M Davis)
+ +/
+module core.sys.freebsd.mqueue;
+
+public import core.sys.posix.mqueue;
+
+version (FreeBSD):
+extern(C):
+@nogc:
+nothrow:
+
+int mq_getfd_np(mqd_t mqd);
diff --git a/libphobos/libdruntime/core/sys/linux/sys/mount.d b/libphobos/libdruntime/core/sys/linux/sys/mount.d
new file mode 100644
index 00000000000..8b8511af4b1
--- /dev/null
+++ b/libphobos/libdruntime/core/sys/linux/sys/mount.d
@@ -0,0 +1,63 @@
+/**
+ * D header file for Linux.
+ */
+module core.sys.linux.sys.mount;
+
+version (linux):
+
+public import core.sys.linux.fs :
+ BLKROSET, BLKROGET, BLKRRPART, BLKGETSIZE, BLKFLSBUF, BLKRASET, BLKRAGET,
+ BLKFRASET, BLKFRAGET, BLKSECTSET, BLKSECTGET, BLKSSZGET, BLKBSZGET,
+ BLKBSZSET, BLKGETSIZE64;
+
+import core.stdc.config : c_ulong;
+
+extern (C):
+nothrow:
+@nogc:
+
+enum c_ulong MS_RDONLY = 1;
+enum c_ulong MS_NOSUID = 2;
+enum c_ulong MS_NODEV = 4;
+enum c_ulong MS_NOEXEC = 8;
+enum c_ulong MS_SYNCHRONOUS = 16;
+enum c_ulong MS_REMOUNT = 32;
+enum c_ulong MS_MANDLOCK = 64;
+enum c_ulong MS_DIRSYNC = 128;
+enum c_ulong MS_NOSYMFOLLOW = 256;
+enum c_ulong MS_NOATIME = 1024;
+enum c_ulong MS_NODIRATIME = 2048;
+enum c_ulong MS_BIND = 4096;
+enum c_ulong MS_MOVE = 8192;
+enum c_ulong MS_REC = 16384;
+enum c_ulong MS_SILENT = 32768;
+enum c_ulong MS_POSIXACL = 1 << 16;
+enum c_ulong MS_UNBINDABLE = 1 << 17;
+enum c_ulong MS_PRIVATE = 1 << 18;
+enum c_ulong MS_SLAVE = 1 << 19;
+enum c_ulong MS_SHARED = 1 << 20;
+enum c_ulong MS_RELATIME = 1 << 21;
+enum c_ulong MS_KERNMOUNT = 1 << 22;
+enum c_ulong MS_I_VERSION = 1 << 23;
+enum c_ulong MS_STRICTATIME = 1 << 24;
+enum c_ulong MS_LAZYTIME = 1 << 25;
+enum c_ulong MS_NOREMOTELOCK = 1 << 27;
+enum c_ulong MS_NOSEC = 1 << 28;
+enum c_ulong MS_BORN = 1 << 29;
+enum c_ulong MS_ACTIVE = 1 << 30;
+enum c_ulong MS_NOUSER = 1 << 31;
+
+enum MS_RMT_MASK =
+ MS_RDONLY | MS_SYNCHRONOUS | MS_MANDLOCK | MS_I_VERSION | MS_LAZYTIME;
+
+enum MS_MGC_VAL = 0xC0ED0000;
+enum MS_MGC_MSK = 0xFFFF0000;
+
+enum MNT_FORCE = 1;
+enum MNT_DETACH = 2;
+enum MNT_EXPIRE = 4;
+enum UMOUNT_NOFOLLOW = 8;
+
+int mount(const(char)*, const(char)*, const(char)*, c_ulong, const(void)*);
+int umount(const(char)*);
+int umount2(const(char)*, int);
diff --git a/libphobos/libdruntime/core/sys/posix/config.d b/libphobos/libdruntime/core/sys/posix/config.d
index ae6752f220e..6b80d1ff0e6 100644
--- a/libphobos/libdruntime/core/sys/posix/config.d
+++ b/libphobos/libdruntime/core/sys/posix/config.d
@@ -88,7 +88,7 @@ else version (CRuntime_Musl)
enum __REDIRECT = false;
// Those three are irrelevant for Musl as it always uses 64 bits off_t
- enum __USE_FILE_OFFSET64 = _FILE_OFFSET_BITS == 64;
+ enum __USE_FILE_OFFSET64 = false;
enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT;
enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT;
diff --git a/libphobos/libdruntime/core/sys/posix/mqueue.d b/libphobos/libdruntime/core/sys/posix/mqueue.d
index eae50d27d83..f8b4b150944 100644
--- a/libphobos/libdruntime/core/sys/posix/mqueue.d
+++ b/libphobos/libdruntime/core/sys/posix/mqueue.d
@@ -28,195 +28,231 @@ import core.sys.posix.signal;
import core.sys.posix.time;
version (Posix):
-version (CRuntime_Glibc):
extern (C):
@nogc nothrow:
+version (CRuntime_Glibc)
+{
+ /// Message queue descriptor.
+ alias int mqd_t;
-/// Message queue descriptor.
-alias int mqd_t;
+ /**
+ * Used in getting and setting the attributes of a message queue.
+ */
+ struct mq_attr
+ {
+ /// Message queue flags.
+ c_long mq_flags;
+ /// Maximum number of messages.
+ c_long mq_maxmsg;
+ /// Maximum message size.
+ c_long mq_msgsize;
+ /// Number of messages currently queued.
+ c_long mq_curmsgs;
+ }
-/**
- * Used in getting and setting the attributes of a message queue.
- */
-struct mq_attr
-{
- /// Message queue flags.
- c_long mq_flags;
- /// Maximum number of messages.
- c_long mq_maxmsg;
- /// Maximum message size.
- c_long mq_msgsize;
- /// Number of messages currently queued.
- c_long mq_curmsgs;
-}
+ /**
+ * Establish connection between a process and a message queue `name`.
+ *
+ * Note:
+ * Linux prototypes are:
+ * mqd_t mq_open (const(char)* name, int oflag);
+ * mqd_t mq_open (const(char)* name, int oflag, mode_t mode, mq_attr* attr);
+ *
+ * Params:
+ * name = Name of the message queue to open.
+ * oflag = determines the type of access used.
+ * If `O_CREAT` is on `oflag`, the third argument is taken as a
+ * `mode_t`, the mode of the created message queue.
+ * If `O_CREAT` is on `oflag`, the fourth argument is taken as
+ * a pointer to a `mq_attr' (message queue attributes).
+ * If the fourth argument is `null`, default attributes are used.
+ * ... = varargs matching the function prototypes
+ *
+ * Returns:
+ * Message queue descriptor or (mqd_t) -1 on error.
+ */
+ mqd_t mq_open(const(char)* name, int oflag, ...);
-/**
- * Establish connection between a process and a message queue `name`.
- *
- * Note:
- * Linux prototypes are:
- * mqd_t mq_open (const(char)* name, int oflag);
- * mqd_t mq_open (const(char)* name, int oflag, mode_t mode, mq_attr* attr);
- *
- * Params:
- * name = Name of the message queue to open.
- * oflag = determines the type of access used.
- * If `O_CREAT` is on `oflag`, the third argument is taken as a
- * `mode_t`, the mode of the created message queue.
- * If `O_CREAT` is on `oflag`, the fourth argument is taken as
- * a pointer to a `mq_attr' (message queue attributes).
- * If the fourth argument is `null`, default attributes are used.
- * ... = varargs matching the function prototypes
- *
- * Returns:
- * Message queue descriptor or (mqd_t) -1 on error.
- */
-mqd_t mq_open(const(char)* name, int oflag, ...);
+ /**
+ * Closes the message queue descriptor mqdes.
+ *
+ * Params:
+ * mqdes = Message queue descriptor to close.
+ *
+ * Returns:
+ * On success mq_close() returns 0; on error, -1 is returned, with errno
+ * set to indicate the error.
+ */
+ int mq_close (mqd_t mqdes);
-/**
- * Closes the message queue descriptor mqdes.
- *
- * Params:
- * mqdes = Message queue descriptor to close.
- *
- * Returns:
- * On success mq_close() returns 0; on error, -1 is returned, with errno
- * set to indicate the error.
- */
-int mq_close (mqd_t mqdes);
+ /**
+ * Query status and attributes of message queue `mqdes`.
+ *
+ * Params:
+ * mqdes = Message queue descriptor.
+ * mqstat = Buffer to fill with the message queue's attributes.
+ *
+ * Returns:
+ * On success mq_getattr() return 0; on error, -1 is returned, with errno
+ * set to indicate the error.
+ */
+ int mq_getattr (mqd_t mqdes, mq_attr* mqstat);
-/**
- * Query status and attributes of message queue `mqdes`.
- *
- * Params:
- * mqdes = Message queue descriptor.
- * mqstat = Buffer to fill with the message queue's attributes.
- *
- * Returns:
- * On success mq_getattr() return 0; on error, -1 is returned, with errno
- * set to indicate the error.
- */
-int mq_getattr (mqd_t mqdes, mq_attr* mqstat);
+ /*
+ * Set attributes associated with message queue `mqdes`
+ *
+ * Params:
+ * mqdes = Message queue descriptor.
+ * newstat = non-null pointer to fill with attributes for `mqdes`.
+ * oldstat = if not `null` it is filled with the old attributes.
+ *
+ * Returns:
+ * On success mq_setattr() return 0; on error, -1 is returned, with errno
+ * set to indicate the error.
+ */
+ int mq_setattr (mqd_t mqdes, const(mq_attr)* newstat, mq_attr* oldstat);
-/*
- * Set attributes associated with message queue `mqdes`
- *
- * Params:
- * mqdes = Message queue descriptor.
- * newstat = non-null pointer to fill with attributes for `mqdes`.
- * oldstat = if not `null` it is filled with the old attributes.
- *
- * Returns:
- * On success mq_setattr() return 0; on error, -1 is returned, with errno
- * set to indicate the error.
- */
-int mq_setattr (mqd_t mqdes, const(mq_attr)* newstat, mq_attr* oldstat);
+ /**
+ * Remove the specified message queue `name`.
+ *
+ * Params:
+ * name = Name of the queue to remove.
+ *
+ * Returns:
+ * On success mq_unlink() returns 0; on error, -1 is returned, with errno
+ * set to indicate the error.
+ */
+ int mq_unlink (const(char)* name);
-/**
- * Remove the specified message queue `name`.
- *
- * Params:
- * name = Name of the queue to remove.
- *
- * Returns:
- * On success mq_unlink() returns 0; on error, -1 is returned, with errno
- * set to indicate the error.
- */
-int mq_unlink (const(char)* name);
+ /**
+ * Register for notification when a message is available
+ *
+ * Params:
+ * mqdes = Message queue descriptor.
+ * notification = See `man 3 mq_notify` for details.
+ *
+ * Returns:
+ * On success mq_notify() returns 0; on error, -1 is returned, with errno
+ * set to indicate the error.
+ */
+ int mq_notify (mqd_t mqdes, const(sigevent)* notification);
-/**
- * Register for notification when a message is available
- *
- * Params:
- * mqdes = Message queue descriptor.
- * notification = See `man 3 mq_notify` for details.
- *
- * Returns:
- * On success mq_notify() returns 0; on error, -1 is returned, with errno
- * set to indicate the error.
- */
-int mq_notify (mqd_t mqdes, const(sigevent)* notification);
+ /**
+ * Receive the oldest message with the highest priority the message queue
+ *
+ * Params:
+ * mqdes = Message queue descriptor.
+ * msg_ptr = Buffer to write the message to
+ * msg_len = Size of the buffer provided as `msg_ptr`. Must be greater
+ * than the mq_msgsize attribute of the queue.
+ * msg_prio = If not `null`, set to the priority of this message.
+ *
+ * Returns:
+ * On success, mq_receive() returns the number of bytes in the received
+ * message; on error, -1 is returned, with errno set to indicate the error
+ */
+ ssize_t mq_receive (mqd_t mqdes, char* msg_ptr, size_t msg_len, uint* msg_prio);
-/**
- * Receive the oldest message with the highest priority the message queue
- *
- * Params:
- * mqdes = Message queue descriptor.
- * msg_ptr = Buffer to write the message to
- * msg_len = Size of the buffer provided as `msg_ptr`. Must be greater
- * than the mq_msgsize attribute of the queue.
- * msg_prio = If not `null`, set to the priority of this message.
- *
- * Returns:
- * On success, mq_receive() returns the number of bytes in the received
- * message; on error, -1 is returned, with errno set to indicate the error
- */
-ssize_t mq_receive (mqd_t mqdes, char* msg_ptr, size_t msg_len, uint* msg_prio);
+ /**
+ * Receive the oldest message with the highest priority the message queue,
+ * wait up to a certain timeout.
+ *
+ * Params:
+ * mqdes = Message queue descriptor.
+ * msg_ptr = Buffer to write the message to
+ * msg_len = Size of the buffer provided as `msg_ptr`. Must be greater
+ * than the mq_msgsize attribute of the queue.
+ * msg_prio = If not `null`, set to the priority of this message.
+ * abs_timeout = Specify a ceiling on the time to block if the queue is empty.
+ *
+ * Returns:
+ * On success, mq_receive() returns the number of bytes in the received
+ * message; on error, -1 is returned, with errno set to indicate the error
+ */
+ pragma(mangle, muslRedirTime64Mangle!("mq_timedreceive", "__mq_timedreceive_time64"))
+ ssize_t mq_timedreceive (mqd_t mqdes, char* msg_ptr, size_t msg_len,
+ uint* msg_prio, const(timespec)* abs_timeout);
-/**
- * Receive the oldest message with the highest priority the message queue,
- * wait up to a certain timeout.
- *
- * Params:
- * mqdes = Message queue descriptor.
- * msg_ptr = Buffer to write the message to
- * msg_len = Size of the buffer provided as `msg_ptr`. Must be greater
- * than the mq_msgsize attribute of the queue.
- * msg_prio = If not `null`, set to the priority of this message.
- * abs_timeout = Specify a ceiling on the time to block if the queue is empty.
- *
- * Returns:
- * On success, mq_receive() returns the number of bytes in the received
- * message; on error, -1 is returned, with errno set to indicate the error
- */
-pragma(mangle, muslRedirTime64Mangle!("mq_timedreceive", "__mq_timedreceive_time64"))
-ssize_t mq_timedreceive (mqd_t mqdes, char* msg_ptr, size_t msg_len,
- uint* msg_prio, const(timespec)* abs_timeout);
+ /**
+ * Add a message to a message queue.
+ *
+ * Params:
+ * mqdes = Message queue descriptor.
+ * msg_ptr = Buffer to read the message from
+ * msg_len = Size of the message provided via `msg_ptr`. Must be lower
+ * or equal to the mq_msgsize attribute of the queue.
+ * msg_prio = Priority of this message.
+ *
+ * Returns:
+ * On success, mq_send() return zero; on error, -1 is returned, with errno
+ * set to indicate the error.
+ */
+ int mq_send (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len, uint msg_prio);
-/**
- * Add a message to a message queue.
- *
- * Params:
- * mqdes = Message queue descriptor.
- * msg_ptr = Buffer to read the message from
- * msg_len = Size of the message provided via `msg_ptr`. Must be lower
- * or equal to the mq_msgsize attribute of the queue.
- * msg_prio = Priority of this message.
- *
- * Returns:
- * On success, mq_send() return zero; on error, -1 is returned, with errno
- * set to indicate the error.
- */
-int mq_send (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len, uint msg_prio);
+ /**
+ * Add a message to a message queue, block up to a certain time if the queue
+ * is full.
+ *
+ * Params:
+ * mqdes = Message queue descriptor.
+ * msg_ptr = Buffer to read the message from
+ * msg_len = Size of the message provided via `msg_ptr`. Must be lower
+ * or equal to the mq_msgsize attribute of the queue.
+ * msg_prio = Priority of this message.
+ * abs_timeout = Specify a ceiling on the time to block if the queue is empty.
+ *
+ * Returns:
+ * On success, mq_timedsend() return zero; on error, -1 is returned,
+ * with errno set to indicate the error.
+ *
+ */
+ pragma(mangle, muslRedirTime64Mangle!("mq_timedsend", "__mq_timedsend_time64"))
+ int mq_timedsend (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len,
+ uint msg_prio, const(timespec)* abs_timeout);
+}
+else version (FreeBSD)
+{
+ private struct __mq;
-/**
- * Add a message to a message queue, block up to a certain time if the queue
- * is full.
- *
- * Params:
- * mqdes = Message queue descriptor.
- * msg_ptr = Buffer to read the message from
- * msg_len = Size of the message provided via `msg_ptr`. Must be lower
- * or equal to the mq_msgsize attribute of the queue.
- * msg_prio = Priority of this message.
- * abs_timeout = Specify a ceiling on the time to block if the queue is empty.
- *
- * Returns:
- * On success, mq_timedsend() return zero; on error, -1 is returned,
- * with errno set to indicate the error.
- *
- */
-pragma(mangle, muslRedirTime64Mangle!("mq_timedsend", "__mq_timedsend_time64"))
-int mq_timedsend (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len,
- uint msg_prio, const(timespec)* abs_timeout);
+ alias mqd_t = __mq*;
+
+ struct mq_attr
+ {
+ c_long mq_flags;
+ c_long mq_maxmsg;
+ c_long mq_msgsize;
+ c_long mq_curmsgs;
+ c_long[4] __reserved;
+ }
+
+ int mq_close(mqd_t);
+
+ int mq_getattr(mqd_t, mq_attr*);
+
+ int mq_notify(mqd_t, const sigevent*);
+
+ mqd_t mq_open(const char*, int, ...);
+
+ ssize_t mq_receive(mqd_t, char*, size_t, uint*);
+
+ int mq_send(mqd_t, const char*, size_t, uint);
+
+ int mq_setattr(mqd_t, const mq_attr*, mq_attr*);
+
+ ssize_t mq_timedreceive(mqd_t, char*, size_t, uint*, const timespec*);
+
+ int mq_timedsend(mqd_t, const char*, size_t, uint, const timespec*);
+
+ int mq_unlink(const char*);
+}
diff --git a/libphobos/libdruntime/core/sys/solaris/sys/priocntl.d b/libphobos/libdruntime/core/sys/solaris/sys/priocntl.d
index c56be3b00f8..87e3e47f503 100644
--- a/libphobos/libdruntime/core/sys/solaris/sys/priocntl.d
+++ b/libphobos/libdruntime/core/sys/solaris/sys/priocntl.d
@@ -2,7 +2,7 @@
* D header file for the Solaris priocntl(2) and priocntlset(2) functions.
*
* Copyright: Copyright 2014 Jason King.
- * License: $(HTTP www.boost.org/LICENSE_1.0.txt, Boost License 1.0).
+ * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Jason King
*/
diff --git a/libphobos/libdruntime/core/sys/solaris/sys/procset.d b/libphobos/libdruntime/core/sys/solaris/sys/procset.d
index 8bd91157007..9266aee12a1 100644
--- a/libphobos/libdruntime/core/sys/solaris/sys/procset.d
+++ b/libphobos/libdruntime/core/sys/solaris/sys/procset.d
@@ -2,7 +2,7 @@
* D header file defining a process set.
*
* Copyright: Copyright 2014 Jason King.
- * License: $(HTTP www.boost.org/LICENSE_1.0.txt, Boost License 1.0).
+ * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Jason King
*/
diff --git a/libphobos/libdruntime/core/sys/solaris/sys/types.d b/libphobos/libdruntime/core/sys/solaris/sys/types.d
index 4b30a686a92..58558769b71 100644
--- a/libphobos/libdruntime/core/sys/solaris/sys/types.d
+++ b/libphobos/libdruntime/core/sys/solaris/sys/types.d
@@ -2,7 +2,7 @@
* D header file that defines Solaris-specific types.
*
* Copyright: Copyright 2014 Jason King.
- * License: $(HTTP www.boost.org/LICENSE_1.0.txt, Boost License 1.0).
+ * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Jason King
*/
diff --git a/libphobos/libdruntime/core/thread/fiber.d b/libphobos/libdruntime/core/thread/fiber.d
index 48b6f9ef006..e02733bd970 100644
--- a/libphobos/libdruntime/core/thread/fiber.d
+++ b/libphobos/libdruntime/core/thread/fiber.d
@@ -150,6 +150,14 @@ private
version = AsmExternal;
}
}
+ else version (MIPS_N64)
+ {
+ version (Posix)
+ {
+ version = AsmMIPS_N64_Posix;
+ version = AsmExternal;
+ }
+ }
else version (AArch64)
{
version (Posix)
@@ -1437,6 +1445,44 @@ private:
pstack -= ABOVE;
*cast(size_t*)(pstack - SZ_RA) = cast(size_t)&fiber_entryPoint;
}
+ else version (AsmMIPS_N64_Posix)
+ {
+ version (StackGrowsDown) {}
+ else static assert(0);
+
+ /* We keep the FP registers and the return address below
+ * the stack pointer, so they don't get scanned by the
+ * GC. The last frame before swapping the stack pointer is
+ * organized like the following.
+ *
+ * |-----------|<= frame pointer
+ * | $fp/$gp |
+ * | $s0-7 |
+ * |-----------|<= stack pointer
+ * | $ra |
+ * | $f24-31 |
+ * |-----------|
+ *
+ */
+ enum SZ_GP = 10 * size_t.sizeof; // $fp + $gp + $s0-7
+ enum SZ_RA = size_t.sizeof; // $ra
+ version (MIPS_HardFloat)
+ {
+ enum SZ_FP = 8 * double.sizeof; // $f24-31
+ }
+ else
+ {
+ enum SZ_FP = 0;
+ }
+
+ enum BELOW = SZ_FP + SZ_RA;
+ enum ABOVE = SZ_GP;
+ enum SZ = BELOW + ABOVE;
+
+ (cast(ubyte*)pstack - SZ)[0 .. SZ] = 0;
+ pstack -= ABOVE;
+ *cast(size_t*)(pstack - SZ_RA) = cast(size_t)&fiber_entryPoint;
+ }
else version (AsmLoongArch64_Posix)
{
// Like others, FP registers and return address ($r1) are kept
diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d
index a9fcf96254b..0bdb45a343f 100644
--- a/libphobos/libdruntime/core/thread/osthread.d
+++ b/libphobos/libdruntime/core/thread/osthread.d
@@ -977,7 +977,7 @@ class Thread : ThreadBase
*
* ------------------------------------------------------------------------
*/
- static void sleep( Duration val ) @nogc nothrow
+ static void sleep( Duration val ) @nogc nothrow @trusted
in
{
assert( !val.isNegative );
@@ -1242,6 +1242,12 @@ unittest
thread_resumeAll();
}
+@nogc @safe nothrow
+unittest
+{
+ Thread.sleep(1.msecs);
+}
+
///////////////////////////////////////////////////////////////////////////////
// GC Support Routines
///////////////////////////////////////////////////////////////////////////////
diff --git a/libphobos/libdruntime/object.d b/libphobos/libdruntime/object.d
index 4264ecf6fd6..9bc929ce8ef 100644
--- a/libphobos/libdruntime/object.d
+++ b/libphobos/libdruntime/object.d
@@ -3614,7 +3614,7 @@ if (is(typeof(create()) : V) && (is(typeof(update(aa[K.init])) : V) || is(typeof
@safe const:
// stubs
bool opEquals(S rhs) { assert(0); }
- size_t toHash() { assert(0); }
+ size_t toHash() const { assert(0); }
}
int[string] aai;