Re: Reference value of structs not optimized or inlined?

2009-08-30 Thread Walter Bright
Jason House wrote: Don Wrote: I've been focussing more on ICE bugs and CTFE, which have been annoying me more. The focus on CTFE is pretty obvious from Walter's recent update to the changelog. Don has been contributing a lot to the compiler work lately.

Re: Reference value of structs not optimized or inlined?

2009-08-30 Thread Jason House
Don Wrote: > I've been focussing more on ICE bugs and CTFE, which have been > annoying me more. The focus on CTFE is pretty obvious from Walter's recent update to the changelog.

Re: Reference value of structs not optimized or inlined?

2009-08-30 Thread Bill Baxter
On Sat, Aug 29, 2009 at 3:23 PM, Walter Bright wrote: > Jarrett Billingsley wrote: >> >> You said "which of the thousand things people want done should be done >> first?" And we already tried to solve this problem with the Bugzilla >> voting feature. Has it been working out well? Have the issues th

Re: Reference value of structs not optimized or inlined?

2009-08-30 Thread Don
Bill Baxter wrote: On Fri, Aug 28, 2009 at 3:21 PM, Brad Roberts wrote: On Fri, 28 Aug 2009, Bill Baxter wrote: On Fri, Aug 28, 2009 at 1:20 PM, Walter Bright wrote: Jarrett Billingsley wrote: You're addressing the 'const' issue, but you haven't addressed the OP's issue: that 'ref', for what

Re: Reference value of structs not optimized or inlined?

2009-08-30 Thread davidl
在 Sun, 30 Aug 2009 06:23:38 +0800,Walter Bright 写道: Jarrett Billingsley wrote: You said "which of the thousand things people want done should be done first?" And we already tried to solve this problem with the Bugzilla voting feature. Has it been working out well? Have the issues that people

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Walter Bright
Steven Schveighoffer wrote: I think these kinds of limitations make people more sour than others because D lacks a manual inlining mechanism, with the explanation that the compiler knows how to inline better. C++ lacks it, too. The "inline" keyword is a hint which the compiler is free to igno

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Walter Bright
Jarrett Billingsley wrote: You said "which of the thousand things people want done should be done first?" And we already tried to solve this problem with the Bugzilla voting feature. Has it been working out well? Have the issues that people want to get fixed been getting more attention than the o

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Steven Schveighoffer
On Fri, 28 Aug 2009 16:51:03 -0400, Walter Bright wrote: Jarrett Billingsley wrote: On Fri, Aug 28, 2009 at 4:20 PM, Walter Bright wrote: Jarrett Billingsley wrote: You're addressing the 'const' issue, but you haven't addressed the OP's issue: that 'ref', for whatever reason, prevents inli

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Jarrett Billingsley
On Sat, Aug 29, 2009 at 3:42 PM, Walter Bright wrote: > Jarrett Billingsley wrote: >> >> On Sat, Aug 29, 2009 at 4:56 AM, Walter >> Bright wrote: >>> >>> Ary Borenszweig wrote: Walter Bright escribió: > > Ary Borenszweig wrote: >> >> Walter Bright escribió: >>> >>>

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Walter Bright
Jarrett Billingsley wrote: On Sat, Aug 29, 2009 at 4:56 AM, Walter Bright wrote: Ary Borenszweig wrote: Walter Bright escribió: Ary Borenszweig wrote: Walter Bright escribió: There are a lot of D specific optimization opportunities that are left undone for now. Why? Which of the thousand t

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread dsimcha
== Quote from Walter Bright (newshou...@digitalmars.com)'s article > Ary Borenszweig wrote: > > Walter Bright escribió: > >> There are a lot of D specific optimization opportunities that are left > >> undone for now. > > Why? > Which of the thousand things people want done in D should be done first

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread davidl
在 Sat, 29 Aug 2009 22:01:53 +0800,Jarrett Billingsley 写道: On Sat, Aug 29, 2009 at 4:56 AM, Walter Bright wrote: Ary Borenszweig wrote: Walter Bright escribió: Ary Borenszweig wrote: Walter Bright escribió: There are a lot of D specific optimization opportunities that are left undo

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Jarrett Billingsley
On Sat, Aug 29, 2009 at 4:56 AM, Walter Bright wrote: > Ary Borenszweig wrote: >> >> Walter Bright escribió: >>> >>> Ary Borenszweig wrote: Walter Bright escribió: > > There are a lot of D specific optimization opportunities that are left > undone for now. Why? >>> >

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Dominik
"Walter Bright" wrote in message news:h7a1td$6n...@digitalmars.com... > Ary Borenszweig wrote: >> Walter Bright escribió: >>> There are a lot of D specific optimization opportunities that are left >>> undone for now. >> Why? > > Which of the thousand things people want done in D should be done

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Jeremie Pelletier
Walter Bright Wrote: > Ary Borenszweig wrote: > > Walter Bright escribió: > >> Ary Borenszweig wrote: > >>> Walter Bright escribió: > There are a lot of D specific optimization opportunities that are > left undone for now. > >>> Why? > >> > >> Which of the thousand things people want do

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Walter Bright
Ary Borenszweig wrote: Walter Bright escribió: Ary Borenszweig wrote: Walter Bright escribió: There are a lot of D specific optimization opportunities that are left undone for now. Why? Which of the thousand things people want done in D should be done first? Those that you feel like doing

