[Oberon] Oberon for a C++ user.
chris
chris at gcjd.org
Thu Oct 6 20:31:28 CEST 2016
On Thu, 6 Oct 2016 16:15:46 +0000, Skulski, Wojciech wrote:
> 1. Find all the references to the old (still loaded) code.
> 2. Get rid of the references.
That's the problem. How do you get rid of the references in procedure
variables?
Normal garbage collection does not deallocate the memory until all
references to the memory block have vanished by the usual progress of
the program. Until that has happened the old code is still available
unless you do anything to eliminate the references.
> Now you are ready to load the fresh code. At any given time there is
> only one copy of the code loaded to RAM. Since all is being done by
> the GC, and the machine is a single threaded machine with no
> preemption, it is not possible to interrupt the process.
That's not what I meant. The garbage collector in it's standard way
does not remove any references; it just checks them and deallocates
only heap blocks that don't have any references anymore.
If there are still references and you reload a modified module again
you have two incarnations of the module in the system.
In the end I see these possibilities.
1. Don't care, just unload like it currently is.
2. Check for references and don't unload if there are any.
3. Unload only removes the module from the module list. Check for
references and unload the code later from the garbage collector when no
references exist anymore.
4. Check for references and set them to NIL then unload.
5. Even more complicated ideas: like reload and unload in one step to
replace the references to the same procedures in the new module, a kind
of dynamic relinking.
I don't really suggest this, because this causes new problems if the
new module does not have the same procedures as the old one and binding
is done by name things get really messy.
I hope I have explained it better now. And obviously the problem is not
so easy to solve not because of it's implementation but because it's
not obvious how it should work correct.
Greetings, chris
More information about the Oberon
mailing list