aboutsummaryrefslogtreecommitdiff
path: root/libphobos/libdruntime
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2024-01-28 12:23:14 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2024-02-03 12:03:37 +0100
commit51c4eb28c192ecff4463c973a0ff089e04a80b89 (patch)
tree160ac2ef2c9d732681e96577ef0009027092aea6 /libphobos/libdruntime
parent854b8555bd49ad97c336b8df7098e725dc196e4f (diff)
downloadgcc-51c4eb28c192ecff4463c973a0ff089e04a80b89.zip
gcc-51c4eb28c192ecff4463c973a0ff089e04a80b89.tar.gz
gcc-51c4eb28c192ecff4463c973a0ff089e04a80b89.tar.bz2
d: Merge dmd. druntime e770945277, phobos 6d6e0b9b9
D front-end changes: - Import latest fixes from dmd v2.107.0-beta.1. - Hex strings can now be cast to integer arrays. - Add support for Interpolated Expression Sequences. D runtime changes: - Import latest fixes from druntime v2.107.0-beta.1. - New core.interpolation module to provide run-time support for D interpolated expression sequence literals. Phobos changes: - Import latest fixes from phobos v2.107.0-beta.1. - `std.range.primitives.isBidirectionalRange', and `std.range.primitives.isRandomAccessRange' now take an optional element type. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd e770945277. * Make-lang.in (D_FRONTEND_OBJS): Add d/basicmangle.o, d/enumsem.o, d/funcsem.o, d/templatesem.o. * d-builtins.cc (build_frontend_type): Update for new front-end interface. * d-codegen.cc (declaration_type): Likewise. (parameter_type): Likewise. * d-incpath.cc (add_globalpaths): Likewise. (add_filepaths): Likewise. (add_import_paths): Likewise. * d-lang.cc (d_init_options): Likewise. (d_handle_option): Likewise. (d_parse_file): Likewise. * decl.cc (DeclVisitor::finish_vtable): Likewise. (DeclVisitor::visit (FuncDeclaration *)): Likewise. (get_symbol_decl): Likewise. * expr.cc (ExprVisitor::visit (StringExp *)): Likewise. Implement support for 8-byte hexadecimal strings. * typeinfo.cc (create_tinfo_types): Update internal TypeInfo representation. (TypeInfoVisitor::visit (TypeInfoConstDeclaration *)): Update for new front-end interface. (TypeInfoVisitor::visit (TypeInfoInvariantDeclaration *)): Likewise. (TypeInfoVisitor::visit (TypeInfoSharedDeclaration *)): Likewise. (TypeInfoVisitor::visit (TypeInfoWildDeclaration *)): Likewise. (TypeInfoVisitor::visit (TypeInfoClassDeclaration *)): Move data for TypeInfo_Class.nameSig to the end of the object. (create_typeinfo): Update for new front-end interface. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime e770945277. * libdruntime/Makefile.am (DRUNTIME_SOURCES): Add core/interpolation.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 6d6e0b9b9.
Diffstat (limited to 'libphobos/libdruntime')
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/Makefile.am53
-rw-r--r--libphobos/libdruntime/Makefile.in100
-rw-r--r--libphobos/libdruntime/core/internal/array/construction.d15
-rw-r--r--libphobos/libdruntime/core/internal/array/duplication.d10
-rw-r--r--libphobos/libdruntime/core/internal/array/utils.d1
-rw-r--r--libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d4
-rw-r--r--libphobos/libdruntime/core/interpolation.d156
-rw-r--r--libphobos/libdruntime/core/lifetime.d2
-rw-r--r--libphobos/libdruntime/core/stdc/string.d2
-rw-r--r--libphobos/libdruntime/core/sys/posix/string.d2
-rw-r--r--libphobos/libdruntime/core/thread/osthread.d5
-rw-r--r--libphobos/libdruntime/core/thread/threadbase.d10
-rw-r--r--libphobos/libdruntime/object.d5
-rw-r--r--libphobos/libdruntime/rt/cast_.d17
15 files changed, 279 insertions, 105 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index 138b0b6..9217c65 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-bce5c1f7b521d22dcf1ea4e2bc3f76d9d28274fa
+e7709452775d374c1e2dfb67566668ada3dec5fc
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 3ef98dc..d2fb6e2 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -196,32 +196,33 @@ DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \
core/internal/parseoptions.d core/internal/postblit.d \
core/internal/qsort.d core/internal/spinlock.d core/internal/string.d \
core/internal/switch_.d core/internal/traits.d core/internal/utf.d \
- core/internal/util/array.d core/internal/util/math.d core/lifetime.d \
- core/math.d core/memory.d core/runtime.d core/simd.d \
- core/stdc/assert_.d core/stdc/complex.d core/stdc/config.d \
- core/stdc/ctype.d core/stdc/errno.d core/stdc/fenv.d \
- core/stdc/float_.d core/stdc/inttypes.d core/stdc/limits.d \
- core/stdc/locale.d core/stdc/math.d core/stdc/signal.d \
- core/stdc/stdarg.d core/stdc/stdatomic.d core/stdc/stddef.d \
- core/stdc/stdint.d core/stdc/stdio.d core/stdc/stdlib.d \
- core/stdc/string.d core/stdc/tgmath.d core/stdc/time.d \
- core/stdc/wchar_.d core/stdc/wctype.d core/sync/barrier.d \
- core/sync/condition.d core/sync/config.d core/sync/event.d \
- core/sync/exception.d core/sync/mutex.d core/sync/package.d \
- core/sync/rwmutex.d core/sync/semaphore.d core/thread/context.d \
- core/thread/fiber.d core/thread/osthread.d core/thread/package.d \
- core/thread/threadbase.d core/thread/threadgroup.d core/thread/types.d \
- core/time.d core/vararg.d core/volatile.d etc/valgrind/valgrind.d \
- gcc/attribute.d gcc/attributes.d gcc/backtrace.d gcc/builtins.d \
- gcc/deh.d gcc/emutls.d gcc/gthread.d gcc/sections/common.d \
- gcc/sections/elf.d gcc/sections/macho.d gcc/sections/package.d \
- gcc/sections/pecoff.d gcc/simd.d gcc/unwind/arm.d \
- gcc/unwind/arm_common.d gcc/unwind/c6x.d gcc/unwind/generic.d \
- gcc/unwind/package.d gcc/unwind/pe.d object.d rt/aApply.d rt/aApplyR.d \
- rt/aaA.d rt/adi.d rt/arraycat.d rt/cast_.d rt/config.d rt/critical_.d \
- rt/deh.d rt/dmain2.d rt/ehalloc.d rt/invariant.d rt/lifetime.d \
- rt/memory.d rt/minfo.d rt/monitor_.d rt/profilegc.d rt/sections.d \
- rt/tlsgc.d rt/util/typeinfo.d rt/util/utility.d
+ core/internal/util/array.d core/internal/util/math.d \
+ core/interpolation.d core/lifetime.d core/math.d core/memory.d \
+ core/runtime.d core/simd.d core/stdc/assert_.d core/stdc/complex.d \
+ core/stdc/config.d core/stdc/ctype.d core/stdc/errno.d \
+ core/stdc/fenv.d core/stdc/float_.d core/stdc/inttypes.d \
+ core/stdc/limits.d core/stdc/locale.d core/stdc/math.d \
+ core/stdc/signal.d core/stdc/stdarg.d core/stdc/stdatomic.d \
+ core/stdc/stddef.d core/stdc/stdint.d core/stdc/stdio.d \
+ core/stdc/stdlib.d core/stdc/string.d core/stdc/tgmath.d \
+ core/stdc/time.d core/stdc/wchar_.d core/stdc/wctype.d \
+ core/sync/barrier.d core/sync/condition.d core/sync/config.d \
+ core/sync/event.d core/sync/exception.d core/sync/mutex.d \
+ core/sync/package.d core/sync/rwmutex.d core/sync/semaphore.d \
+ core/thread/context.d core/thread/fiber.d core/thread/osthread.d \
+ core/thread/package.d core/thread/threadbase.d \
+ core/thread/threadgroup.d core/thread/types.d core/time.d \
+ core/vararg.d core/volatile.d etc/valgrind/valgrind.d gcc/attribute.d \
+ gcc/attributes.d gcc/backtrace.d gcc/builtins.d gcc/deh.d gcc/emutls.d \
+ gcc/gthread.d gcc/sections/common.d gcc/sections/elf.d \
+ gcc/sections/macho.d gcc/sections/package.d gcc/sections/pecoff.d \
+ gcc/simd.d gcc/unwind/arm.d gcc/unwind/arm_common.d gcc/unwind/c6x.d \
+ gcc/unwind/generic.d gcc/unwind/package.d gcc/unwind/pe.d object.d \
+ rt/aApply.d rt/aApplyR.d rt/aaA.d rt/adi.d rt/arraycat.d rt/cast_.d \
+ rt/config.d rt/critical_.d rt/deh.d rt/dmain2.d rt/ehalloc.d \
+ rt/invariant.d rt/lifetime.d rt/memory.d rt/minfo.d rt/monitor_.d \
+ rt/profilegc.d rt/sections.d rt/tlsgc.d rt/util/typeinfo.d \
+ rt/util/utility.d
DRUNTIME_DSOURCES_STDCXX = core/stdcpp/allocator.d core/stdcpp/array.d \
core/stdcpp/exception.d core/stdcpp/memory.d core/stdcpp/new_.d \
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 1d2bd66..3e3ab56 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -220,29 +220,29 @@ am__objects_1 = core/atomic.lo core/attribute.lo core/bitop.lo \
core/internal/string.lo core/internal/switch_.lo \
core/internal/traits.lo core/internal/utf.lo \
core/internal/util/array.lo core/internal/util/math.lo \
- core/lifetime.lo core/math.lo core/memory.lo core/runtime.lo \
- core/simd.lo core/stdc/assert_.lo core/stdc/complex.lo \
- core/stdc/config.lo core/stdc/ctype.lo core/stdc/errno.lo \
- core/stdc/fenv.lo core/stdc/float_.lo core/stdc/inttypes.lo \
- core/stdc/limits.lo core/stdc/locale.lo core/stdc/math.lo \
- core/stdc/signal.lo core/stdc/stdarg.lo core/stdc/stdatomic.lo \
- core/stdc/stddef.lo core/stdc/stdint.lo core/stdc/stdio.lo \
- core/stdc/stdlib.lo core/stdc/string.lo core/stdc/tgmath.lo \
- core/stdc/time.lo core/stdc/wchar_.lo core/stdc/wctype.lo \
- core/sync/barrier.lo core/sync/condition.lo \
- core/sync/config.lo core/sync/event.lo core/sync/exception.lo \
- core/sync/mutex.lo core/sync/package.lo core/sync/rwmutex.lo \
- core/sync/semaphore.lo core/thread/context.lo \
- core/thread/fiber.lo core/thread/osthread.lo \
- core/thread/package.lo core/thread/threadbase.lo \
- core/thread/threadgroup.lo core/thread/types.lo core/time.lo \
- core/vararg.lo core/volatile.lo etc/valgrind/valgrind.lo \
- gcc/attribute.lo gcc/attributes.lo gcc/backtrace.lo \
- gcc/builtins.lo gcc/deh.lo gcc/emutls.lo gcc/gthread.lo \
- gcc/sections/common.lo gcc/sections/elf.lo \
- gcc/sections/macho.lo gcc/sections/package.lo \
- gcc/sections/pecoff.lo gcc/simd.lo gcc/unwind/arm.lo \
- gcc/unwind/arm_common.lo gcc/unwind/c6x.lo \
+ core/interpolation.lo core/lifetime.lo core/math.lo \
+ core/memory.lo core/runtime.lo core/simd.lo \
+ core/stdc/assert_.lo core/stdc/complex.lo core/stdc/config.lo \
+ core/stdc/ctype.lo core/stdc/errno.lo core/stdc/fenv.lo \
+ core/stdc/float_.lo core/stdc/inttypes.lo core/stdc/limits.lo \
+ core/stdc/locale.lo core/stdc/math.lo core/stdc/signal.lo \
+ core/stdc/stdarg.lo core/stdc/stdatomic.lo core/stdc/stddef.lo \
+ core/stdc/stdint.lo core/stdc/stdio.lo core/stdc/stdlib.lo \
+ core/stdc/string.lo core/stdc/tgmath.lo core/stdc/time.lo \
+ core/stdc/wchar_.lo core/stdc/wctype.lo core/sync/barrier.lo \
+ core/sync/condition.lo core/sync/config.lo core/sync/event.lo \
+ core/sync/exception.lo core/sync/mutex.lo core/sync/package.lo \
+ core/sync/rwmutex.lo core/sync/semaphore.lo \
+ core/thread/context.lo core/thread/fiber.lo \
+ core/thread/osthread.lo core/thread/package.lo \
+ core/thread/threadbase.lo core/thread/threadgroup.lo \
+ core/thread/types.lo core/time.lo core/vararg.lo \
+ core/volatile.lo etc/valgrind/valgrind.lo gcc/attribute.lo \
+ gcc/attributes.lo gcc/backtrace.lo gcc/builtins.lo gcc/deh.lo \
+ gcc/emutls.lo gcc/gthread.lo gcc/sections/common.lo \
+ gcc/sections/elf.lo gcc/sections/macho.lo \
+ gcc/sections/package.lo gcc/sections/pecoff.lo gcc/simd.lo \
+ gcc/unwind/arm.lo gcc/unwind/arm_common.lo gcc/unwind/c6x.lo \
gcc/unwind/generic.lo gcc/unwind/package.lo gcc/unwind/pe.lo \
object.lo rt/aApply.lo rt/aApplyR.lo rt/aaA.lo rt/adi.lo \
rt/arraycat.lo rt/cast_.lo rt/config.lo rt/critical_.lo \
@@ -874,32 +874,33 @@ DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \
core/internal/parseoptions.d core/internal/postblit.d \
core/internal/qsort.d core/internal/spinlock.d core/internal/string.d \
core/internal/switch_.d core/internal/traits.d core/internal/utf.d \
- core/internal/util/array.d core/internal/util/math.d core/lifetime.d \
- core/math.d core/memory.d core/runtime.d core/simd.d \
- core/stdc/assert_.d core/stdc/complex.d core/stdc/config.d \
- core/stdc/ctype.d core/stdc/errno.d core/stdc/fenv.d \
- core/stdc/float_.d core/stdc/inttypes.d core/stdc/limits.d \
- core/stdc/locale.d core/stdc/math.d core/stdc/signal.d \
- core/stdc/stdarg.d core/stdc/stdatomic.d core/stdc/stddef.d \
- core/stdc/stdint.d core/stdc/stdio.d core/stdc/stdlib.d \
- core/stdc/string.d core/stdc/tgmath.d core/stdc/time.d \
- core/stdc/wchar_.d core/stdc/wctype.d core/sync/barrier.d \
- core/sync/condition.d core/sync/config.d core/sync/event.d \
- core/sync/exception.d core/sync/mutex.d core/sync/package.d \
- core/sync/rwmutex.d core/sync/semaphore.d core/thread/context.d \
- core/thread/fiber.d core/thread/osthread.d core/thread/package.d \
- core/thread/threadbase.d core/thread/threadgroup.d core/thread/types.d \
- core/time.d core/vararg.d core/volatile.d etc/valgrind/valgrind.d \
- gcc/attribute.d gcc/attributes.d gcc/backtrace.d gcc/builtins.d \
- gcc/deh.d gcc/emutls.d gcc/gthread.d gcc/sections/common.d \
- gcc/sections/elf.d gcc/sections/macho.d gcc/sections/package.d \
- gcc/sections/pecoff.d gcc/simd.d gcc/unwind/arm.d \
- gcc/unwind/arm_common.d gcc/unwind/c6x.d gcc/unwind/generic.d \
- gcc/unwind/package.d gcc/unwind/pe.d object.d rt/aApply.d rt/aApplyR.d \
- rt/aaA.d rt/adi.d rt/arraycat.d rt/cast_.d rt/config.d rt/critical_.d \
- rt/deh.d rt/dmain2.d rt/ehalloc.d rt/invariant.d rt/lifetime.d \
- rt/memory.d rt/minfo.d rt/monitor_.d rt/profilegc.d rt/sections.d \
- rt/tlsgc.d rt/util/typeinfo.d rt/util/utility.d
+ core/internal/util/array.d core/internal/util/math.d \
+ core/interpolation.d core/lifetime.d core/math.d core/memory.d \
+ core/runtime.d core/simd.d core/stdc/assert_.d core/stdc/complex.d \
+ core/stdc/config.d core/stdc/ctype.d core/stdc/errno.d \
+ core/stdc/fenv.d core/stdc/float_.d core/stdc/inttypes.d \
+ core/stdc/limits.d core/stdc/locale.d core/stdc/math.d \
+ core/stdc/signal.d core/stdc/stdarg.d core/stdc/stdatomic.d \
+ core/stdc/stddef.d core/stdc/stdint.d core/stdc/stdio.d \
+ core/stdc/stdlib.d core/stdc/string.d core/stdc/tgmath.d \
+ core/stdc/time.d core/stdc/wchar_.d core/stdc/wctype.d \
+ core/sync/barrier.d core/sync/condition.d core/sync/config.d \
+ core/sync/event.d core/sync/exception.d core/sync/mutex.d \
+ core/sync/package.d core/sync/rwmutex.d core/sync/semaphore.d \
+ core/thread/context.d core/thread/fiber.d core/thread/osthread.d \
+ core/thread/package.d core/thread/threadbase.d \
+ core/thread/threadgroup.d core/thread/types.d core/time.d \
+ core/vararg.d core/volatile.d etc/valgrind/valgrind.d gcc/attribute.d \
+ gcc/attributes.d gcc/backtrace.d gcc/builtins.d gcc/deh.d gcc/emutls.d \
+ gcc/gthread.d gcc/sections/common.d gcc/sections/elf.d \
+ gcc/sections/macho.d gcc/sections/package.d gcc/sections/pecoff.d \
+ gcc/simd.d gcc/unwind/arm.d gcc/unwind/arm_common.d gcc/unwind/c6x.d \
+ gcc/unwind/generic.d gcc/unwind/package.d gcc/unwind/pe.d object.d \
+ rt/aApply.d rt/aApplyR.d rt/aaA.d rt/adi.d rt/arraycat.d rt/cast_.d \
+ rt/config.d rt/critical_.d rt/deh.d rt/dmain2.d rt/ehalloc.d \
+ rt/invariant.d rt/lifetime.d rt/memory.d rt/minfo.d rt/monitor_.d \
+ rt/profilegc.d rt/sections.d rt/tlsgc.d rt/util/typeinfo.d \
+ rt/util/utility.d
DRUNTIME_DSOURCES_STDCXX = core/stdcpp/allocator.d core/stdcpp/array.d \
core/stdcpp/exception.d core/stdcpp/memory.d core/stdcpp/new_.d \
@@ -1296,6 +1297,7 @@ core/internal/util/$(am__dirstamp):
@: > core/internal/util/$(am__dirstamp)
core/internal/util/array.lo: core/internal/util/$(am__dirstamp)
core/internal/util/math.lo: core/internal/util/$(am__dirstamp)
+core/interpolation.lo: core/$(am__dirstamp)
core/lifetime.lo: core/$(am__dirstamp)
core/math.lo: core/$(am__dirstamp)
core/memory.lo: core/$(am__dirstamp)
diff --git a/libphobos/libdruntime/core/internal/array/construction.d b/libphobos/libdruntime/core/internal/array/construction.d
index 655acc8..0950b5a 100644
--- a/libphobos/libdruntime/core/internal/array/construction.d
+++ b/libphobos/libdruntime/core/internal/array/construction.d
@@ -339,17 +339,20 @@ void _d_arraysetctor(Tarr : T[], T)(scope Tarr p, scope ref T value) @trusted
* Returns:
* newly allocated array
*/
-T[] _d_newarrayU(T)(size_t length, bool isShared=false) pure nothrow @nogc @trusted
+T[] _d_newarrayUPureNothrow(T)(size_t length, bool isShared=false) pure nothrow @trusted
{
- alias PureType = T[] function(size_t length, bool isShared) pure nothrow @nogc @trusted;
- return (cast(PureType) &_d_newarrayUImpl!T)(length, isShared);
+ alias PureType = T[] function(size_t length, bool isShared) pure nothrow @trusted;
+ return (cast(PureType) &_d_newarrayU!T)(length, isShared);
}
-T[] _d_newarrayUImpl(T)(size_t length, bool isShared=false) @trusted
+T[] _d_newarrayU(T)(size_t length, bool isShared=false) @trusted
{
import core.exception : onOutOfMemoryError;
+ import core.internal.traits : Unqual;
import core.internal.array.utils : __arrayStart, __setArrayAllocLength, __arrayAlloc;
+ alias UnqT = Unqual!T;
+
size_t elemSize = T.sizeof;
size_t arraySize;
@@ -392,14 +395,14 @@ Loverflow:
assert(0);
Lcontinue:
- auto info = __arrayAlloc!T(arraySize);
+ auto info = __arrayAlloc!UnqT(arraySize);
if (!info.base)
goto Loverflow;
debug(PRINTF) printf("p = %p\n", info.base);
auto arrstart = __arrayStart(info);
- __setArrayAllocLength!T(info, arraySize, isShared);
+ __setArrayAllocLength!UnqT(info, arraySize, isShared);
return (cast(T*) arrstart)[0 .. length];
}
diff --git a/libphobos/libdruntime/core/internal/array/duplication.d b/libphobos/libdruntime/core/internal/array/duplication.d
index 21894c2..eec6af9 100644
--- a/libphobos/libdruntime/core/internal/array/duplication.d
+++ b/libphobos/libdruntime/core/internal/array/duplication.d
@@ -8,8 +8,6 @@ Source: $(DRUNTIMESRC core/internal/_array/_duplication.d)
*/
module core.internal.array.duplication;
-private extern (C) void[] _d_newarrayU(const scope TypeInfo ti, size_t length) pure nothrow;
-
U[] _dup(T, U)(scope T[] a) pure nothrow @trusted if (__traits(isPOD, T))
{
if (__ctfe)
@@ -22,8 +20,9 @@ U[] _dup(T, U)(scope T[] a) pure nothrow @trusted if (__traits(isPOD, T))
else
{
import core.stdc.string : memcpy;
- auto arr = _d_newarrayU(typeid(T[]), a.length);
- memcpy(arr.ptr, cast(const(void)*) a.ptr, T.sizeof * a.length);
+ import core.internal.array.construction: _d_newarrayUPureNothrow;
+ auto arr = _d_newarrayUPureNothrow!T(a.length, is(T == shared));
+ memcpy(cast(void*) arr.ptr, cast(const(void)*) a.ptr, T.sizeof * a.length);
return *cast(U[]*) &arr;
}
}
@@ -55,8 +54,9 @@ U[] _dup(T, U)(T[] a) if (!__traits(isPOD, T))
else
{
import core.lifetime: copyEmplace;
+ import core.internal.array.construction: _d_newarrayU;
U[] res = () @trusted {
- auto arr = cast(U*) _d_newarrayU(typeid(T[]), a.length);
+ auto arr = cast(U*) _d_newarrayU!T(a.length, is(T == shared));
size_t i;
scope (failure)
{
diff --git a/libphobos/libdruntime/core/internal/array/utils.d b/libphobos/libdruntime/core/internal/array/utils.d
index 57eb14b..89ce6ca 100644
--- a/libphobos/libdruntime/core/internal/array/utils.d
+++ b/libphobos/libdruntime/core/internal/array/utils.d
@@ -33,7 +33,6 @@ private
auto gcStatsPure() nothrow pure
{
import core.memory : GC;
-
auto impureBypass = cast(GC.Stats function() pure nothrow)&GC.stats;
return impureBypass();
}
diff --git a/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d b/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d
index ca4577f..73fe087 100644
--- a/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d
+++ b/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d
@@ -2283,7 +2283,7 @@ struct Gcx
alias toscan = scanStack!precise;
debug(MARK_PRINTF)
- printf("marking range: [%p..%p] (%#llx)\n", pbot, ptop, cast(long)(ptop - pbot));
+ printf("marking range: [%p..%p] (%#llx)\n", rng.pbot, rng.ptop, cast(long)(rng.ptop - rng.pbot));
// limit the amount of ranges added to the toscan stack
enum FANOUT_LIMIT = 32;
@@ -2351,7 +2351,7 @@ struct Gcx
size_t bin = pool.pagetable[pn]; // not Bins to avoid multiple size extension instructions
debug(MARK_PRINTF)
- printf("\t\tfound pool %p, base=%p, pn = %lld, bin = %d\n", pool, pool.baseAddr, cast(long)pn, bin);
+ printf("\t\tfound pool %p, base=%p, pn = %llu, bin = %llu\n", pool, pool.baseAddr, cast(ulong)pn, cast(ulong)bin);
// Adjust bit to be at start of allocated memory block
if (bin < Bins.B_PAGE)
diff --git a/libphobos/libdruntime/core/interpolation.d b/libphobos/libdruntime/core/interpolation.d
new file mode 100644
index 0000000..0d45fe7
--- /dev/null
+++ b/libphobos/libdruntime/core/interpolation.d
@@ -0,0 +1,156 @@
+/++
+ This module provides definitions to support D's
+ interpolated expression sequence literal, sometimes
+ called string interpolation.
+
+
+ ---
+ string str;
+ int num;
+ // the compiler uses this module to implement the
+ // i"..." literal used here.
+ auto a = i"$​(str) has $​(num) items.";
+ ---
+
+ The variable `a` is a sequence of expressions:
+
+ ---
+ a[0] == InterpolationHeader()
+ a[$-1] == InterpolationFooter()
+ ---
+
+ First and last, you see the header and footer, to
+ clearly indicate where interpolation begins and ends.
+ Note that there may be nested interpolated sequences too,
+ each with their own header and footer. Think of them
+ as a set of balanced parenthesis around the contents.
+
+ Inside, you will find three general categories of
+ content: `InterpolatedLiteral!"string"` for string
+ expressions, `InterpolatedExpression!"code"` for code
+ expressions, and then the values themselves as their
+ own type.
+
+ In the example:
+ ---
+ auto a = i"$​(str) has $​(num) items.";
+ ---
+
+ We will find:
+ ---
+ a[0] == InterpolationHeader()
+ a[1] == InterpolatedExpression!"str"
+ a[2] == str
+ a[3] == InterpolatedLiteral!" has ";
+ a[4] == InterpolatedExpression!"num";
+ a[5] == num
+ a[6] == InterpolatedLiteral!" items.";
+ a[7] == InterpolationFooter()
+ a.length == 8;
+ ---
+
+ You can see the correspondence with the original
+ input: when you write `$​(expression)`, the string of the
+ expression is passed as `InterpolatedExpression!ThatString`,
+ (excluding any parenthesis around the expression),
+ and everything else is passed as `InterpolatedLiteral!str`,
+ in the same sequence as they appeared in the source.
+
+ After an `InterpolatedExpression!...`, you will find the
+ actual value(s) in the tuple. (If the expression expanded
+ to multiple values - for example, if it was itself a tuple,
+ there will be multiple values for a single expression.)
+
+ Library functions should NOT attempt to mixin the code
+ from an `InterpolatedExpression` themselves. Doing so
+ will fail, since it is coming from a different scope anyway.
+ The string is provided to you only for informational purposes
+ and as a sentinel to separate things the user wrote.
+
+ Your code should be able to handle an empty code string
+ in `InterpolatedExpression` or even an entirely missing
+ `InterpolatedExpression`, in case an implementation decides to
+ not emit these.
+
+ The `toString` members on these return `null`, except for
+ the `InterpolatedLiteral`, which returns the literal string.
+ This is to ease processing by generic functions like
+ `std.stdio.write` or `std.conv.text`, making them effectively
+ transparently skipped.
+
+ To extract the string from an `InterpolatedLiteral`, you can
+ use an `is` expression or the `.toString` method.
+
+ To extract the string from a `InterpolatedExpression`, you can
+ use an `is` expression or the `.expression` member.
+
+ None of these structures have runtime state.
+
+ History:
+ Added in dmd 2.10x frontend, released in late 2023.
++/
+module core.interpolation;
+
+/++
+ Sentinel values to indicate the beginning and end of an
+ interpolated expression sequence.
+
+ Note that these can nest, so while processing a sequence,
+ it may be helpful to keep a nesting count if that knowledge
+ is important to your application.
++/
+struct InterpolationHeader {
+ /++
+ Returns `null` for easy compatibility with existing functions
+ like `std.stdio.writeln` and `std.conv.text`.
+ +/
+ string toString() const @nogc pure nothrow @safe {
+ return null;
+ }
+}
+
+/// ditto
+struct InterpolationFooter {
+ /++
+ Returns `null` for easy compatibility with existing functions
+ like `std.stdio.writeln` and `std.conv.text`.
+ +/
+ string toString() const @nogc pure nothrow @safe {
+ return null;
+ }
+}
+
+/++
+ Represents a fragment of a string literal in between expressions
+ passed as part of an interpolated expression sequence.
++/
+struct InterpolatedLiteral(string text) {
+ /++
+ Returns the text of the interpolated string literal for this
+ segment of the tuple, for easy access and compatibility with
+ existing functions like `std.stdio.writeln` and `std.conv.text`.
+ +/
+ string toString() const @nogc pure nothrow @safe {
+ return text;
+ }
+}
+
+/++
+ Represents the source code of an expression passed as part of an
+ interpolated expression sequence.
++/
+struct InterpolatedExpression(string text) {
+ /++
+ Returns the text of an interpolated expression used in the
+ original literal, if provided by the implementation.
+ +/
+ enum expression = text;
+
+ /++
+ Returns `null` for easy compatibility with existing functions
+ like `std.stdio.writeln` and `std.conv.text`.
+ +/
+ string toString() const @nogc pure nothrow @safe {
+ return null;
+ }
+}
diff --git a/libphobos/libdruntime/core/lifetime.d b/libphobos/libdruntime/core/lifetime.d
index 6b083ea..9e563ad 100644
--- a/libphobos/libdruntime/core/lifetime.d
+++ b/libphobos/libdruntime/core/lifetime.d
@@ -3009,5 +3009,5 @@ version (D_ProfileGC)
template TypeInfoSize(T)
{
import core.internal.traits : hasElaborateDestructor;
- enum TypeInfoSize = hasElaborateDestructor!T ? size_t.sizeof : 0;
+ enum TypeInfoSize = (is (T == struct) && hasElaborateDestructor!T) ? size_t.sizeof : 0;
}
diff --git a/libphobos/libdruntime/core/stdc/string.d b/libphobos/libdruntime/core/stdc/string.d
index b9e3bb7..3e906b1 100644
--- a/libphobos/libdruntime/core/stdc/string.d
+++ b/libphobos/libdruntime/core/stdc/string.d
@@ -64,6 +64,8 @@ size_t strcspn(scope const char* s1, scope const char* s2) pure;
///
char* strdup(scope const char *s);
///
+char* strndup(scope const char *str, size_t size);
+///
char* strerror(int errnum);
// This `strerror_r` definition is not following the POSIX standard
version (ReturnStrerrorR)
diff --git a/libphobos/libdruntime/core/sys/posix/string.d b/libphobos/libdruntime/core/sys/posix/string.d
index 8c4ea38..b2d6ea7 100644
--- a/libphobos/libdruntime/core/sys/posix/string.d
+++ b/libphobos/libdruntime/core/sys/posix/string.d
@@ -39,8 +39,6 @@ char* stpncpy(return scope char* dst, const char* src, size_t len) pure;
int strcoll_l(scope const char* s1, scope const char* s2, locale_t locale);
///
char* strerror_l(int, locale_t);
-/// Save a copy of a string
-char* strndup(scope const char* str, size_t len);
/// Find length of string up to `maxlen`
size_t strnlen(scope const char* str, size_t maxlen) pure;
/// System signal messages
diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d
index 9ddc187..9390243 100644
--- a/libphobos/libdruntime/core/thread/osthread.d
+++ b/libphobos/libdruntime/core/thread/osthread.d
@@ -493,9 +493,8 @@ class Thread : ThreadBase
slock.lock_nothrow();
scope(exit) slock.unlock_nothrow();
{
- ++nAboutToStart;
- pAboutToStart = cast(ThreadBase*)realloc(pAboutToStart, Thread.sizeof * nAboutToStart);
- pAboutToStart[nAboutToStart - 1] = this;
+ incrementAboutToStart(this);
+
version (Windows)
{
if ( ResumeThread( m_hndl ) == -1 )
diff --git a/libphobos/libdruntime/core/thread/threadbase.d b/libphobos/libdruntime/core/thread/threadbase.d
index 909bffc..84f9203 100644
--- a/libphobos/libdruntime/core/thread/threadbase.d
+++ b/libphobos/libdruntime/core/thread/threadbase.d
@@ -588,8 +588,8 @@ package(core.thread):
__gshared size_t sm_tlen;
// can't use core.internal.util.array in public code
- __gshared ThreadBase* pAboutToStart;
- __gshared size_t nAboutToStart;
+ private __gshared ThreadBase* pAboutToStart;
+ private __gshared size_t nAboutToStart;
//
// Used for ordering threads in the global thread list.
@@ -658,6 +658,12 @@ package(core.thread):
// Global Thread List Operations
///////////////////////////////////////////////////////////////////////////
+ package static void incrementAboutToStart(ThreadBase t) nothrow @nogc
+ {
+ ++nAboutToStart;
+ pAboutToStart = cast(ThreadBase*)realloc(pAboutToStart, ThreadBase.sizeof * nAboutToStart);
+ pAboutToStart[nAboutToStart - 1] = t;
+ }
//
// Add a thread to the global thread list.
diff --git a/libphobos/libdruntime/object.d b/libphobos/libdruntime/object.d
index 710f4cc..4264ecf 100644
--- a/libphobos/libdruntime/object.d
+++ b/libphobos/libdruntime/object.d
@@ -65,7 +65,7 @@ alias ptrdiff_t = typeof(cast(void*)0 - cast(void*)0);
alias sizediff_t = ptrdiff_t; // For backwards compatibility only.
/**
* Bottom type.
- * See $(DDSUBLINK spec/type, noreturn).
+ * See $(DDSUBLINK spec/type, noreturn, `noreturn`).
*/
alias noreturn = typeof(*null);
@@ -1667,11 +1667,12 @@ class TypeInfo_Class : TypeInfo
void* deallocator;
OffsetTypeInfo[] m_offTi;
void function(Object) defaultConstructor; // default Constructor
- ulong[2] nameSig; /// unique signature for `name`
immutable(void)* m_RTInfo; // data for precise GC
override @property immutable(void)* rtInfo() const { return m_RTInfo; }
+ uint[4] nameSig; /// unique signature for `name`
+
/**
* Search all modules for TypeInfo_Class corresponding to classname.
* Returns: null if not found
diff --git a/libphobos/libdruntime/rt/cast_.d b/libphobos/libdruntime/rt/cast_.d
index 44e0f7a..43ddd5a 100644
--- a/libphobos/libdruntime/rt/cast_.d
+++ b/libphobos/libdruntime/rt/cast_.d
@@ -24,11 +24,18 @@ pure:
extern (D) private bool areClassInfosEqual(scope const ClassInfo a, scope const ClassInfo b) @safe
{
// same class if signatures match, works with potential duplicates across binaries
- return a is b ||
- (a.m_flags & TypeInfo_Class.ClassFlags.hasNameSig
- ? (a.nameSig[0] == b.nameSig[0] &&
- a.nameSig[1] == b.nameSig[1]) // new fast way
- : (a is b || a.name == b.name)); // old slow way for temporary binary compatibility
+ if (a is b)
+ return true;
+
+ // new fast way
+ if (a.m_flags & TypeInfo_Class.ClassFlags.hasNameSig)
+ return a.nameSig[0] == b.nameSig[0]
+ && a.nameSig[1] == b.nameSig[1]
+ && a.nameSig[2] == b.nameSig[2]
+ && a.nameSig[3] == b.nameSig[3];
+
+ // old slow way for temporary binary compatibility
+ return a.name == b.name;
}
/******************************************