System programming in D (Was: The God Language)

Artur Skawina art.08.09 at gmail.com
Mon Jan 9 10:15:52 PST 2012


On 01/09/12 10:53, Iain Buclaw wrote:
> On 5 January 2012 11:40, Artur Skawina <art.08.09 at gmail.com> wrote:
>> IOW gdc completely gives up on inlining the function/method because of the "in".
>> Actually, "bool empty2(T)(const T[] a)" is enough to trigger the call.
>>
>> This means that eg array.empty never gets inlined.
>> "pragma(attribute, always_inline)" does not help in this case.
> 
> I have sorted this out.

Works. Thank you very much, not just for this, but for quickly fixing practically every single gdc bug that i filed.

It's nice to see all the code from my example compiled to just "mov $0x1,%eax" [1] and the runtime/phobos codegen improved too, some null pointer checks gone, significantly reduced spilling, opCall()/empty() are now inlined, which means they completely disappear etc.

Thanks,

artur

[1] I guess omitting the frame pointer manipulation for (at least) just nonthrowing leaf functions that don't use any stack slots wouldn't be easy? (the vector extensions will probably make this even more important...)


More information about the D.gnu mailing list