researcher @google; serial complexity unpacker
ex @ msft & aerospace
LaurieWired
Loading...
The idea ended up not working; a few years later CPU’s started gaining instruction caches, and the round trip to rewrite the binary in memory would be much too slow.
Weird to think about, to me it feels like it would have been kinda JVM-y / V8ish but at a much much lower level of abstraction.
LaurieWired
That might not sound that wild, until you realize the entire structure relies on the branch predictor itself being self modifying code, which you’d then be able to evaluate with a debugger!
You’d have a compiled binary, that would radically change at runtime where you could see all the hints!
most non-C++ developers are just users playing inside a C++ dev’s program.
It’s no secret that I’m a big fan of the International Obfuscated C Code Contest!
Excited to watch winners streaming at 11AM PDT today.
It always brings out an interesting blend of compiler nerds, programming language theorists, and researchers.
I love looking at old crazy ideas in expired computer patents.
Modern CPU Branch Predictors are invisible. You, as a dev, can’t really see *what* paths the CPU is guessing…it’s all a bunch of AMD/Intel/Apple secret sauce.
For a brief moment in the 80s, there was this wacky proposition of...
here’s the link to the patent btw, crazy stuff: patents.google.com/patent/US443...
You run your program, and let’s say the if statement evaluates as true 99% of the time.
This patent suggested the CPU would then EDIT the running binary, in memory, to a new “JE-probably-taken” instruction, which upon subsequent execution would just assume true.
...storing the prediction IN the opcodes themselves!
If you don’t understand why that’s insane, bear with me for a second.
Imagine your binary has an ordinary if statement, that compiles down to a jump if equal instruction (JE).
Give it a watch, it’s the longest-running programming competition in the world!
They’ll be having the event here:
www.youtube.com/watch?v=MoWC...