Re: IL Engineering Library
- Posted by katsmeow Mar 05, 2015
- 4258 views
jimcbrown said...
katsmeow said...
One small item about that, if it is permanently injected into the existing IL code that's running, the next string, or file, that needs evaluating/executing, likely will not be the same size, so perfectly overwriting it is unlikely. Can the injection operation accomodate different string sizes with each pass thru the code?
All Euphoria code is turned into IL before any runtime execution of code happens. So by the time the IL operation occurs, there are no more files to be included, and no more passes of code by the byte-code compiler.
Since there are no strings, this concern is not applicable.
Given:
string = "atom a\na+=1\n? a" -- 15 bytes existing code1 convert_and_inject(string) existing code2and then i do
string = getf("c:\\euphoria\\200bytes_of_code.eux") -- 200 bytes existing code1 convert_and_inject(string) existing code2and then i do do it again
string = "atom a\na+=1\n? a" -- 15 bytes existing code1 convert_and_inject(string) existing code2and you are saying the string lengths do not matter and files don't exist? What?
The first run thru the code, the conversion and injection of 15 bytes of source is straight forward. But the 2nd time, the previous injected IL is wrong, string is now whatever was in that file, so the effects of the first injection need undoing, or overwriting. In the 3rd case, the 15 bytes won't overwrite the 200 bytes, but that 200 bytes is old and now wrong, and shouldn't be left in place. Yes, i know that the IL code isn't the same size as the source code, but i needed some numbers to toss around. Either a large block, with potentially a lot of NOPs must be allocated between existing code1 and existing code2, or it must be dynamically relocated each time string is IL'd and injected.
I hope i said it correctly this time.
Kat