Homoiconic and “unrestricted” self modifying code + Is lisp really self modifying?

In the first version (+ 1 2 3) is raw code, whereas in the second version it is data. By assuming the truth of this statement it can be argued that Lisp isn’t even homiconic. The code has the same representation as data in the sense that they are both lists/trees/S-expressions. But the fact that … Read more

How to write self modifying code in C?

You might want to consider writing a virtual machine in C, where you can build your own self-modifying code. If you wish to write self-modifying executables, much depends on the operating system you are targeting. You might approach your desired solution by modifying the in-memory program image. To do so, you would obtain the in-memory … Read more

Observing stale instruction fetching on x86 with self-modifying code

I think, you should check the MACHINE_CLEARS.SMC performance counter (part of MACHINE_CLEARS event) of the CPU (it is available in Sandy Bridge 1, which is used in your Air powerbook; and also available on your Xeon, which is Nehalem 2 – search “smc”). You can use oprofile, perf or Intel’s Vtune to find its value: … Read more

What are the uses of self modifying code? [closed]

Turns out that the Wikipedia entry on “self-modifying code” has a great list: Semi-automatic optimization of a state dependent loop. Runtime code generation, or specialization of an algorithm in runtime or loadtime (which is popular, for example, in the domain of real-time graphics) such as a general sort utility preparing code to perform the key … Read more

Are there any smart cases of runtime code modification?

There are many valid cases for code modification. Generating code at run time can be useful for: Some virtual machines use JIT compilation to improve performance. Generating specialized functions on the fly has long been common in computer graphics. See e.g. Rob Pike and Bart Locanthi and John Reiser Hardware Software Tradeoffs for Bitmap Graphics … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)