Nor in this perhaps shall I appear too vain, if it be considered that, as the truth on any particular point is one, whoever apprehends the truth, knows all that on that point can be known.- Why did x86 support self-modifying code in the 80s and 90s? (stackexchange.com)
On the simplest microprocessors, self-modifying code is not a special problem. On an 8080, you can write just ahead of the instruction pointer, and a few clock cycles later, the instruction you just wrote, will be fetched and executed as though it had been there all along. But as pipelines and instruction cache are introduced, this becomes more problematic.
- Self-modifying code (Wikipedia)
In computer science, self-modifying code (SMC or SMoC) is code that alters its own instructions while it is executing – usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, thus simplifying maintenance. The term is usually only applied to code where the self-modification is intentional, not in situations where code accidentally modifies itself due to an error such as a buffer overflow.