On 05.08.2009, at 13:18, Igor Stasenko wrote:
Yes, and the real solution of course is to change the VM to allocate less contexts and use the C-stack instead...
hmm, doesn't that breaks the smalltalk introspection capabilities, since then you can't see all the context objects which is used by interpreter for running your code? I want to point, that the way how VM allocating contexts is implementation details , and if it done correctly then you're still should be able to access all context objects.
the magic is to create these objects as soon as you look at them. e.g, a description for visualworks: http://pages.cs.wisc.edu/~cymen/misc/interests/oopsla99-contexts.pdf Of course, even though as soon as I look at a thisContext, there is an object, I will not see all possible contexts with #allInstances, but only those that where created because they are needed. In that way, the implementation level optimization is not completely hidden. And of course, #allInstances works even for MethodContext, as no MethodContexts are created in a normal execution of a method like aInstancesDo:. Marcus -- Marcus Denker - http://marcusdenker.de PLEIAD Lab - Computer Science Department (DCC) - University of Chile