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

Running .sh scripts in Git Bash

Let’s say you have a script script.sh. To run it (using Git Bash), you do the following: [a] Add a “sh-bang” line on the first line (e.g. #!/bin/bash) and then [b]: # Use ./ (or any valid dir spec): ./script.sh Note: chmod +x does nothing to a script’s executability on Git Bash. It won’t hurt … 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