Re: Reference value of structs not optimized or inlined?

2009-08-29 Thread Ary Borenszweig
Walter Bright escribió: Ary Borenszweig wrote: Walter Bright escribió: There are a lot of D specific optimization opportunities that are left undone for now. Why? Which of the thousand things people want done in D should be done first? Those that you feel like doing first. Ok, you win. :-

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Christopher Wright
Walter Bright wrote: Ary Borenszweig wrote: Walter Bright escribió: There are a lot of D specific optimization opportunities that are left undone for now. Why? Which of the thousand things people want done in D should be done first? Those that the askers are willing to implement first, I'd

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Walter Bright
Ary Borenszweig wrote: Walter Bright escribió: There are a lot of D specific optimization opportunities that are left undone for now. Why? Which of the thousand things people want done in D should be done first?

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Bill Baxter
On Fri, Aug 28, 2009 at 5:01 PM, Ary Borenszweig wrote: > Walter Bright escribió: >> >> Jarrett Billingsley wrote: >>> >>> On Fri, Aug 28, 2009 at 4:20 PM, Walter >>> Bright wrote: Jarrett Billingsley wrote: > > You're addressing the 'const' issue, but you haven't addressed the >>

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Bill Baxter
On Fri, Aug 28, 2009 at 3:21 PM, Brad Roberts wrote: > On Fri, 28 Aug 2009, Bill Baxter wrote: > >> On Fri, Aug 28, 2009 at 1:20 PM, Walter >> Bright wrote: >> > Jarrett Billingsley wrote: >> >> >> >> You're addressing the 'const' issue, but you haven't addressed the >> >> OP's issue: that 'ref', f

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Ary Borenszweig
Walter Bright escribió: Jarrett Billingsley wrote: On Fri, Aug 28, 2009 at 4:20 PM, Walter Bright wrote: Jarrett Billingsley wrote: You're addressing the 'const' issue, but you haven't addressed the OP's issue: that 'ref', for whatever reason, prevents inlining. Const aside, why is this so? B

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Brad Roberts
On Fri, 28 Aug 2009, Bill Baxter wrote: > On Fri, Aug 28, 2009 at 1:20 PM, Walter > Bright wrote: > > Jarrett Billingsley wrote: > >> > >> You're addressing the 'const' issue, but you haven't addressed the > >> OP's issue: that 'ref', for whatever reason, prevents inlining. Const > >> aside, why i

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Bill Baxter
On Fri, Aug 28, 2009 at 1:20 PM, Walter Bright wrote: > Jarrett Billingsley wrote: >> >> You're addressing the 'const' issue, but you haven't addressed the >> OP's issue: that 'ref', for whatever reason, prevents inlining. Const >> aside, why is this so? > > Because I never updated the inlining cod

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Walter Bright
Jarrett Billingsley wrote: On Fri, Aug 28, 2009 at 4:20 PM, Walter Bright wrote: Jarrett Billingsley wrote: You're addressing the 'const' issue, but you haven't addressed the OP's issue: that 'ref', for whatever reason, prevents inlining. Const aside, why is this so? Because I never updated th

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Jarrett Billingsley
On Fri, Aug 28, 2009 at 4:20 PM, Walter Bright wrote: > Jarrett Billingsley wrote: >> >> You're addressing the 'const' issue, but you haven't addressed the >> OP's issue: that 'ref', for whatever reason, prevents inlining. Const >> aside, why is this so? > > Because I never updated the inlining cod

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Walter Bright
Jarrett Billingsley wrote: You're addressing the 'const' issue, but you haven't addressed the OP's issue: that 'ref', for whatever reason, prevents inlining. Const aside, why is this so? Because I never updated the inlining code to handle it.

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Jarrett Billingsley
On Thu, Aug 27, 2009 at 8:17 PM, Walter Bright wrote: > Jeremie Pelletier wrote: >> >> Isn't there a way to implement RVO to work on parameters (PVO?) too >> if the storage is const? > > No, and it doesn't work for C++ either. Consider: > You're addressing the 'const' issue, but you haven't addres

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Jeremie Pelletier
downs Wrote: > Walter Bright wrote: > > Jeremie Pelletier wrote: > >> Isn't it possible to make 'const ref S' or 'in S' generate the same > >> machine code as 'in S*'? To me it would seem the semantics of the two > >> are the same, with 'const S*' being useful syntax for C compatibility > >> while

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread downs
Walter Bright wrote: > Jeremie Pelletier wrote: >> Isn't it possible to make 'const ref S' or 'in S' generate the same >> machine code as 'in S*'? To me it would seem the semantics of the two >> are the same, with 'const S*' being useful syntax for C compatibility >> while 'in S' and 'const ref S'

Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Walter Bright
Jeremie Pelletier wrote: Isn't it possible to make 'const ref S' or 'in S' generate the same machine code as 'in S*'? To me it would seem the semantics of the two are the same, with 'const S*' being useful syntax for C compatibility while 'in S' and 'const ref S' are both D syntax. The thing ab

