Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
what is best in optimizer pipeline
value numbering
code motion
peepholing
loop idiom recognition
legalization
thread gassing
op banning
View Results
 
  • Locked thread
Spatial
Nov 15, 2007

compilers are fun. i wrote at one at work a couple of years ago for an embedded scripting language and learned a lot doing it. the feature i'm the most proud of is the nice error reporting system which underlines errors with token-level granularity and gives sensible human-friendly messages. at the time, this was better than any real compiler we used.

i found several fun bugs during development. my favourite was a performance issue where the compiler seemingly got exponentially slower the longer the input text was. after a few hours of profiling which didn't really help, i finally noticed that i had written:
C++ code:
class ExpressionParser {
    TokenStream stream;
};
problem being that "stream" is supposed to be a reference, not a value. since the compiler works by recursive descent this caused the entire input+metadata to be copied every single time the expression parser recursed, which it does once/twice per operator. one of those classic coding moments where my entire day's work was changing one character for a thousand times performance improvement. :v:

Adbot
ADBOT LOVES YOU

Spatial
Nov 15, 2007

The Management posted:

more like one of those moments when you realize why C++ is a terrible language
at the time my choices were C89 and C++11. that said, i still like it even though it really can be terrible

still copy and pasting code with #include in 2017! :downs:

Spatial
Nov 15, 2007

*reparses the same header for the 22,452nd time*

Spatial
Nov 15, 2007

c shouldn't be improved because it's not intended to be good - a moron

Spatial
Nov 15, 2007

insert compiler disk 1
*whiiirrrrr*
insert compiler disk 2
*whiiirrrrr*
insert linker disk 1
*whiiirrrrr*

Silver Alicorn posted:

this has gone far enough!!

  • Locked thread