[Q] Change running code?
tim at sumeru.stanford.edu
Thu Jan 30 18:02:41 UTC 2003
Bob Arning <arning at charm.net> appears to have written:
> On Thu, 30 Jan 2003 12:56:09 +0100 =?iso-8859-1?Q?Tobias_K=E4s?= <tobias.kaes at gmx.de> wrote:
> >Does anyone know what happens, if the implementation of a method is changed while it is executed? I'm interested inÊhow dynamic systems handle such situations, so if you know how it is done here, or have any ideas how it could be solved please tell me :)
> Changes to method implementation take effect when that method next begins execution. If the method was already running when the implementation changed, it will continue to run with the old version.
Within Squeak this is true. In a system with some variety of dynamic
translation it may not be entirely true, it will depend on the details
of the way things are cached. For example if a method is translated and
a pointer to that translation is held in some inline cache entry in a
calling method then one would have to make sure that the system
correctly flushes that caching when the subject method is recompiled.
Typically some primitive is called by the compiler code to do this. At
least, one hopes that it is :-)
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
You can't make a program without broken egos.
More information about the Squeak-dev