Yes, I missed that bit. the generated function numbers don't give much of a clue as to what to look for.
This is definitly a good stratergy early on in a language project, but you might find that it for long-running programs it either runs out of memory anyway or does not scale due to the runtime cost of serialisation. There are two systems that I know of that do something similar. allocate memory using a heap pointer and occasionally reset the pointer.
The first is Prolog. In Prolog a call can succeed or fail, if it fails it produces no results and it is trivial to reset the heap pointer as a means of reducing pressure on the GC. This is called "reclaimation on failure". This is a smart idea it reduces the amount of work that a collector needs to do but still requires a collector.
The other was some early LISP systems that performed some heap compacting at the end of all (or most?) function calls (I don't know the details). I also don't know if they copied from the stack onto the heap at the end of a function call or if they simply compacted the heap. This strategy does not require a collector but from what I understand it has higher overheads than most modern collectors.
I do worry a bit about managing the cost of serialization. My intuition is that it's going to be okay but only time will tell.
I also feel that immutability is going to be a decisive factor that will allow me to pull off optimizations that no traditional Lisp system could attempt. Again, time will tell how the trade-offs play out.
Regarding long-running programs: I should mention that I also plan to use the pointer-reset trick for loops that are entirely for side-effects. That means that your typical event-loop will always start an iteration with the same allocation pointer.
View all comments
Show parent comment
2
u/PaulBone Plasma Oct 03 '16
Yes, I missed that bit. the generated function numbers don't give much of a clue as to what to look for.
This is definitly a good stratergy early on in a language project, but you might find that it for long-running programs it either runs out of memory anyway or does not scale due to the runtime cost of serialisation. There are two systems that I know of that do something similar. allocate memory using a heap pointer and occasionally reset the pointer.
The first is Prolog. In Prolog a call can succeed or fail, if it fails it produces no results and it is trivial to reset the heap pointer as a means of reducing pressure on the GC. This is called "reclaimation on failure". This is a smart idea it reduces the amount of work that a collector needs to do but still requires a collector.
The other was some early LISP systems that performed some heap compacting at the end of all (or most?) function calls (I don't know the details). I also don't know if they copied from the stack onto the heap at the end of a function call or if they simply compacted the heap. This strategy does not require a collector but from what I understand it has higher overheads than most modern collectors.
Good luck.