> Seriously, older machines were faster with self-modifying code, but > newer ones are much more sensitive and slower. Anything within a > (roughly) 4 kb radius gets slowed down dramatically. I noticed this, > years ago, on my old AMD TK53x2 laptop.
The code in SLOWDOWN is not self-modifying (as Tom indicated), so that doesn't apply here. >... > > Maybe speculative execution is affected by this, too? Speculative execution and caching are interrelated (I'm not sure it's even possible to do speculative execution without a cache). Even something as simple as pipelining (essentially performing two sequential/adjacent CPU instructions at the same time) is a form of speculative execution, and when the CPU makes a "mistake" it needs to back up and do things again. I'm sure some of that (and maybe even a lot of speculative execution) is what I'm seeing that makes the modern CPUs seem so slow. That would also be another one of those things I claim are "tricks" that make a CPU seem faster than it really is. Here's another thing I suspect the vast majority of people don't know. Even the lowly 8088/8086 CPUs had a very rudimentary form of cache that was called a Prefetch Input Queue (PIQ). It was a small read-ahead cache (only 4 bytes in the 8086/8088, 32 bytes in the 486, and I think was completely abolished in the Pentiums in favor of a "real" cache). The PIQ assumed that the code would essentially execute from top to bottom with no jumps (either conditional, direct, or indirect). If there was ever a jump in the code, the PIQ would be flushed and data would need to be read from RAM again. The PIQ never did any speculation or prediction but just did read-ahead on the RAM and code that was just "straight-through" and never did any jumping was faster than "jumpy" code. If the CPU was performing a slow instruction, the CPU would read-ahead from the RAM (a simple form of multi-tasking). AFAIK, the only way to test for the presence and size of the PIQ requires the use of self-modifying code. In my ISLOADED program (currently in progress) one of the ways I'm testing for the presence of a "generic" VM is to test to see if there is a PIQ or not (if the CPU being emulated is a 486 or less) and if the PIQ is the size it's supposed to be. A lot of emulated CPUs don't virtualize the PIQ correctly (if at all). _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel