It would be nice if a simulator for the GC could be built. A simple language could be constructed that would allow the user to script allocations and pointer manipulations. As a consequence of these the GC at the back would respond. It would be nice if some could create this language and a simple runtime for it that would provide the user with a debug kind of prompt.
At this prompt the user can go onto do things like load a program for simulation, execute the next line, list the status of the various data structures used by the GC etc.
A brief description of the language I have in mind would be like:
a = alloc 100
a.x = alloc 10
y = a.x
gc collect
a.x = 0
gc collect
y = 0
gc collect
These would be a some of the statement types/syntaxes that could be implemented.
//allocation and manipulation statements
<statement> = <ptr> '=' <value>
<ptr> = string dot <ptr> | string
<value> = <ptr> | 0 | 'alloc' number | <wref type> 'wref' <ptr>
<wref type> = 'short' | 'long'
//gc related statements
<statement> = 'gc' <gc command>
<gc command> = 'collect' <number> | 'finalise' <ptr>
//other
<statement> = 'end'
Now the debugger could be built to display a little command prompt. At the command prompt one must have commands to do the following :
If you want to give this a shot, let me know
[contact me]