Re: Reference value of structs not optimized or inlined?

2009-08-27 Thread Jeremie Pelletier
Walter Bright Wrote: > Jeremie Pelletier wrote: > > Isn't there a way to implement RVO to work on parameters (PVO?) too > > if the storage is const? > > No, and it doesn't work for C++ either. Consider: > > struct S { int a; } > > void foo(const ref S s) > { > assert(s.a == 3); > bar(

Re: Reference value of structs not optimized or inlined?

2009-08-27 Thread Walter Bright
Jeremie Pelletier wrote: Isn't there a way to implement RVO to work on parameters (PVO?) too if the storage is const? No, and it doesn't work for C++ either. Consider: struct S { int a; } void foo(const ref S s) { assert(s.a == 3); bar(); assert(s.a == 3); // OOPS! } S g; void b

Re: Reference value of structs not optimized or inlined?

2009-08-26 Thread bearophile
Jeremie Pelletier: > DMD 2.031 here on windows 7 x64, I'm writing a Direct2D backend for my > display package. I don't mind not having 64-bit support for now, but I > definitely care about being on the bleeding edge of the D2 language. I also > use the same compiler on Ubuntu. > > I use a cust

Re: Reference value of structs not optimized or inlined?

2009-08-26 Thread Jeremie Pelletier
bearophile Wrote: > Jeremie Pelletier: > > > Just to stress out how important this is; I have a small loop calculating a > > 3x2 rotation matrix used with either Direct2D or Cairo every 10ms which > > transform the text "Hello World" in a window. CPU usage drops by 7-10% when > > using C style

Re: Reference value of structs not optimized or inlined?

2009-08-26 Thread bearophile
Jeremie Pelletier: > Just to stress out how important this is; I have a small loop calculating a > 3x2 rotation matrix used with either Direct2D or Cairo every 10ms which > transform the text "Hello World" in a window. CPU usage drops by 7-10% when > using C style pointers instead of D storage

Re: Reference value of structs not optimized or inlined?

2009-08-26 Thread Jeremie Pelletier
Jeremie Pelletier Wrote: > Bill Baxter Wrote: > > > On Wed, Aug 26, 2009 at 11:01 AM, Jeremie Pelletier > > wrote: > > > I just noticed that when a method has a ref parameter for a struct, it > > > doesn't get inlined: > > > > Here's the bug you want to vote up: > > > > http://d.puremagic.com

Re: Reference value of structs not optimized or inlined?

2009-08-26 Thread Jeremie Pelletier
Bill Baxter Wrote: > On Wed, Aug 26, 2009 at 11:01 AM, Jeremie Pelletier wrote: > > I just noticed that when a method has a ref parameter for a struct, it > > doesn't get inlined: > > Here's the bug you want to vote up: > > http://d.puremagic.com/issues/show_bug.cgi?id=2008 > > It is indeed a

Re: Reference value of structs not optimized or inlined?

2009-08-26 Thread Bill Baxter
On Wed, Aug 26, 2009 at 11:01 AM, Jeremie Pelletier wrote: > I just noticed that when a method has a ref parameter for a struct, it > doesn't get inlined: Here's the bug you want to vote up: http://d.puremagic.com/issues/show_bug.cgi?id=2008 It is indeed a sad situation. --bb

Reference value of structs not optimized or inlined?

2009-08-26 Thread Jeremie Pelletier
I just noticed that when a method has a ref parameter for a struct, it doesn't get inlined: union Matrix4x4 { struct { float _11, _12, ...} float[4][4] m; float[16] v; Matrix4x4 opMul(const ref Matrix4x4 m) const { ... } void opMulAssign(const ref Matrix4x4 m) { this = opMul(