3 ms·
Self-modifying code in a traditional sense has been changing constants and instructions in a tight loops that are assembled by hand. I don't think any of JITs
by miohtama 4y ago
Self-modifying code in a traditional sense has been changing constants and instructions in a tight loops that are assembled by hand.
I don't think any of JITs take this approach, as when they emit machine code it is always a fresh memory allocation and fresh compilation. JITs don't "poke and peek" already compiled code. But I could be wrong as JITs are getting complex today.
- ridiculous_fish 4y agoJITs do indeed modify already-compiled code. For example, JavaScriptCore has a notion of a "patchable jump." These are jump instructions intended to be modified later. They may initially point to slow paths, and are later patched to point to faster paths as type information accumulates. https://webkit.org/blog/10298/inline-caching-delete/ https://webkit.org/blog/10298/inline-caching-delete/
- miohtama 4y agoThis looks super interesting, thank you.