Hi Igor:
On 14 Aug 2013, at 19:26, Jecel Assumpcao Jr. jecel@merlintec.com wrote:
Igor Stasenko wrote:
yes, but you need to know how to map existing activations (which optimized stack frames), back to smalltalk contexts. if you can do it, the rest is trivial.. but that's the question: imagine you interrupting machine code at random point:
- now, how to match it with smalltalk piece of code/AST node?
A popular solution is to not allow the machine code to be interrupted at random points. In the Self VM, for example, you have two defined "safe points": at message sends and at the backwards jump at the end of a loop without any message sends. The mapping of the optimized stack frames to the language level contexts only has to be possible at these points and can be arbitrarily complicated between them.
I tend to agree with Jecel. I belief that it is not only popular, but probably the only really maintainable solution. The GC literature is full of approaches how to figure out what's included in the root set. And having to maintain information about which registers or stack slots are live for a given machine code fragment is quite a bit of overhead. I would guess, that's true for maintaining code-to-code mapping information for highly optimized code as well. So safepoints seem to be a comparably simple, low-overhead solution.
Best regards Stefan
-- Jecel
vm-dev@lists.squeakfoundation.org