I can't say that i clearly understood your concept. But if it will
simplify implementation
without seemingly speed loss, i am all ears :)


test
    |b|
    [ |a|
      a + b ]

Suppose you can't compile anything away, then you get

|==============
|MethodContext
|
|a := ...
|==============
     ^
     |
|==============
|BlockContext
|
|b := ...
|==============

And you just look up starting at the current context and go up. Except if the var is from the homeContext, then you directly follow the home-context pointer. Since all contexts link to the home-context, this makes it 1 pointer indirection to get to the method's context. 1 for the parent context. So that makes only 2 indirections starting from the 3 nested block (so when you have [ ... [ ... [ ... ] ... ] ... ]; where all of them are required for storing captured data. ifTrue:ifFalse: etc blocks obviously don't count. And blocks without shared locals could be left out (although we might not do that, for debugging reasons).

Hope that helps.

cheers,
Toon

Reply via email to