-Reducing the length of the instruction path and thus improving performance.
-Reduce similar code, thus simplifying maintenance.
The term is usually only applied to the code where self-modification is intentional and not in situations where the code modifies itself accidentally due to an error such as a buffer overflow.
The method is frequently used to conditionally invoke test/debug code without the need for additional computational overhead for each input/output cycle.
It is also used as a way to camouflage malignant programs such as computer viruses, thus avoiding detection by antivirus.
Modifications can be made:
-Only during initialization: based in input parameters.The alteration of the program entry points is an equivalent indirect method of self-modification, but requires the co-existence of one or more alternative instructional routes, which increases the size of the program.
-Along execution (in English, on-the-fly or on the fly): based on certain program states that have been reached during execution.
In both cases the modifications can be made directly with the same machine code instructions, by superimposing the new instructions on the existing ones
The self-coding code is more difficult to read and maintain because the instructions listed in the source code will not be necessarily the instructions that will be executed.The self-modification consisting of the substitutions of function pointers may not be so cryptic, if it becomes clear that the names of the functions to be called are wildcards for function it is to be identified later.
Implementation of the self-coding code
Self-modification can be carried out in several ways depending on the programming language and the pointer support and/or access to the dynamic compiler or interpreter engines:
-Superposition of existing instructions (or part of instructions such as opcode, registration, flags or address).
-Direct creation of all instructions or sequences of instructions in memory.
-The creation or modification of source code instructions followed by a "mini compilation" or a dynamic interpretation.
-The dynamic creation of a complete program and then executing it.
Questions? needs more information?
Write and we will respond to your email
Comments
Post a Comment