4 ms·
"If we store the ip directly in a C local variable and mark it register, there’s a good chance the C compiler will accede to our polite request." Hmm. I may be
by smueller1234 7y ago
"If we store the ip directly in a C local variable and mark it register, there’s a good chance the C compiler will accede to our polite request."
Hmm. I may be getting rusty, but do modern compilers actually still pay attention to the "register" keyword?
Also, I may have read this too quickly, but if I'm not mistaken you limit the number of parameters to 8, yet the number of arguments passed to 255. Does that make sense?
Thank you once again for a brilliant read!
- munificent 7y ago> do modern compilers actually still pay attention to the "register" keyword? You know, I'm honestly not sure. If nothing else, it sends a signal to human readers of the code. > if I'm not mistaken you limit the number of parameters to 8, yet the number of arguments passed to 255. You are not mistaken. I changed the limit, but missed that part. Filed an issue to fix this: https://github.com/munificent/craftinginterpreters/issues/468 https://github.com/munificent/craftinginterpreters/issues/46... Thank you!
- smueller1234 7y agoQuick search, first hit: https://stackoverflow.com/questions/10675072/is-the-register-keyword-still-used https://stackoverflow.com/questions/10675072/is-the-register... I know, hardly authoritative. But it matches precisely what I remember from when I was hacking on perl with an eye to performance at the time. Maybe drop that bit regarding 'register'? The rest of that section is still perfectly valid. That is, assuming the compiler doesn't actually perform the local variable/keep in register optimisation itself, but I think it can't do that at least in the general case. I only remember vague things about this. At least aliasing may defeat the compiler optimisation. Caveat: Like yourself, I picked this stuff up without studying it as part of a degree. Anybody with a proper compiler background want to jump in and enlighten maybe?