On 9 January 2012 18:15, Artur Skawina <art.08...@gmail.com> wrote: > On 01/09/12 10:53, Iain Buclaw wrote: >> On 5 January 2012 11:40, Artur Skawina <art.08...@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, >
Well, what else am I supposed to do, leave them to stack up? :-) > > [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...) I think the tweaks I've made for extern(D) - frame pointer turned on unless naked - trumps all other checks for whether it is ok to omit frame pointer. For extern(C) at least for x86, the frame pointer is omitted by default as is the default for that particular backend. Will need to fix the inline asm in phobos and druntime to be C calling convention friendly, then can drop all relevant attempts at matching the DMD calling convention. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';