Hacker News new | past | comments | ask | show | jobs | submit login

In the case of JIT, it may swap the Bytecode but the flow of execution remains the same.

Are you able to elaborate on this further?

1a. Does this mean the process gets restarted during reload?

1b. If no restart, how are active threads handled? What if a thread should no longer exist post-reload?




JITs don’t need to reload code, they run the same code and tier it up to an optimized implementation when it gets hot. No execution context is lost, at least semantically.


> JITs don’t need to reload code

If I've inlined a method, and someone redefines that method in a language that allows that, then I'm going to need to reload that code.


I don’t know much about the internals of a JIT compiler, but wouldn’t it just (recursively) deoptimize the methods which include the inlined method and do a normal method call instead which will now go to the updated implementation?


Yes, but if a called function redefines its own parent, it still returns to the old code, not the new code.


That is true, but JITs nevertheless perform on-stack replacement for optimization purposes.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: