|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - enabled exception handling and generated code
Hello Walter,
I compiled this code
--------- code ---------
#include <dos.h>
#include <string>
#include <vector>
struct SInOut {
std::string in_name;
std::string out_name;
};
std::vector<SInOut> io_names;
void AddExpandedWild(const char *arg)
{
SInOut names;
for(FIND *f = findfirst(arg, 0); f!=0; f=findnext()) {
names.in_name = f->name;
io_names.push_back(names);
}//for
}//AddExpandedWild
------ end code --------
with this complier switches
dmc -IE:\dm\stlport\stlport -Ae -o+all -c example.cpp
and disassembled the resulting OBJ-file. In the disassembled code I
found many unnecessary instructions and wondered why they are included.
Part of the diessassembled code shown here:
[snip]
L8E: mov dword ptr -4[EBP],0FFFFFFFFh <---- ???
mov dword ptr -4[EBP],3 <---- ???
mov dword ptr -4[EBP],4 <---- ???
mov dword ptr -4[EBP],3 <---- ???
mov dword ptr -4[EBP],5 <---- ???
mov dword ptr -4[EBP],3 <---- ???
mov dword ptr -4[EBP],6
mov EAX,-018h[EBP]
lea ECX,-018h[EBP]
sub EAX,-020h[EBP]
push EAX
push dword ptr -020h[EBP]
call near ptr void syscall
std::D::d::allocator<>::deallocate(char *,unsigned )const
mov dword ptr -4[EBP],3 <---- ???
mov dword ptr -4[EBP],7 <---- ???
mov dword ptr -4[EBP],3 <---- ???
mov dword ptr -4[EBP],0FFFFFFFFh <---- ???
mov dword ptr -4[EBP],8 <---- ???
mov dword ptr -4[EBP],0FFFFFFFFh <---- ???
mov dword ptr -4[EBP],9
mov EBX,-024h[EBP]
lea ECX,-024h[EBP]
sub EBX,-02Ch[EBP]
push EBX
push dword ptr -02Ch[EBP]
call near ptr void syscall
std::D::d::allocator<>::deallocate(char *,unsigned )const
mov dword ptr -4[EBP],0FFFFFFFFh <---- ???
mov dword ptr -4[EBP],0Ah <---- ???
mov dword ptr -4[EBP],0FFFFFFFFh
mov EAX,-0Ch[EBP]
mov FS:__except_list,EAX
[snip]
I assume that this moves have something to do with exception handling.
But I would also assume that the optimizer should be able to remove the
unnecessary moves.
BTW, Compiler version from SCPPN.EXE is 8.48.10n
- Heinz
Dec 11 2006
|