3 ms·
JIT doesn't modify the behavior though, it typically just changes a function pointer and then that function does the same thing but more optimized. So then inst
by Jensson 4y ago
JIT doesn't modify the behavior though, it typically just changes a function pointer and then that function does the same thing but more optimized. So then instruction caches just has some effect on performance instead of changing program behavior.
- cwzwarich 4y agoJITs also modify the code at the destination of the function pointer, which was likely also code at a different time (since it usually needs to be allocated from a separate heap that is marked executable). If the CPU prefetched/cached the instructions at the function pointer target prior to the modification, then the program would observe incorrect behavior, even though it's not self-modifying code in the usual sense.