[dmd-beta] dmd 1.070 and 2.055 beta

Rainer Schuetze r.sagitario at gmx.de
Tue Sep 6 13:51:19 PDT 2011


On 06.09.2011 22:45, Walter Bright wrote:
>
>
> On 9/6/2011 12:13 PM, Rainer Schuetze wrote:
>>
>> I can reproduce the issue on Win7 64, but not on XP. I have debugged 
>> it a little until I noticed that the generated code for TLS access 
>> seems broken:
>>
>> dmd 2.054 generated this code for the append operation
>>
>>  push        1
>> 1000207D  mov         ecx,dword ptr [__tls_index (1006BF98h)]
>> 10002083  mov         edx,dword ptr fs:[2Ch]
>> 1000208A  mov         ebx,dword ptr [edx+ecx*4]
>> 1000208D  lea         esi,[ebx+4]
>> 10002093  push        esi
>> 10002094  mov         eax,offset TypeInfo_Ai at __init (1005E9A0h)
>> 10002099  push        eax
>> 1000209A  call        __d_arrayappendcT (10004D68h)
>>
>> while the beta generates
>>
>> push        1
>> 10002076  mov         ecx,dword ptr fs:[2Ch]
>> 1000207D  mov         edx,dword ptr [ecx]
>> 1000207F  lea         ebx,[edx+4]
>> 10002085  push        ebx
>> 10002086  mov         esi,offset TypeInfo_Ai at __init (10067A90h)
>> 1000208B  push        esi
>> 1000208C  call        __d_arrayappendcT (10004F9Ch)
>>
>> so it completely ignores the tls_index. I guess it works on XP 
>> because there are less DLLs that use TLS, so the DLLs index ends up as 0.
>>
>
> Very interesting. Can you provide the source code for that?
>
>
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
it seems to happen with any code:

int x;

int main()
{
         return x;
}

generates

__Dmain comdat
         assume  CS:__Dmain
                 mov     EAX,FS:__tls_array
                 mov     ECX,[EAX]
                 mov     EAX,_D1m1xi[ECX]
                 ret
__Dmain ends

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20110906/0a1702ea/attachment-0001.html>


More information about the dmd-beta mailing list