Closed Bug 114728 Opened 23 years ago Closed 22 years ago

Our code could be smaller without exceptions and RTTI

Categories

(SeaMonkey :: Build Config, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID
Future

People

(Reporter: ccarlen, Assigned: ccarlen)

Details

Currently, both of these options are on in IDE_Options.h size of xpcom.shlb with these on: 1,108,840 bytes size of xpcom.shlb with these off: 1,013,732 bytes This could be some low hanging fruit.
it's already off on the mach-o build. my only concern is that if we turn rtti off that it will cause problems for apps that have it on (embedding apps). Doesn't it change the ABI?
scc - Is it possible for an embedding app built with RTTI to use our code built without?
Yes, we do need to find out whether RTTI changes the ABI. As far as bug 73606, compiling nsStdLib without exceptions is the least of its problems. The big problem with nsStdLib is that it implements void* operator new(size_t size); as if it were void* operator new(size_t size, const nothrow_t&); That, whether compiled with exceptions on or off, turns them off where embeddors using nsStdLib depend on them most.
After looking at MWRTTI.cp and some disassembly, objects and their vtables compiled with RTTI can co-exist. The first entry in a CW vtable is a pointer to an RTTI info struct. If compiled without RTTI, this pointer is still in the vtable, it's just always zero. The offsets the the member functions remain the same. Here's this class: class foo { public: foo(); virtual ~foo(); virtual void init(); }; Here's its disassembled vtable with RTTI on: Hunk: Kind=HUNK_GLOBAL_IDATA Align=4 Class=RW Name="__vt__3foo"(13) Size=16 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' XRef: Kind=HUNK_XREF_32BIT Offset=$00000000 Class=RW Name="__RTTI__3foo"(154) XRef: Kind=HUNK_XREF_32BIT Offset=$0000000C Class=DS Name="init__3fooFv"(155) XRef: Kind=HUNK_XREF_32BIT Offset=$00000008 Class=DS Name="__dt__3fooFv"(156) and with RTTI off: Hunk: Kind=HUNK_GLOBAL_IDATA Align=4 Class=RW Name="__vt__3foo"(13) Size=16 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '................' XRef: Kind=HUNK_XREF_32BIT Offset=$0000000C Class=DS Name="init__3fooFv"(153) XRef: Kind=HUNK_XREF_32BIT Offset=$00000008 Class=DS Name="__dt__3fooFv"(154) Notice that the size is the same, and the offsets are the same. They both have room for the RTTI info, it'll just never be filled in on the one compiled without RTTI.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.0
Mass move to 1.0.1
Target Milestone: mozilla1.0 → mozilla1.0.1
Not an issue since we're not using this build environment going forward.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Target Milestone: mozilla1.0.1 → Future
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.