|
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 |
digitalmars.D - Inlining - am I mad?
Hey chaps,
Inlining doesn't seem to be working in v0.94. I've reduced the problem to this
test program because it wasn't inlining a bunch of proper code:
import std.random;
int MulBy2(int a)
{
return a * 2;
}
int main ( char [] [] args )
{
int x = rand();
int y = MulBy2(x);
return y;
}
I'm using this command line:
c:\dmd\bin\dmd.exe test.d -O -release -inline -oftest.exe
And it doesn't inline the call to MulBy2.
Here's the debugger mixed source/disassembly window:
--- test.d --------------------------------------------------------------------
import std.random;
int MulBy2(int a)
00402010 add eax,eax
{
return a * 2;
}
00402012 ret
00402013 int 3
int main ( char [] [] args )
00402014 push eax
{
int x = rand();
int y = MulBy2(x);
00402015 call _D3std6random4randFZk (402114h)
0040201A call (402010h)
return y;
}
0040201F pop ecx
--- No source file ------------------------------------------------------------
00402020 ret
00402021 int 3
00402022 int 3
00402023 int 3
Why isn't it inlining, please?
Si
Jul 03 2004
Im not sure debug and inline work together, and how did u get embedded debug info without including the proper flags ? You might want to try compiling to obj and using obj2asm. C In article <cc6nnr$tct$1 digitaldaemon.com>, Simon Hobbs says... Jul 03 2004
Oops, I did actually have the -g flag on the command line as well. I just typed it out wrongly in my post "Charlie" <Charlie_member pathlink.com> wrote in message news:cc6pep$vv5$1 digitaldaemon.com...Im not sure debug and inline work together, and how did u get embedded Jul 03 2004
Right now, initializers aren't inline expanded. So if you wrote:
int y;
y = MulBy2(x);
it will inline expand.
"Simon Hobbs" <Simon_member pathlink.com> wrote in message
news:cc6nnr$tct$1 digitaldaemon.com...
Jul 03 2004
|