From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] Good enough approximation for ape/pcc From: "Russ Cox" Date: Sun, 9 Apr 2006 23:19:06 -0500 In-Reply-To: <20060410024959.13656.qmail@g.galapagos.bx.psu.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 33f5d6b2-ead1-11e9-9d60-3106f5b1d025 > | The Plan 9 C libraries already provided a mechanism > | for finding the caller - getcallerpc(2). > > What happens when there is no caller because the function got inlined? Doesn't happen. One of the many nice things about the Plan 9 compilers. In fact, I just added two instructions to an assembly routine in libmp *only* so that stack traces would work when starting in that routine. I probably slowed it down by some miniscule fraction of a percent, and I certainly made the code a few bytes bigger. A lose/lose, except that now the code is more debuggable, and that's the ultimate win. > Obviously with compiler support you could get the right effect, but > wouldn't it be a bit more work? Dealing with all this crap while working on plan9port has soured me even more on the current state of mainstream programming. I learned to program using 16-bit DOS compilers. And they were better! I could rant about this and tell war stories for hours. The short version is this. Gcc does all these kinds of optimizations and more. I can't imagine what they're optimizing for. gcc-developer time? many hours went into writing that code. compile time? gcc is certainly getting slower correctness? the code may be correct but the debugging output (stack traces from gdb) gets less and less reliable my time? i've lost hours upon hours because of the increase in compile time and the unreliability of the debugging environment generated code speed? it's not cpu intensive in the first place, or i would have said -O99 or something like that So let's see. For negligible benefit that I indicated wasn't worth the effort via a compiler flag, they've wasted hours of their own time and hours of my time. Sounds like a bad deal to me. In a gcc world, I'm sure __func__ and its ilk make tons of sense. I want no part of such a world. Russ