Recently I've been reading on how modern OS load executable programs and allocate memories for them. Unfortunately, I only have a computer science book in Russian as a reference, so, please, correct me if I am wrong, but it appears that modern OS have different sections in an executable program for data and actual processor commands. Furthermore, it is not possible to give the control to data section, i.e. one cannot store the command there. It is also not possible to change the processor command in executable (text
) section.
Hence, the question: how does modern compiled CL (SBCL, Clozure-CL) does it? As far as I can understand it creates compiled FASL files and then loads them. But visible FASL files are created when a file is compiled. What happens when the function form is evaluated? Secondly, how does CL load them (at the level of machine/OS commands) so that a correct memory is allocated for them? Also, the old code must be off-loaded somehow.
PS. Of course, this is not an issue for interpreted languages. And things get even more complicated for JIT-compilers.