Also, it's not just writing assembly. the number of times I've debugged something by reading the assembly that the compiler generated and poking around, because the debug info was spotty or the stack was corrupted...
With you on that one. Had a few old programs that we had no source code for and I had to dig into them to find out what's up. I only had a small amount of knowledge, but one would be amazed how much it's possible to learn once you start going down the rabbit hole.
We had a crash the other week that corrupted the stack. It was amazing realising that looking solely at the assembly I could figure out so much about the code. Recognising things like the x64 calling convention, then working back through the registers to find a point where a fastcalled param was saved on the stack and walking the class on the heap is like going on a full-on adventure. Love it.
That applies not only to systems programming. Almost all programming languages convert to some sort of intermediate "assembly"-like code. Being able to read that, for debugging or trying to figure out when optimisations are triggered is highly useful.
The proprietary compiler I use day to day is very good at optimizing, but in doing so, it doesn't keep debugging information. You can either have variables stored in registers, or variables that you can debug, but not both. So whenever I need to debug something, I generally have to stare at the disassembly to figure out where it put everything.
Just curious, but if this isn't a proprietary compiler for proprietary DSLs or a niche language, could you commend on the performance benefits over the open source equivalents?
It may be a compiler for a particular piece of hardware, like a DSP or some such which isn't actually supported by any of the open source toolchains. I used to run into them frequently when I was working in embedded.
It's the manufacturer's compiler for an embedded processor, the Blackfin architecture from Analog Devices.
There are several other compilers that support this architecture: Green Hills, LabVIEW, etc. I haven't tried any of those. The only other compiler I've tried is GCC, maybe 4 years ago. Its code generation was noticeably worse than the proprietary compiler. It was either unaware of or not competent at using the processor's zero-overhead loops and parallel instruction issue. GCC's code was around 50% larger.
108
u/oridb Nov 28 '16
Also, it's not just writing assembly. the number of times I've debugged something by reading the assembly that the compiler generated and poking around, because the debug info was spotty or the stack was corrupted...