Re: Denial of denial of service

[prev] [thread] [next] [lurker] [Date index for 2007/01/28]

From: Yossi Kreinin
Subject: Re: Denial of denial of service
Date: 12:15 on 28 Jan 2007
Andy Armstrong wrote:
> 
> -fexceptions
> 
>     Enable exception handling. Generates extra code needed to propagate
>     exceptions. For some targets, this implies GCC will generate frame
>     unwind information for all functions, which can produce significant
>     data size overhead, although it does not affect execution.

The data size overhead surely looks significant (and the size of the program 
image does affect execution time by itself), but the execution is apparently 
affected more directly - by additional instructions emitted.

 > cat try.cpp

void f();

struct C { C(); ~C(); };

void g()
{
   C obj;
   f();
}

 > gcc -S try.cpp -O6 -fomit-frame-pointer
 > cat try.s
# tons of labels and such deleted
_Z1gv:
         pushl   %esi
         pushl   %ebx
         subl    $32, %esp
         leal    12(%esp), %esi
         pushl   %esi
         call    _ZN1CC1Ev
         addl    $16, %esp
         call    _Z1fv
         subl    $12, %esp
         pushl   %esi
         call    _ZN1CD1Ev
         addl    $36, %esp
         popl    %ebx
         popl    %esi
         ret

 > gcc -S try.cpp -O6 -o try2.s -fno-exceptions -fomit-frame-pointer
 > cat try2.s
# same shit without pushl/popl %esi:
_Z1gv:
         pushl   %ebx
         subl    $36, %esp
         leal    12(%esp), %ebx
         pushl   %ebx
         call    _ZN1CC1Ev
         addl    $16, %esp
         call    _Z1fv
         subl    $12, %esp
         pushl   %ebx
         call    _ZN1CD1Ev
         addl    $40, %esp
         popl    %ebx
         ret

And this is very graceful compared to Green Hills C++, for example.
There's stuff above here

Generated at 23:01 on 06 Feb 2007 by mariachi 0.52