FDEs for virtual thunks
Matthew Austern
austern@apple.com
Mon Jun 17 15:36:00 GMT 2002
Is there a reason that g++ generates FDEs for virtual thunks?
It doesn't seem to generate them for non-virtual thunks. If
those FDEs are really necessary, then that's that. If they
aren't, however, then it would be nice to get rid of them to
save space.
--Matt
An example of what I'm talking about:
------------------- source -------------------
int does_throw = 0;
struct VB {
virtual ~VB();
virtual void foo();
};
struct D : public virtual VB {
virtual void foo();
};
VB::~VB() { }
void VB::foo() { }
void D::foo() { if (does_throw) throw 137; }
------------------- assembly -------------------
(gcc3.1 on Red Hat Linux/i386 2.4.x)
$ /usr/local/gcc-3.1/bin/c++filt < matt2.s > matt2.filt.s
...
.section
.gnu.linkonce.t._ZTv0_n16_N1D3fooEv,"ax",@progbits
.align 2
.p2align 4,,15
.weak virtual thunk [v:0,-16] to D::foo()
.type virtual thunk [v:0,-16] to D::foo(),@function
virtual thunk [v:0,-16] to D::foo():
.LFB6:
pushl %ebp
.LCFI14:
movl %esp, %ebp
.LCFI15:
subl $8, %esp
.LCFI16:
movl 8(%ebp), %eax
movl (%eax), %edx
movl -16(%edx), %ecx
addl %ecx, %eax
movl %eax, 8(%ebp)
movl %ebp, %esp
popl %ebp
jmp D::foo()
.LFE6:
.Lfe6:
.size virtual thunk [v:0,-16] to D::foo(),.Lfe6-virtual thunk
[v:0,-16] to D::foo()
.weak VTT for D
...
.LSFDE11:
.long .LEFDE11-.LASFDE11
.LASFDE11:
.long .LASFDE11-.Lframe1
.long .LFB6
.long .LFE6-.LFB6
.uleb128 0x0
.byte 0x4
.long .LCFI14-.LFB6
.byte 0xe
.uleb128 0x8
.byte 0x85
.uleb128 0x2
.byte 0x4
.long .LCFI15-.LCFI14
.byte 0xd
.uleb128 0x5
.align 4
.LEFDE11:
.ident "GCC: (GNU) 3.1"
More information about the Gcc
mailing list