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

Commit

Permalink
Merge pull request #175 from dawgfoto/cleanup
Browse files Browse the repository at this point in the history
get rid of dead code
  • Loading branch information
complexmath committed Apr 16, 2012
2 parents cbde8f6 + f118c3f commit 859f04a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 98 deletions.
61 changes: 0 additions & 61 deletions src/core/thread.d
Expand Up @@ -285,17 +285,6 @@ else version( Posix )
__gshared void[][2] _tls_data_array;
}
}
else version(none)
{
extern (C)
{
extern __gshared
{
void* _tls_beg;
void* _tls_end;
}
}
}
else version( FreeBSD )
{
extern (C)
Expand Down Expand Up @@ -376,18 +365,6 @@ else version( Posix )
memcpy( p + sz0, _tls_data_array[1].ptr, _tls_data_array[1].length );
scope (exit) { free( p ); obj.m_tls = null; }
}
else version (none)
{
// NOTE: OSX does not support TLS, so we do it ourselves. The TLS
// data output by the compiler is bracketed by _tls_beg and
// _tls_end, so make a copy of it for each thread.
const sz = cast(void*) &_tls_end - cast(void*) &_tls_beg;
auto p = malloc( sz );
assert( p );
obj.m_tls = p[0 .. sz];
memcpy( p, &_tls_beg, sz );
scope (exit) { free( p ); obj.m_tls = null; }
}
else
{
auto pstart = cast(void*) &_tlsstart;
Expand Down Expand Up @@ -1394,18 +1371,6 @@ private:
memcpy( p + sz0, _tls_data_array[1].ptr, _tls_data_array[1].length );
// The free must happen at program end, if anywhere.
}
else version (none)
{
// NOTE: OSX does not support TLS, so we do it ourselves. The TLS
// data output by the compiler is bracketed by _tls_beg and
// _tls_end, so make a copy of it for each thread.
const sz = cast(void*) &_tls_end - cast(void*) &_tls_beg;
auto p = malloc( sz );
assert( p );
m_tls = p[0 .. sz];
memcpy( p, &_tls_beg, sz );
// The free must happen at program end, if anywhere.
}
else
{
auto pstart = cast(void*) &_tlsstart;
Expand Down Expand Up @@ -2031,17 +1996,6 @@ extern (C) Thread thread_attachThis()
memcpy( p + sz0, _tls_data_array[1].ptr, _tls_data_array[1].length );
// used gc_malloc so no need to free
}
else version (none)
{
// NOTE: OSX does not support TLS, so we do it ourselves. The TLS
// data output by the compiler is bracketed by _tls_beg and
// _tls_end, so make a copy of it for each thread.
const sz = cast(void*) &_tls_end - cast(void*) &_tls_beg;
auto p = gc_malloc(sz);
thisThread.m_tls = p[0 .. sz];
memcpy( p, &_tls_beg, sz );
// used gc_malloc so no need to free
}
else
{
auto pstart = cast(void*) &_tlsstart;
Expand Down Expand Up @@ -2134,21 +2088,6 @@ version( Windows )
if( t.m_addr == pthread_self() )
Thread.setThis( thisThread );
}
else version (none)
{
// NOTE: OSX does not support TLS, so we do it ourselves. The TLS
// data output by the compiler is bracketed by _tls_beg and
// _tls_end, so make a copy of it for each thread.
const sz = cast(void*) &_tls_end - cast(void*) &_tls_beg;
auto p = gc_malloc(sz);
assert( p );
obj.m_tls = p[0 .. sz];
memcpy( p, &_tls_beg, sz );
// used gc_malloc so no need to free

if( t.m_addr == pthread_self() )
Thread.setThis( thisThread );
}
else version( Windows )
{
if( addr == GetCurrentThreadId() )
Expand Down
40 changes: 3 additions & 37 deletions src/rt/minfo.d
Expand Up @@ -130,14 +130,7 @@ extern (C) void rt_moduleDtor()
* Access compiler generated list of modules.
*/

version (none)
{
extern (C)
{
extern __gshared void* _minfo_beg;
extern __gshared void* _minfo_end;
}
}
version (OSX) {}
else version (Posix)
{
// This linked list is created by a compiler generated function inserted
Expand All @@ -163,10 +156,8 @@ body

version (OSX)
{
// set by src.rt.memory_osx.onAddImage()
result = _moduleinfo_array;

// But we need to throw out any null pointers
// _moduleinfo_array is set by src.rt.memory_osx.onAddImage()
// but we need to throw out any null pointers
auto p = _moduleinfo_array.ptr;
auto pend = _moduleinfo_array.ptr + _moduleinfo_array.length;

Expand All @@ -182,31 +173,6 @@ body
for (; p < pend; ++p)
if (*p !is null) result[cnt++] = *p;
}
else version (none)
{
//printf("getModuleInfos()\n");
/* The ModuleInfo references are stored in the special segment
* __minfodata, which is bracketed by the segments __minfo_beg
* and __minfo_end. The variables _minfo_beg and _minfo_end
* are of zero size and are in the two bracketing segments,
* respectively.
*/

auto p = cast(ModuleInfo**)&_minfo_beg;
auto pend = cast(ModuleInfo**)&_minfo_end;

// Throw out null pointers
size_t cnt;
for (; p < pend; ++p)
if (*p !is null) ++cnt;

result = (cast(ModuleInfo**).malloc(cnt * size_t.sizeof))[0 .. cnt];

p = cast(ModuleInfo**)&_minfo_beg;
cnt = 0;
for (; p < pend; ++p)
if (*p !is null) result[cnt++] = *p;
}
// all other Posix variants (FreeBSD, Solaris, Linux)
else version (Posix)
{
Expand Down

0 comments on commit 859f04a

Please sign in to comment.