Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge stable in mater #8313

Merged
merged 14 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
6 changes: 3 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions std/container/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -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 : [];
}

/**
Expand Down Expand Up @@ -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 == []);
}
1 change: 1 addition & 0 deletions std/datetime/timezone.d
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
89 changes: 7 additions & 82 deletions std/math/algebraic.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand Down
33 changes: 26 additions & 7 deletions std/parallelism.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions std/system.d
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ immutable
watchOS, /// watchOS
freeBSD, /// FreeBSD
netBSD, /// NetBSD
openBSD, /// OpenBSD
dragonFlyBSD, /// DragonFlyBSD
solaris, /// Solaris
android, /// Android
Expand All @@ -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;
Expand Down