Merge remote-tracking branch 'upstream/stable' into merge_stable

This commit is contained in:
Petar Kirov 2021-11-09 10:30:28 +02:00
commit dfaaf8fa53
7 changed files with 52 additions and 95 deletions

View file

@ -2,7 +2,7 @@
set -uexo pipefail
HOST_DMD_VER=2.079.1
HOST_DMD_VER=2.095.0
CURL_USER_AGENT="CirleCI $(curl --version | head -n 1)"
DUB=${DUB:-dub}
N=${N:-2}

View file

@ -39,10 +39,10 @@ linux_task:
<< : *COMMON_STEPS_TEMPLATE
# Mac
mac_task:
name: macOS 10.15 x64
macos_task:
name: macOS 11.x x64
osx_instance:
image: catalina-xcode
image: big-sur-xcode
timeout_in: 60m
environment:
OS_NAME: darwin

View file

@ -678,9 +678,9 @@ if (!is(immutable T == immutable bool))
* Complexity: $(BIGOH 1).
*/
T[] data() @system
inout(T)[] data() inout @system
{
return _data._payload;
return _data.refCountedStore.isInitialized ? _data._payload : [];
}
/**
@ -2720,9 +2720,19 @@ if (is(immutable T == immutable bool))
@system unittest
{
Array!int arr = [1, 2, 4, 5];
int[] data = arr.data();
const Array!int arr2 = [8, 9];
assert(arr2.data() == [8, 9]);
data[0] = 0;
assert(arr[0] == 0);
arr.length = 0;
assert(arr.data == []);
Array!int empty;
assert(empty.data == []);
}

View file

@ -332,6 +332,7 @@ public:
version (Posix)
{
version (FreeBSD) enum utcZone = "Etc/UTC";
else version (OpenBSD) enum utcZone = "UTC";
else version (NetBSD) enum utcZone = "UTC";
else version (DragonFlyBSD) enum utcZone = "UTC";
else version (linux) enum utcZone = "UTC";

View file

@ -595,6 +595,12 @@ if (isFloatingPoint!T1 && isFloatingPoint!T2)
return r;
}
version (linux) version = GenericPosixVersion;
else version (FreeBSD) version = GenericPosixVersion;
else version (OpenBSD) version = GenericPosixVersion;
else version (Solaris) version = GenericPosixVersion;
else version (DragonFlyBSD) version = GenericPosixVersion;
private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
{
version (D_InlineAsm_X86)
@ -631,7 +637,7 @@ private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
return_ST: ;
}
}
else version (linux)
else version (GenericPosixVersion)
{
asm pure nothrow @nogc // assembler by W. Bright
{
@ -685,87 +691,6 @@ private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
return_ST: ;
}
}
else version (FreeBSD)
{
asm pure nothrow @nogc // assembler by W. Bright
{
// EDX = (A.length - 1) * real.sizeof
mov ECX,A[EBP] ; // ECX = A.length
dec ECX ;
lea EDX,[ECX*8] ;
lea EDX,[EDX][ECX*4] ;
add EDX,A+4[EBP] ;
fld real ptr [EDX] ; // ST0 = coeff[ECX]
jecxz return_ST ;
fld x[EBP] ; // ST0 = x
fxch ST(1) ; // ST1 = x, ST0 = r
align 4 ;
L2: fmul ST,ST(1) ; // r *= x
fld real ptr -12[EDX] ;
sub EDX,12 ; // deg--
faddp ST(1),ST ;
dec ECX ;
jne L2 ;
fxch ST(1) ; // ST1 = r, ST0 = x
fstp ST(0) ; // dump x
align 4 ;
return_ST: ;
}
}
else version (Solaris)
{
asm pure nothrow @nogc // assembler by W. Bright
{
// EDX = (A.length - 1) * real.sizeof
mov ECX,A[EBP] ; // ECX = A.length
dec ECX ;
lea EDX,[ECX*8] ;
lea EDX,[EDX][ECX*4] ;
add EDX,A+4[EBP] ;
fld real ptr [EDX] ; // ST0 = coeff[ECX]
jecxz return_ST ;
fld x[EBP] ; // ST0 = x
fxch ST(1) ; // ST1 = x, ST0 = r
align 4 ;
L2: fmul ST,ST(1) ; // r *= x
fld real ptr -12[EDX] ;
sub EDX,12 ; // deg--
faddp ST(1),ST ;
dec ECX ;
jne L2 ;
fxch ST(1) ; // ST1 = r, ST0 = x
fstp ST(0) ; // dump x
align 4 ;
return_ST: ;
}
}
else version (DragonFlyBSD)
{
asm pure nothrow @nogc // assembler by W. Bright
{
// EDX = (A.length - 1) * real.sizeof
mov ECX,A[EBP] ; // ECX = A.length
dec ECX ;
lea EDX,[ECX*8] ;
lea EDX,[EDX][ECX*4] ;
add EDX,A+4[EBP] ;
fld real ptr [EDX] ; // ST0 = coeff[ECX]
jecxz return_ST ;
fld x[EBP] ; // ST0 = x
fxch ST(1) ; // ST1 = x, ST0 = r
align 4 ;
L2: fmul ST,ST(1) ; // r *= x
fld real ptr -12[EDX] ;
sub EDX,12 ; // deg--
faddp ST(1),ST ;
dec ECX ;
jne L2 ;
fxch ST(1) ; // ST1 = r, ST0 = x
fstp ST(0) ; // dump x
align 4 ;
return_ST: ;
}
}
else
{
static assert(0);

View file

@ -2763,9 +2763,6 @@ public:
}
}
foreach (ref t; tasks[])
emplaceRef(t, RTask());
// Hack to take the address of a nested function w/o
// making a closure.
static auto scopedAddress(D)(scope D del) @system
@ -2778,12 +2775,19 @@ public:
void useTask(ref RTask task)
{
import std.algorithm.comparison : min;
import core.lifetime : emplace;
// Private constructor, so can't feed it's arguments directly
// to emplace
emplace(&task, RTask
(
scopedAddress(&reduceOnRange),
range,
curPos, // lower bound.
cast() min(len, curPos + workUnitSize) // upper bound.
));
task.pool = this;
task._args[0] = scopedAddress(&reduceOnRange);
task._args[3] = min(len, curPos + workUnitSize); // upper bound.
task._args[1] = range; // range
task._args[2] = curPos; // lower bound.
curPos += workUnitSize;
}
@ -3535,6 +3539,21 @@ public:
assert(taskPool.fold!("a + b", "a + b")(r, 0, 0, 42) == tuple(expected, expected));
}
// Issue 16705
@system unittest
{
struct MyIota
{
size_t front;
void popFront()(){front++;}
auto empty(){return front >= 25;}
auto opIndex(size_t i){return front+i;}
auto length(){return 25-front;}
}
auto mySum = taskPool.reduce!"a + b"(MyIota());
}
/**
Returns a lazily initialized global instantiation of `TaskPool`.
This function can safely be called concurrently from multiple non-worker

View file

@ -36,6 +36,7 @@ immutable
watchOS, /// watchOS
freeBSD, /// FreeBSD
netBSD, /// NetBSD
openBSD, /// OpenBSD
dragonFlyBSD, /// DragonFlyBSD
solaris, /// Solaris
android, /// Android
@ -54,6 +55,7 @@ immutable
else version (watchOS) OS os = OS.watchOS;
else version (FreeBSD) OS os = OS.freeBSD;
else version (NetBSD) OS os = OS.netBSD;
else version (OpenBSD) OS os = OS.openBSD;
else version (DragonFlyBSD) OS os = OS.dragonFlyBSD;
else version (Posix) OS os = OS.otherPosix;
else OS os = OS.unknown;