From f118c3f7cfcf9bc107eeecae3b58d883ba786095 Mon Sep 17 00:00:00 2001 From: dawg Date: Sat, 10 Mar 2012 18:33:43 +0100 Subject: [PATCH] get rid of dead code - remove old OSX module info code - remove unused _Dmodule_ref for OSX --- src/core/thread.d | 61 ----------------------------------------------- src/rt/minfo.d | 40 +++---------------------------- 2 files changed, 3 insertions(+), 98 deletions(-) diff --git a/src/core/thread.d b/src/core/thread.d index 2e31945ba41..28dd716582f 100644 --- a/src/core/thread.d +++ b/src/core/thread.d @@ -286,17 +286,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) @@ -377,18 +366,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; @@ -1392,18 +1369,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; @@ -2028,17 +1993,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; @@ -2130,21 +2084,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() ) diff --git a/src/rt/minfo.d b/src/rt/minfo.d index c773c636db1..e9909201e90 100644 --- a/src/rt/minfo.d +++ b/src/rt/minfo.d @@ -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 @@ -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; @@ -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) {