www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4083] New: Exception-related code from nothrow destructor

http://d.puremagic.com/issues/show_bug.cgi?id=4083

           Summary: Exception-related code from nothrow destructor
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: performance
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-04-12 04:29:17 PDT ---
This can be related to bug 4082.
This program works correctly with dmd 2.043, but the resulting asm contains
code for the management of exceptions even if the destructor of the struct Foo
is nothrow (I am not sure if this situation can be improved):


struct Foo {
    nothrow ~this() {}
}
void main() {
    Foo f;
    goto NEXT;
    NEXT:;
}


__Dmain
L0:     push    EBP
        mov EBP,ESP
        mov EDX,FS:__except_list
        push    0FFFFFFFFh
        push    offset __Dmain[061h]
        push    EDX
        mov FS:__except_list,ESP
        sub ESP,8
        push    EAX
        push    EBX
        push    ESI
        push    EDI
        mov dword ptr -4[EBP],0
        mov dword ptr -4[EBP],0FFFFFFFFh
        lea ECX,-0Ch[EBP]
        push    0FFFFFFFFh
        push    ECX
        push    offset FLAT:_DATA
        call    near ptr __d_local_unwind2
        add ESP,0Ch
        push    offset __Dmain[04Eh]
        mov dword ptr -4[EBP],0FFFFFFFFh
        ret
        mov ECX,-0Ch[EBP]
        xor EAX,EAX
        mov FS:__except_list,ECX
        pop EDI
        pop ESI
        pop EBX
        mov ESP,EBP
        pop EBP
        ret
        mov EAX,offset FLAT:_DATA
        jmp near ptr __d_framehandler

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 12 2010