aboutsummaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2023-10-15 19:09:05 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2023-10-16 19:14:10 +0200
commit964fd402c9b48eb4da91fb3e4e45d4560d6c676c (patch)
treea34980fffb3f1e8e7347b727a6d7243cc0ad7320 /libphobos
parentc7609acb8a8210188d21b2cd72ecc6d3b2de2ab8 (diff)
downloadgcc-964fd402c9b48eb4da91fb3e4e45d4560d6c676c.zip
gcc-964fd402c9b48eb4da91fb3e4e45d4560d6c676c.tar.gz
gcc-964fd402c9b48eb4da91fb3e4e45d4560d6c676c.tar.bz2
d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
D front-end changes: - Import latest fixes to mainline. D runtime changes: - Import latest fixes to mainline. Phobos changes: - Import latest fixes to mainline. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 4c18eed967. * d-diagnostic.cc (verrorReport): Update for new front-end interface. (verrorReportSupplemental): Likewise. * d-lang.cc (d_init_options): Likewise. (d_handle_option): Likewise. (d_post_options): Likewise. (d_parse_file): Likewise. * decl.cc (get_symbol_decl): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 4c18eed967. * src/MERGE: Merge upstream phobos d945686a4.
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/core/stdc/errno.d103
-rw-r--r--libphobos/libdruntime/core/stdc/fenv.d31
-rw-r--r--libphobos/libdruntime/core/stdc/math.d7
-rw-r--r--libphobos/libdruntime/core/sys/linux/dlfcn.d14
-rw-r--r--libphobos/libdruntime/core/sys/linux/epoll.d8
-rw-r--r--libphobos/libdruntime/core/sys/linux/link.d6
-rw-r--r--libphobos/libdruntime/core/sys/linux/perf_event.d4
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/eventfd.d6
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/inotify.d5
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/mman.d24
-rw-r--r--libphobos/libdruntime/core/sys/posix/dlfcn.d12
-rw-r--r--libphobos/libdruntime/core/sys/posix/fcntl.d35
-rw-r--r--libphobos/libdruntime/core/sys/posix/setjmp.d15
-rw-r--r--libphobos/libdruntime/core/sys/posix/signal.d34
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/mman.d2
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/msg.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/socket.d34
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/stat.d60
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/types.d12
-rw-r--r--libphobos/libdruntime/core/sys/posix/ucontext.d27
-rw-r--r--libphobos/libdruntime/core/thread/fiber.d26
-rw-r--r--libphobos/src/MERGE2
-rw-r--r--libphobos/src/std/algorithm/iteration.d6
-rw-r--r--libphobos/src/std/range/primitives.d24
25 files changed, 490 insertions, 10 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index d5dfe0d..7946002 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-f9efc98fd7954741333f72c6a50af273f3863a1a
+4c18eed9674e04c1ca89fbc8bd5c4e483eb5477c
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/core/stdc/errno.d b/libphobos/libdruntime/core/stdc/errno.d
index c992a5f..e503dd9 100644
--- a/libphobos/libdruntime/core/stdc/errno.d
+++ b/libphobos/libdruntime/core/stdc/errno.d
@@ -1117,6 +1117,109 @@ else version (linux)
enum ERFKILL = 132; ///
enum EHWPOISON = 133; ///
}
+ else version (LoongArch64)
+ {
+ enum EDEADLK = 35; ///
+ enum ENAMETOOLONG = 36; ///
+ enum ENOLCK = 37; ///
+ enum ENOSYS = 38; ///
+ enum ENOTEMPTY = 39; ///
+ enum ELOOP = 40; ///
+ enum EWOULDBLOCK = EAGAIN; ///
+ enum ENOMSG = 42; ///
+ enum EIDRM = 43; ///
+ enum ECHRNG = 44; ///
+ enum EL2NSYNC = 45; ///
+ enum EL3HLT = 46; ///
+ enum EL3RST = 47; ///
+ enum ELNRNG = 48; ///
+ enum EUNATCH = 49; ///
+ enum ENOCSI = 50; ///
+ enum EL2HLT = 51; ///
+ enum EBADE = 52; ///
+ enum EBADR = 53; ///
+ enum EXFULL = 54; ///
+ enum ENOANO = 55; ///
+ enum EBADRQC = 56; ///
+ enum EBADSLT = 57; ///
+ enum EDEADLOCK = EDEADLK; ///
+ enum EBFONT = 59; ///
+ enum ENOSTR = 60; ///
+ enum ENODATA = 61; ///
+ enum ETIME = 62; ///
+ enum ENOSR = 63; ///
+ enum ENONET = 64; ///
+ enum ENOPKG = 65; ///
+ enum EREMOTE = 66; ///
+ enum ENOLINK = 67; ///
+ enum EADV = 68; ///
+ enum ESRMNT = 69; ///
+ enum ECOMM = 70; ///
+ enum EPROTO = 71; ///
+ enum EMULTIHOP = 72; ///
+ enum EDOTDOT = 73; ///
+ enum EBADMSG = 74; ///
+ enum EOVERFLOW = 75; ///
+ enum ENOTUNIQ = 76; ///
+ enum EBADFD = 77; ///
+ enum EREMCHG = 78; ///
+ enum ELIBACC = 79; ///
+ enum ELIBBAD = 80; ///
+ enum ELIBSCN = 81; ///
+ enum ELIBMAX = 82; ///
+ enum ELIBEXEC = 83; ///
+ enum EILSEQ = 84; ///
+ enum ERESTART = 85; ///
+ enum ESTRPIPE = 86; ///
+ enum EUSERS = 87; ///
+ enum ENOTSOCK = 88; ///
+ enum EDESTADDRREQ = 89; ///
+ enum EMSGSIZE = 90; ///
+ enum EPROTOTYPE = 91; ///
+ enum ENOPROTOOPT = 92; ///
+ enum EPROTONOSUPPORT = 93; ///
+ enum ESOCKTNOSUPPORT = 94; ///
+ enum EOPNOTSUPP = 95; ///
+ enum ENOTSUP = EOPNOTSUPP; ///
+ enum EPFNOSUPPORT = 96; ///
+ enum EAFNOSUPPORT = 97; ///
+ enum EADDRINUSE = 98; ///
+ enum EADDRNOTAVAIL = 99; ///
+ enum ENETDOWN = 100; ///
+ enum ENETUNREACH = 101; ///
+ enum ENETRESET = 102; ///
+ enum ECONNABORTED = 103; ///
+ enum ECONNRESET = 104; ///
+ enum ENOBUFS = 105; ///
+ enum EISCONN = 106; ///
+ enum ENOTCONN = 107; ///
+ enum ESHUTDOWN = 108; ///
+ enum ETOOMANYREFS = 109; ///
+ enum ETIMEDOUT = 110; ///
+ enum ECONNREFUSED = 111; ///
+ enum EHOSTDOWN = 112; ///
+ enum EHOSTUNREACH = 113; ///
+ enum EALREADY = 114; ///
+ enum EINPROGRESS = 115; ///
+ enum ESTALE = 116; ///
+ enum EUCLEAN = 117; ///
+ enum ENOTNAM = 118; ///
+ enum ENAVAIL = 119; ///
+ enum EISNAM = 120; ///
+ enum EREMOTEIO = 121; ///
+ enum EDQUOT = 122; ///
+ enum ENOMEDIUM = 123; ///
+ enum EMEDIUMTYPE = 124; ///
+ enum ECANCELED = 125; ///
+ enum ENOKEY = 126; ///
+ enum EKEYEXPIRED = 127; ///
+ enum EKEYREVOKED = 128; ///
+ enum EKEYREJECTED = 129; ///
+ enum EOWNERDEAD = 130; ///
+ enum ENOTRECOVERABLE = 131; ///
+ enum ERFKILL = 132; ///
+ enum EHWPOISON = 133; ///
+ }
else
{
static assert(false, "Architecture not supported.");
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index dbe7daa..288f9c2 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -166,6 +166,15 @@ version (GNUFP)
alias fexcept_t = uint;
}
+ else version (LoongArch64)
+ {
+ struct fenv_t
+ {
+ uint __fp_control_register;
+ }
+
+ alias fexcept_t = uint;
+ }
else
{
static assert(0, "Unimplemented architecture");
@@ -786,6 +795,28 @@ else
FE_TOWARDZERO = 0x1, ///
}
}
+ else version (LoongArch64)
+ {
+ // Define bits representing exceptions in the FPSR status word.
+ enum
+ {
+ FE_INEXACT = 0x010000, ///
+ FE_UNDERFLOW = 0x020000, ///
+ FE_OVERFLOW = 0x040000, ///
+ FE_DIVBYZERO = 0x080000, ///
+ FE_INVALID = 0x100000, ///
+ FE_ALL_EXCEPT = 0x1f0000, ///
+ }
+
+ // Define bits representing rounding modes in the FPCR Rmode field.
+ enum
+ {
+ FE_TONEAREST = 0x000, ///
+ FE_TOWARDZERO = 0x100, ///
+ FE_DOWNWARD = 0x200, ///
+ FE_UPWARD = 0x300, ///
+ }
+ }
else
{
static assert(0, "Unimplemented architecture");
diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index 76b32b4..c5eaf79 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -190,6 +190,13 @@ else version (CRuntime_Glibc)
///
enum int FP_ILOGBNAN = int.max;
}
+ else version (LoongArch64)
+ {
+ ///
+ enum int FP_ILOGB0 = -int.max;
+ ///
+ enum int FP_ILOGBNAN = int.max;
+ }
else
{
static assert(false, "Architecture not supported.");
diff --git a/libphobos/libdruntime/core/sys/linux/dlfcn.d b/libphobos/libdruntime/core/sys/linux/dlfcn.d
index a13bae7..9d86d89 100644
--- a/libphobos/libdruntime/core/sys/linux/dlfcn.d
+++ b/libphobos/libdruntime/core/sys/linux/dlfcn.d
@@ -142,6 +142,20 @@ else version (IBMZ_Any)
void _dl_mcount_wrapper_check(void* __selfpc);
}
}
+else version (LoongArch64)
+{
+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
+ static if (_GNU_SOURCE)
+ {
+ RT DL_CALL_FCT(RT, Args...)(RT function(Args) fctp, auto ref Args args)
+ {
+ _dl_mcount_wrapper_check(cast(void*)fctp);
+ return fctp(args);
+ }
+
+ void _dl_mcount_wrapper_check(void* __selfpc);
+ }
+}
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/linux/epoll.d b/libphobos/libdruntime/core/sys/linux/epoll.d
index 99099b5..55b4f5e 100644
--- a/libphobos/libdruntime/core/sys/linux/epoll.d
+++ b/libphobos/libdruntime/core/sys/linux/epoll.d
@@ -132,6 +132,14 @@ else version (IBMZ_Any)
epoll_data_t data;
}
}
+else version (LoongArch64)
+{
+ struct epoll_event
+ {
+ uint events;
+ epoll_data_t data;
+ }
+}
else
{
static assert(false, "Platform not supported");
diff --git a/libphobos/libdruntime/core/sys/linux/link.d b/libphobos/libdruntime/core/sys/linux/link.d
index 4d7eb1e..ebb5771 100644
--- a/libphobos/libdruntime/core/sys/linux/link.d
+++ b/libphobos/libdruntime/core/sys/linux/link.d
@@ -90,6 +90,12 @@ else version (IBMZ_Any)
else
alias uint32_t Elf_Symndx;
}
+else version (LoongArch64)
+{
+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
+ alias __WORDSIZE __ELF_NATIVE_CLASS;
+ alias uint32_t Elf_Symndx;
+}
else
static assert(0, "unimplemented");
// <bits/elfclass.h>
diff --git a/libphobos/libdruntime/core/sys/linux/perf_event.d b/libphobos/libdruntime/core/sys/linux/perf_event.d
index b9993a7..e0a0c99 100644
--- a/libphobos/libdruntime/core/sys/linux/perf_event.d
+++ b/libphobos/libdruntime/core/sys/linux/perf_event.d
@@ -76,6 +76,10 @@ else version (SPARC_Any)
{
enum __NR_perf_event_open = 327;
}
+else version (LoongArch64)
+{
+ enum __NR_perf_event_open = 241;
+}
else
{
static assert(0, "Architecture not supported");
diff --git a/libphobos/libdruntime/core/sys/linux/sys/eventfd.d b/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
index a35d714..bb2d137 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/eventfd.d
@@ -111,5 +111,11 @@ else version (IBMZ_Any)
enum EFD_CLOEXEC = 0x80000; // octal!2000000
enum EFD_NONBLOCK = 0x800; // octal!4000
}
+else version (LoongArch64)
+{
+ enum EFD_SEMAPHORE = 1;
+ enum EFD_CLOEXEC = 0x80000; // octal!2000000
+ enum EFD_NONBLOCK = 0x800; // octal!4000
+}
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/linux/sys/inotify.d b/libphobos/libdruntime/core/sys/linux/sys/inotify.d
index c74aaa6..727471e 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/inotify.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/inotify.d
@@ -123,6 +123,11 @@ else version (IBMZ_Any)
enum IN_CLOEXEC = 0x80000; // octal!2000000
enum IN_NONBLOCK = 0x800; // octal!4000
}
+else version (LoongArch64)
+{
+ enum IN_CLOEXEC = 0x80000; // octal!2000000
+ enum IN_NONBLOCK = 0x800; // octal!4000
+}
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/linux/sys/mman.d b/libphobos/libdruntime/core/sys/linux/sys/mman.d
index 43a1aec..7ed78ef 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/mman.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/mman.d
@@ -432,6 +432,30 @@ else version (MIPS_Any)
MAP_HUGETLB = 0x80000,
}
}
+else version (LoongArch64)
+{
+ static if (_DEFAULT_SOURCE) enum
+ {
+ MAP_GROWSDOWN = 0x00100,
+ MAP_DENYWRITE = 0x00800,
+ MAP_EXECUTABLE = 0x01000,
+ MAP_LOCKED = 0x02000,
+ MAP_NORESERVE = 0x04000,
+ MAP_POPULATE = 0x08000,
+ MAP_NONBLOCK = 0x10000,
+ MAP_STACK = 0x20000,
+ MAP_HUGETLB = 0x40000,
+ MAP_SYNC = 0x80000,
+ MAP_FIXED_NOREPLACE = 0x100000,
+ }
+
+ // in core.sys.posix.sys.mman
+ // enum
+ // {
+ // MCL_CURRENT = 0x1,
+ // MCL_FUTURE = 0x2,
+ // }
+}
else
{
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/posix/dlfcn.d b/libphobos/libdruntime/core/sys/posix/dlfcn.d
index f4bd2d8..f457c1f 100644
--- a/libphobos/libdruntime/core/sys/posix/dlfcn.d
+++ b/libphobos/libdruntime/core/sys/posix/dlfcn.d
@@ -160,6 +160,18 @@ version (CRuntime_Glibc)
enum RTLD_LOCAL = 0;
enum RTLD_NODELETE = 0x01000;
}
+ else version (LoongArch64)
+ {
+ // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/dlfcn.h
+ enum RTLD_LAZY = 0x00001;
+ enum RTLD_NOW = 0x00002;
+ enum RTLD_BINDING_MASK = 0x3;
+ enum RTLD_NOLOAD = 0x00004;
+ enum RTLD_DEEPBIND = 0x00008;
+ enum RTLD_GLOBAL = 0x00100;
+ enum RTLD_LOCAL = 0;
+ enum RTLD_NODELETE = 0x01000;
+ }
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
index df66b27..c0e9006a0 100644
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d
@@ -156,7 +156,13 @@ version (linux)
enum F_SETLKW = 7;
}
}
- else
+ else version (LoongArch64)
+ {
+ static assert(off_t.sizeof == 8);
+ enum F_GETLK = 5;
+ enum F_SETLK = 6;
+ enum F_SETLKW = 7;
+ } else
static if ( __USE_FILE_OFFSET64 )
{
enum F_GETLK = 12;
@@ -391,6 +397,33 @@ version (linux)
enum O_PATH = 0x200000; // octal 010000000
enum O_NDELAY = O_NONBLOCK;
}
+ else version (LoongArch64)
+ {
+ enum O_CREAT = 0x40; // octal 0100
+ enum O_EXCL = 0x80; // octal 0200
+ enum O_NOCTTY = 0x100; // octal 0400
+ enum O_TRUNC = 0x200; // octal 01000
+
+ enum O_APPEND = 0x400; // octal 02000
+ enum O_NONBLOCK = 0x800; // octal 04000
+ enum O_CLOEXEC = 0x80000; // octal 02000000
+ enum O_SYNC = 0x101000; // octal 04010000
+ enum O_DSYNC = 0x1000; // octal 010000
+ enum O_RSYNC = O_SYNC;
+
+ enum O_DIRECTORY = 0x010000; // octal 200000
+ enum O_NOFOLLOW = 0x020000; // octal 400000
+ enum O_DIRECT = 0x004000; // octal 040000
+ version (D_LP64)
+ enum O_LARGEFILE = 0;
+ else
+ enum O_LARGEFILE = 0x8000; // octal 0100000
+ enum O_TMPFILE = 0x404000; // octal 020040000
+ enum O_ASYNC = 0x2000; // octal 020000
+ enum O_NOATIME = 0x40000; // octal 01000000
+ enum O_PATH = 0x200000; // octal 010000000
+ enum O_NDELAY = O_NONBLOCK;
+ }
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/posix/setjmp.d b/libphobos/libdruntime/core/sys/posix/setjmp.d
index 0d43c61..cd378ce 100644
--- a/libphobos/libdruntime/core/sys/posix/setjmp.d
+++ b/libphobos/libdruntime/core/sys/posix/setjmp.d
@@ -174,6 +174,21 @@ version (CRuntime_Glibc)
}
alias __jmp_buf = __s390_jmp_buf[1];
}
+ else version (LoongArch64)
+ {
+ struct __loongarch_jmp_buf
+ {
+ long __pc;
+ long __sp;
+ // reserved
+ long __r21;
+ long __fp;
+ long[9] __regs;
+ static if (__traits(getTargetInfo, "floatAbi") != "soft_float")
+ double[8] __fpregs;
+ }
+ alias __jmp_buf = __loongarch_jmp_buf[1];
+ }
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index a2e229f..a8b7f75 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -390,6 +390,30 @@ version (linux)
enum SIGUSR2 = 12;
enum SIGURG = 23;
}
+ else version (LoongArch64)
+ {
+ //SIGABRT (defined in core.stdc.signal)
+ enum SIGALRM = 14;
+ enum SIGBUS = 7;
+ enum SIGCHLD = 17;
+ enum SIGCONT = 18;
+ //SIGFPE (defined in core.stdc.signal)
+ enum SIGHUP = 1;
+ //SIGILL (defined in core.stdc.signal)
+ //SIGINT (defined in core.stdc.signal)
+ enum SIGKILL = 9;
+ enum SIGPIPE = 13;
+ enum SIGQUIT = 3;
+ //SIGSEGV (defined in core.stdc.signal)
+ enum SIGSTOP = 19;
+ //SIGTERM (defined in core.stdc.signal)
+ enum SIGTSTP = 20;
+ enum SIGTTIN = 21;
+ enum SIGTTOU = 22;
+ enum SIGUSR1 = 10;
+ enum SIGUSR2 = 12;
+ enum SIGURG = 23;
+ }
else
static assert(0, "unimplemented");
}
@@ -1750,6 +1774,16 @@ version (linux)
enum SIGXCPU = 24;
enum SIGXFSZ = 25;
}
+ else version (LoongArch64)
+ {
+ enum SIGPOLL = 29;
+ enum SIGPROF = 27;
+ enum SIGSYS = 31;
+ enum SIGTRAP = 5;
+ enum SIGVTALRM = 26;
+ enum SIGXCPU = 24;
+ enum SIGXFSZ = 25;
+ }
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/posix/sys/mman.d b/libphobos/libdruntime/core/sys/posix/sys/mman.d
index 0d3d517..b1eb9fa 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/mman.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/mman.d
@@ -382,6 +382,8 @@ version (linux)
private enum DEFAULTS = true;
else version (PPC_Any)
private enum DEFAULTS = true;
+ else version (LoongArch64)
+ private enum DEFAULTS = true;
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/posix/sys/msg.d b/libphobos/libdruntime/core/sys/posix/sys/msg.d
index 208e5c2..19e07bd 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/msg.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/msg.d
@@ -56,6 +56,7 @@ version (linux)
version (IA64) version = GENERICMSQ;
version (IBMZ_Any) version = GENERICMSQ;
version (RISCV_Any) version = GENERICMSQ;
+ version (LoongArch64) version = GENERICMSQ;
version (GENERICMSQ)
{
diff --git a/libphobos/libdruntime/core/sys/posix/sys/socket.d b/libphobos/libdruntime/core/sys/posix/sys/socket.d
index 340f3ce..7c6fab6 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/socket.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/socket.d
@@ -528,6 +528,40 @@ version (linux)
SO_TYPE = 3
}
}
+ else version (LoongArch64)
+ {
+ enum
+ {
+ SOCK_DGRAM = 2,
+ SOCK_SEQPACKET = 5,
+ SOCK_STREAM = 1
+ }
+
+ enum
+ {
+ SOL_SOCKET = 1
+ }
+
+ enum
+ {
+ SO_ACCEPTCONN = 30,
+ SO_BROADCAST = 6,
+ SO_DEBUG = 1,
+ SO_DONTROUTE = 5,
+ SO_ERROR = 4,
+ SO_KEEPALIVE = 9,
+ SO_LINGER = 13,
+ SO_OOBINLINE = 10,
+ SO_RCVBUF = 8,
+ SO_RCVLOWAT = 18,
+ SO_RCVTIMEO = 20,
+ SO_REUSEADDR = 2,
+ SO_SNDBUF = 7,
+ SO_SNDLOWAT = 19,
+ SO_SNDTIMEO = 21,
+ SO_TYPE = 3
+ }
+ }
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d
index ee9e5da..b89478f 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/stat.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d
@@ -966,6 +966,66 @@ version (linux)
else
static assert(stat_t.sizeof == 144);
}
+ else version (LoongArch64)
+ {
+ private
+ {
+ alias __dev_t = ulong;
+ alias __ino_t = c_ulong;
+ alias __ino64_t = ulong;
+ alias __mode_t = uint;
+ alias __nlink_t = uint;
+ alias __uid_t = uint;
+ alias __gid_t = uint;
+ alias __off_t = c_long;
+ alias __off64_t = long;
+ alias __blksize_t = int;
+ alias __blkcnt_t = c_long;
+ alias __blkcnt64_t = long;
+ alias __timespec = timespec;
+ alias __time_t = time_t;
+ }
+ struct stat_t
+ {
+ __dev_t st_dev;
+ __ino_t st_ino;
+ __mode_t st_mode;
+ __nlink_t st_nlink;
+ __uid_t st_uid;
+ __gid_t st_gid;
+ __dev_t st_rdev;
+ __dev_t __pad1;
+ // la64 always uses 64-bit file offsets
+ __off64_t st_size;
+ __blksize_t st_blksize;
+ int __pad2;
+ // la64 always uses 64-bit block counts
+ __blkcnt64_t st_blocks;
+ static if (_XOPEN_SOURCE >= 700)
+ {
+ __timespec st_atim;
+ __timespec st_mtim;
+ __timespec st_ctim;
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ else
+ {
+ __time_t st_atime;
+ c_ulong st_atimensec;
+ __time_t st_mtime;
+ c_ulong st_mtimensec;
+ __time_t st_ctime;
+ c_ulong st_ctimensec;
+ }
+ int[2] __glibc_reserved;
+ }
+ static assert(stat_t.sizeof == 128);
+ }
else
static assert(0, "unimplemented");
diff --git a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d
index cd11b0d..f0ce29f 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/types.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/types.d
@@ -620,6 +620,18 @@ version (CRuntime_Glibc)
enum __SIZEOF_PTHREAD_BARRIER_T = 32;
enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4;
}
+ else version (LoongArch64)
+ {
+ enum __SIZEOF_PTHREAD_ATTR_T = 56;
+ enum __SIZEOF_PTHREAD_MUTEX_T = 40;
+ enum __SIZEOF_PTHREAD_MUTEXATTR_T = 4;
+ enum __SIZEOF_PTHREAD_COND_T = 48;
+ enum __SIZEOF_PTHREAD_CONDATTR_T = 4;
+ enum __SIZEOF_PTHREAD_RWLOCK_T = 56;
+ enum __SIZEOF_PTHREAD_RWLOCKATTR_T = 8;
+ enum __SIZEOF_PTHREAD_BARRIER_T = 32;
+ enum __SIZEOF_PTHREAD_BARRIERATTR_T = 4;
+ }
else
{
static assert (false, "Unsupported platform");
diff --git a/libphobos/libdruntime/core/sys/posix/ucontext.d b/libphobos/libdruntime/core/sys/posix/ucontext.d
index 512d730..ce21663 100644
--- a/libphobos/libdruntime/core/sys/posix/ucontext.d
+++ b/libphobos/libdruntime/core/sys/posix/ucontext.d
@@ -785,6 +785,33 @@ version (linux)
alias ucontext_t = ucontext;
}
+ else version (LoongArch64)
+ {
+ private
+ {
+ enum LARCH_NGREG = 32;
+
+ alias ulong greg_t;
+ alias greg_t[LARCH_NGREG] gregset_t;
+ }
+
+ struct mcontext_t
+ {
+ c_ulong __pc;
+ c_ulong[32] __gregs;
+ int __flags;
+ align(16) c_ulong[0] __extcontext;
+ }
+
+ struct ucontext_t
+ {
+ c_ulong __uc_flags;
+ ucontext_t* uc_link;
+ stack_t uc_stack;
+ sigset_t uc_sigmask;
+ mcontext_t uc_mcontext;
+ }
+ }
else
static assert(0, "unimplemented");
}
diff --git a/libphobos/libdruntime/core/thread/fiber.d b/libphobos/libdruntime/core/thread/fiber.d
index 66fb9da..65878bc 100644
--- a/libphobos/libdruntime/core/thread/fiber.d
+++ b/libphobos/libdruntime/core/thread/fiber.d
@@ -176,6 +176,11 @@ private
{
version = AlignFiberStackTo16Byte;
}
+ else version (LoongArch64)
+ {
+ version = AsmLoongArch64_Posix;
+ version = AsmExternal;
+ }
version (Posix)
{
@@ -1437,6 +1442,27 @@ private:
pstack -= ABOVE;
*cast(size_t*)(pstack - SZ_RA) = cast(size_t)&fiber_entryPoint;
}
+ else version (AsmLoongArch64_Posix)
+ {
+ version (StackGrowsDown) {}
+ else static assert(0);
+
+ // Like others, FP registers and return address (ra) are kept
+ // below the saved stack top (tstack) to hide from GC scanning.
+ // The newp stack should look like this on LoongArch64:
+ // 18: fp <- pstack
+ // ...
+ // 9: s0 <- newp tstack
+ // 8: ra [&fiber_entryPoint]
+ // 7: fs7
+ // ...
+ // 1: fs1
+ // 0: fs0
+ pstack -= 10 * size_t.sizeof; // skip s0-s8 and fp
+ // set $ra
+ push( cast(size_t) &fiber_entryPoint );
+ pstack += size_t.sizeof;
+ }
else version (AsmAArch64_Posix)
{
// Like others, FP registers and return address (lr) are kept
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index 455825b..9a97927 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-a3f22129dd2a134338ca02b79ff0de242d7f016e
+d945686a4ff7d9fda0e2ee8d2ee201b66be2a287
The first line of this file holds the git revision number of the last
merge done from the dlang/phobos repository.
diff --git a/libphobos/src/std/algorithm/iteration.d b/libphobos/src/std/algorithm/iteration.d
index 39927be..0adb88b 100644
--- a/libphobos/src/std/algorithm/iteration.d
+++ b/libphobos/src/std/algorithm/iteration.d
@@ -2975,9 +2975,9 @@ auto joiner(RoR, Separator)(RoR r, Separator sep)
static assert(isInputRange!(ElementType!RoR), "The ElementyType of RoR '"
, ElementType!(RoR).stringof, "' must be an InputRange "
, "(isInputRange!(ElementType!(", RoR.stringof , "))).");
- static assert(isForwardRange!Separator, "The type of the Seperator '"
- , Seperator.stringof, "' must be a ForwardRange (isForwardRange!("
- , Seperator.stringof, ")).");
+ static assert(isForwardRange!Separator, "The type of the Separator '"
+ , Separator.stringof, "' must be a ForwardRange (isForwardRange!("
+ , Separator.stringof, ")).");
static assert(is(ElementType!Separator : ElementType!(ElementType!RoR))
, "The type of the elements of the separator range does not match "
, "the type of the elements that are joined. Separator type '"
diff --git a/libphobos/src/std/range/primitives.d b/libphobos/src/std/range/primitives.d
index e581409..ef34a85 100644
--- a/libphobos/src/std/range/primitives.d
+++ b/libphobos/src/std/range/primitives.d
@@ -165,17 +165,21 @@ See_Also:
Params:
R = type to be tested
+ E = the type of the elements of the range if not `void`
Returns:
- `true` if R is an input range, `false` if not
+ `true` if R is an input range (possibly with element type `E`), `false` if not
*/
-enum bool isInputRange(R) =
+enum bool isInputRange(R, E = void) =
is(typeof(R.init) == R)
&& is(typeof((R r) { return r.empty; } (R.init)) == bool)
&& (is(typeof((return ref R r) => r.front)) || is(typeof(ref (return ref R r) => r.front)))
&& !is(typeof((R r) { return r.front; } (R.init)) == void)
- && is(typeof((R r) => r.popFront));
-
+ && is(typeof((R r) => r.popFront))
+ && (is(E == void) ||
+ is(ElementType!R == E) ||
+ is(const(ElementType!R) == E) ||
+ (is(const(ElementType!R) == immutable E) && is(const(E) == E)));
///
@safe unittest
{
@@ -192,6 +196,18 @@ enum bool isInputRange(R) =
static assert( isInputRange!(char[]));
static assert(!isInputRange!(char[4]));
static assert( isInputRange!(inout(int)[]));
+ static assert(!isInputRange!(int[], string));
+ static assert( isInputRange!(int[], int));
+ static assert( isInputRange!(int[], const int));
+ static assert(!isInputRange!(int[], immutable int));
+
+ static assert(!isInputRange!(const(int)[], int));
+ static assert( isInputRange!(const(int)[], const int));
+ static assert(!isInputRange!(const(int)[], immutable int));
+
+ static assert(!isInputRange!(immutable(int)[], int));
+ static assert( isInputRange!(immutable(int)[], const int));
+ static assert( isInputRange!(immutable(int)[], immutable int));
static struct NotDefaultConstructible
{