Create a computer language which permits self modifying code, and especially directs a compiler to compile such code down to self modifying machine code. However, let the language, as is typical for high-level languages, somehow bring some order to the chaos that self-modifying code usually causes.
An 'eval' function might be the most obvious way to provide a means to self-modifying code, but it doesn't seem quite right. A compiler might choose to embed an interpreter instead, which is the most common route.
Better and more straightforward might be the ability to address and manipulate labeled lexical code blocks.
The inspiration was applications for which compiled code size is at a premium. For such applications, the program could include a decompression algorithm highly customized to the specific code being compressed. On the other end, we need tools for a programmer to develop and deploy such custom compression algorithms. The programmer should only have to write uncompressed code, but this seems potentially hairy if uncompressed code, compression, and decompression are interleaved in arbitrarily complex ways.
However, general self-modifying code is probably overkill if all we want to do is decrease compiled code size. Pragmas to provide compression hints to the compiler? Frequently, the thing that actually needs to be compressed is a large amount of hardcoded data.
Previously, compression with a general purpose compressor.
No comments :
Post a Comment