On Sun, Jun 02, 2013 at 06:13:28PM +0200, Holger Hans Peter Freyther wrote:

> I am trying to figure out where the -1 is coming from and when
> the context is changed but searching for sp and and -1 is not
> really helping. :) 

The BlockClosure>>#asContext: was changed in 2007 in git revision
51f4dffef9df9095e59801df57741bd1a9458fd3. 


diff --git a/kernel/BlkClosure.st b/kernel/BlkClosure.st
index ec17d2b..cd07652 100644
--- a/kernel/BlkClosure.st
+++ b/kernel/BlkClosure.st
@@ -167,13 +167,15 @@ creation of Processes from blocks.'>
         Note that the block has no home, so it cannot contain returns."
 
        <category: 'private'>
+       "parent ifNotNil: [parent inspect. parent method inspect]."
+
        ^BlockContext
            fromClosure: [
                | top |
                top := parent isNil
                    ifTrue: [nil]
                    ifFalse: [
-                       parent sp == 0 
+                       parent sp <= 0 
                            ifTrue: [parent receiver]
                            ifFalse: [parent at: parent sp]].
                self value. top]



this works around the problem but I don't understand enough of it.
When will the sp != 0 for the Interpreter? Where does the assumption
if parent sp != 0 => parent is at this position. Or why shouldn't
this code be inside the context class? if the receiver is burried in
the stack.. then the class should be able to find it self?

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to