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

Commit 25df7fd

Browse files
Geod24thewilsonator
authored andcommitted
Conservative GC: Tidy up imports
There's no point in nested import if the function is not templated, as it will be imported/read by the compiler anyways. It also makes it harder to see a module's dependency, hence this commit pool all relevant imports together and remove some duplicated ones.
1 parent 1be0e9c commit 25df7fd

File tree

1 file changed

+6
-7
lines changed
  • src/core/internal/gc/impl/conservative

1 file changed

+6
-7
lines changed

src/core/internal/gc/impl/conservative/gc.d

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import core.gc.config;
3838
import core.gc.gcinterface;
3939

4040
import core.internal.container.treap;
41+
import core.internal.spinlock;
42+
import core.internal.gc.pooltable;
4143

4244
import cstdlib = core.stdc.stdlib : calloc, free, malloc, realloc;
4345
import core.stdc.string : memcpy, memset, memmove;
@@ -145,7 +147,6 @@ class ConservativeGC : GC
145147

146148
Gcx *gcx; // implementation
147149

148-
import core.internal.spinlock;
149150
static gcLock = shared(AlignedSpinLock)(SpinLock.Contention.lengthy);
150151
static bool _inFinalizer;
151152
__gshared bool isPrecise = false;
@@ -1475,7 +1476,6 @@ private void set(ref PageBits bits, size_t i) @nogc pure nothrow
14751476

14761477
struct Gcx
14771478
{
1478-
import core.internal.spinlock;
14791479
auto rootsLock = shared(AlignedSpinLock)(SpinLock.Contention.brief);
14801480
auto rangesLock = shared(AlignedSpinLock)(SpinLock.Contention.brief);
14811481
Treap!Root roots;
@@ -1491,7 +1491,6 @@ struct Gcx
14911491
debug(INVARIANT) bool inCollection;
14921492
uint disabled; // turn off collections if >0
14931493

1494-
import core.internal.gc.pooltable;
14951494
private @property size_t npools() pure const nothrow { return pooltable.length; }
14961495
PoolTable!Pool pooltable;
14971496

@@ -2300,7 +2299,6 @@ struct Gcx
23002299
bitpos -= rng.bmplength;
23012300
rng.pbase += rng.bmplength;
23022301
}
2303-
import core.bitop;
23042302
if (!core.bitop.bt(rng.ptrbmp, bitpos))
23052303
{
23062304
debug(MARK_PRINTF) printf("\t\tskipping non-pointer\n");
@@ -2928,7 +2926,6 @@ struct Gcx
29282926
import core.stdc.stdlib : _Exit;
29292927
debug (PRINTF_TO_FILE)
29302928
{
2931-
import core.stdc.stdio : fflush;
29322929
fflush(null); // avoid duplicated FILE* output
29332930
}
29342931
version (OSX)
@@ -3262,8 +3259,11 @@ Lmark:
32623259

32633260
/* ============================ Parallel scanning =============================== */
32643261
version (COLLECT_PARALLEL):
3265-
import core.sync.event;
3262+
32663263
import core.atomic;
3264+
import core.cpuid;
3265+
import core.sync.event;
3266+
32673267
private: // disable invariants for background threads
32683268

32693269
static struct ScanThreadData
@@ -3334,7 +3334,6 @@ Lmark:
33343334

33353335
int maxParallelThreads() nothrow
33363336
{
3337-
import core.cpuid;
33383337
auto threads = threadsPerCPU();
33393338

33403339
if (threads == 0)

0 commit comments

Comments
 (0)