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

Commit 7fb8339

Browse files
committed
Turn globals into property functions that return a static member
1 parent 94e58d3 commit 7fb8339

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/rt/sections_elf_shared.d

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ version (Shared)
183183
*/
184184
Array!(ThreadDSO)* initTLSRanges() @nogc nothrow
185185
{
186-
return &_loadedDSOs;
186+
return &_loadedDSOs();
187187
}
188188

189189
void finiTLSRanges(Array!(ThreadDSO)* tdsos) @nogc nothrow
@@ -274,7 +274,7 @@ else
274274
*/
275275
Array!(void[])* initTLSRanges() nothrow @nogc
276276
{
277-
return &_tlsRanges;
277+
return &_tlsRanges();
278278
}
279279

280280
void finiTLSRanges(Array!(void[])* rngs) nothrow @nogc
@@ -325,7 +325,8 @@ version (Shared)
325325
_tlsRange = _pdso.tlsRange();
326326
}
327327
}
328-
Array!(ThreadDSO) _loadedDSOs;
328+
@property ref Array!(ThreadDSO) _loadedDSOs() @nogc nothrow { static Array!(ThreadDSO) x; return x; }
329+
//Array!(ThreadDSO) _loadedDSOs;
329330

330331
/*
331332
* Set to true during rt_loadLibrary/rt_unloadLibrary calls.
@@ -337,7 +338,8 @@ version (Shared)
337338
* The hash table is protected by a Mutex.
338339
*/
339340
__gshared pthread_mutex_t _handleToDSOMutex;
340-
__gshared HashTab!(void*, DSO*) _handleToDSO;
341+
@property ref HashTab!(void*, DSO*) _handleToDSO() @nogc nothrow { __gshared HashTab!(void*, DSO*) x; return x; }
342+
//__gshared HashTab!(void*, DSO*) _handleToDSO;
341343

342344
/*
343345
* Section in executable that contains copy relocations.
@@ -351,13 +353,15 @@ else
351353
* Static DSOs loaded by the runtime linker. This includes the
352354
* executable. These can't be unloaded.
353355
*/
354-
__gshared Array!(DSO*) _loadedDSOs;
356+
@property ref Array!(DSO*) _loadedDSOs() @nogc nothrow { __gshared Array!(DSO*) x; return x; }
357+
//__gshared Array!(DSO*) _loadedDSOs;
355358

356359
/*
357360
* Thread local array that contains TLS memory ranges for each
358361
* library initialized in this thread.
359362
*/
360-
Array!(void[]) _tlsRanges;
363+
@property ref Array!(void[]) _tlsRanges() @nogc nothrow { static Array!(void[]) x; return x; }
364+
//Array!(void[]) _tlsRanges;
361365

362366
enum _rtLoading = false;
363367
}

0 commit comments

Comments
 (0)