digitalmars.D - Switch to list all druntime calls?
- bearophile (7/7) May 20 2014 Instead (or in addition) of this dmd compiler switch:
- Meta (5/12) May 20 2014 I think I remember Adam Ruppe mentioning somewhere that you can
- bearophile (4/8) May 20 2014 Then why is -vgc includes among the dmd switches?
- Adam D. Ruppe (5/6) May 20 2014 Yeah, it will work, but it isn't as convenient as a compiler
- David Nadlinger (7/12) May 20 2014 No. There are quite a few runtime functions which don't in fact
- bearophile (5/7) May 20 2014 Finding them is the point of a "-noruntime" switch. Now for just
- bearophile (38/38) May 21 2014 This shows one purpose of the ldc2 -noruntime switch. A simple
Instead (or in addition) of this dmd compiler switch: -vgc list all hidden gc allocations Isn't it more useful a compiler switch like "-noruntime" (similar to the switch of the ldc2 compiler) meant to list the lines of code where are implicit calls to runtime funcitions? Bye, bearophile
May 20 2014
On Tuesday, 20 May 2014 at 10:39:32 UTC, bearophile wrote:Instead (or in addition) of this dmd compiler switch: -vgc list all hidden gc allocations Isn't it more useful a compiler switch like "-noruntime" (similar to the switch of the ldc2 compiler) meant to list the lines of code where are implicit calls to runtime funcitions? Bye, bearophileI think I remember Adam Ruppe mentioning somewhere that you can use a custom object.d and omit the Druntime functions, and the linker will complain about them at link-time where they're used. That more or less does the trick, doesn't it?
May 20 2014
Meta:I think I remember Adam Ruppe mentioning somewhere that you can use a custom object.d and omit the Druntime functions, and the linker will complain about them at link-time where they're used. That more or less does the trick, doesn't it?Then why is -vgc includes among the dmd switches? Bye, bearophile
May 20 2014
On Tuesday, 20 May 2014 at 15:53:51 UTC, Meta wrote:That more or less does the trick, doesn't it?Yeah, it will work, but it isn't as convenient as a compiler helper thingy because pulling a function out of object.d can be a pain and the linker error isn't as easy to read as a compiler error (no code line number for example).
May 20 2014
On Tuesday, 20 May 2014 at 10:39:32 UTC, bearophile wrote:Instead (or in addition) of this dmd compiler switch: -vgc list all hidden gc allocations Isn't it more useful a compiler switch like "-noruntime" (similar to the switch of the ldc2 compiler) meant to list the lines of code where are implicit calls to runtime funcitions?No. There are quite a few runtime functions which don't in fact allocate. -vgc is a tool to help in avoiding GC allocations, not all druntime dependencies. I'd suspect that the answer to the question about the "more useful" behavior depends entirely on your use case. David
May 20 2014
David Nadlinger:There are quite a few runtime functions which don't in fact allocate.Finding them is the point of a "-noruntime" switch. Now for just the ones that allocate we have nogc. Bye, bearophile
May 20 2014
This shows one purpose of the ldc2 -noruntime switch. A simple test program: void foo(ref int[10] data) { data[0 .. 3] = 5; data[7 .. 9] = 10; } void main() {} dmd compiles it to: _D5test53fooFKG10iZv: L0: push EAX push 3 push 5 push EAX call near ptr __memset32 push 2 push 0Ah mov EAX,014h[ESP] lea ECX,01Ch[EAX] push ECX call near ptr __memset32 add ESP,018h pop EAX ret ldc2 is smarter and removes the calls to memset, generating kind of optimal 32 bit code: __D5test53fooFKG10iZv: movl $5, (%eax) movl $5, 4(%eax) movl $5, 8(%eax) movl $10, 28(%eax) movl $10, 32(%eax) ret If you call such function many times you see a significant run time difference between the two compilations. A switch like -noruntime helps find the unwanted cases where the compiler you are using doesn't remove some run time call. Bye, bearophile
May 21 2014