2 ms·
Program Edit and Continue is a fragile self modifying C code hack that you would never dare try in production on a customer machine. It doesn't simply replace
by kazinator 3y ago
Program Edit and Continue is a fragile self modifying C code hack that you would never dare try in production on a customer machine.
It doesn't simply replace a function binding; it actually replaces code and puts the instruction pointer of existing threads that were running that code into some similar location in the new code. (Which is pretty amazing, to be sure).
What's going on in Lisp code reloading is something a lot pedestrian; just new functions are replacing old ones. Thread which are in the middle of running the old functions continue with those ones. When the last thread is done executing a function, it can be garbage collected.
- pjmlp 3y agoIt used to be like that, however the new hot code reload uses an improved approach, althought it still isn't Lisp/Smalltalk.
- Thiez 3y agoEditing code live in production should not be part of your workflow, so kind of a pointless feature. I don't work with life-critical software and yet auditors demand that every code-change to production is peer reviewed and linked to a jira item.
- dietrichepp 3y agoTo be clear, I’m not describing “editing live in production” as the workflow. The workflow is editing code live on your development machine, committing the changes, and going through the normal code review + CI/CD pipeline you’d set up for any other project. Something like Fix & Continue in Visual Studio is good for testing out smaller changes. By comparison, something like SLIME + Lisp is powerful enough to use for developing new features. The running system on your developer workstation is mostly synchronized with the source code on disk because the interface you use for making changes is the editor. This synchronization is not perfect, but that’s why you have your unit tests and CI/CD pipeline.
- kazinator 3y agoTicketed and peer-reviewed fixes can be deployed live in production as if they were live code edits. Technically it is the same thing; it's just a process difference.
- pjmlp 3y agoTell that to JPL.
- NavinF 3y ago> puts the instruction pointer of existing threads that were running that code into some similar location in the new code If you're implying that this isn't thread safe, you're wrong. Edit and continue works just like how you described Lisp code reloading. Works just fine in production if you're crazy enough to push a debug build. I dunno why Lisp people keep advertising ancient and widely distributed tech as revolutionary. Eg have you looked at LLVM XRay? It's yet another "self modifying C code hack", except it's explicitly designed to work in production on release builds: https://llvm.org/docs/XRay.html https://llvm.org/docs/XRay.html