Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 39287b2

Browse files
committed
Merge remote-tracking branch 'upstream/stable' into merge_stable
2 parents f603a46 + f496294 commit 39287b2

File tree

3 files changed

+45
-4
lines changed

3 files changed

+45
-4
lines changed

changelog/lazy-gc-init.dd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
the garbage collector is now lazily initialized on first use
1+
The garbage collector is now lazily initialized on first use
22

33
The runtime now lazily initializes the GC on first use, thus allowing applications that do not use the GC to skip its initialization.

src/core/memory.d

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,14 +1010,16 @@ void __delete(T)(ref T x) @system
10101010
static assert(0, "It is not possible to delete: `" ~ T.stringof ~ "`");
10111011
}
10121012

1013-
static if (is(T == interface) || is(T == class))
1013+
static if (is(T == interface) ||
1014+
is(T == class) ||
1015+
is(T == U2*, U2))
10141016
{
10151017
GC.free(cast(void*) x);
10161018
x = null;
10171019
}
1018-
else static if (is(T == U2*, U2) || is(T : E2[], E2))
1020+
else static if (is(T : E2[], E2))
10191021
{
1020-
GC.free(&x);
1022+
GC.free(x.ptr);
10211023
x = null;
10221024
}
10231025
}
@@ -1151,4 +1153,17 @@ unittest
11511153
{
11521154
Object x = null;
11531155
__delete(x);
1156+
1157+
struct S { ~this() { } }
1158+
class C { }
1159+
interface I { }
1160+
1161+
int[] a; __delete(a);
1162+
S[] as; __delete(as);
1163+
C c; __delete(c);
1164+
I i; __delete(i);
1165+
C* pc = &c; __delete(*pc);
1166+
I* pi = &i; __delete(*pi);
1167+
int* pint; __delete(pint);
1168+
S* ps; __delete(ps);
11541169
}

src/core/sys/posix/sys/shm.d

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,32 @@ else version(NetBSD)
156156
int shmdt(in void*);
157157
int shmget(key_t, size_t, int);
158158
}
159+
else version(DragonFlyBSD)
160+
{
161+
enum SHM_RDONLY = 0x01000; // 010000
162+
enum SHM_RND = 0x02000; // 020000
163+
enum SHMLBA = 1 << 12; // PAGE_SIZE = (1<<PAGE_SHIFT)
164+
165+
alias c_ulong shmatt_t;
166+
167+
struct shmid_ds
168+
{
169+
ipc_perm shm_perm;
170+
int shm_segsz;
171+
pid_t shm_lpid;
172+
pid_t shm_cpid;
173+
short shm_nattch;
174+
time_t shm_atime;
175+
time_t shm_dtime;
176+
time_t shm_ctime;
177+
private void* shm_internal;
178+
}
179+
180+
void* shmat(int, in void*, int);
181+
int shmctl(int, int, shmid_ds*);
182+
int shmdt(in void*);
183+
int shmget(key_t, size_t, int);
184+
}
159185
else version( Darwin )
160186
{
161187

0 commit comments

Comments
 (0)