CMP (PC), 4(SP)

A recent discussion about the virtues of the Chief Programmer method motivated me to re-read “The Mythical Man-Month”. What a great book. I read it while on vacation and kept on saying to my wife “Why don’t they make all computer science and software engineering undergrads read this book?” When I came back, I asked some of my co-workers if they had read the book. The only ones that had were “old guys” (like me) and one “young guy” who attended UNC where Brooks taught. That’s sad and I encourage everyone young and old to read this book.
The book, however, is a little dated. To prove one of his points, Brooks describes as “extravagant” the use of and additional “10 bytes” to implement leap year support in OS 360’s date code. Now, 10 bytes “back in the day” was indeed extravagant, but for a programmer that has been brought up coding in today’s environments, 10 bytes is less than the guy’s email signature.
As I pondered these 10 bytes, I reminisced about some code I had to maintain in the RSTS/E kernel. The code was:
CMP (PC), 4(SP) ;Is 4 off of SP 4? Saves 2 bytes
This took me and another guy more than a couple of minutes to figured out, but sure enough it saved those precious two bytes. So, just how precious were those two bytes?
Adjusting for the fact that these two bytes were on a 16-bit architecture and today’s machines are 32-bit, I figured that those two bytes are equivalent to 128K. What would you do to save 128K in a space sensitive area of your system or perhaps that application you’re writing for your mobile phone?
So, what does this have to do with software security? Nothing. But, after all, I was on vacation.

