[squeak-dev] Re: Why "context top" points to "tempVector" and not to variable value?

Denis Kudriashov dionisiydk at gmail.com
Wed May 11 13:40:07 UTC 2016


And here example with not empty stack but still confusing:

| t |[ t := 'test'] value.


2016-05-11 15:26 GMT+02:00 Bert Freudenberg <bert at freudenbergs.de>:

> [moving to squeak-dev since this does not appear to be a VM problem]
>
> I’d say it’s not only confusing, but actually wrong, since at that point
> the stack is empty. The context’s stackPtr is 1, equal to the method’s
> numTemps, so there is no valid stack top.
>
> Another confusing thing is that when you put these lines into a method and
> step into it, #(nil nil) will be on the stack. That’s because the context’s
> pc is 27, it just pushed the temp vector, but has not stored it yet:
>
> 25 <8A 02> push: (Array new: 2)
> 27 <68> popIntoTemp: 0
> 28 <10> pushTemp: 0
> 29 <8F 10 00 09> closureNumCopied: 1 numArgs: 0 bytes 33 to 41
> 33 <20> pushConstant: 'test'
> 34 <8E 00 00> popIntoTemp: 0 inVectorAt: 0
> 37 <21> pushConstant: 'test2'
> 38 <8D 01 00> storeIntoTemp: 1 inVectorAt: 0
> 41 <7D> blockReturn
> 42 <C9> send: value
> 43 <87> pop
> 44 <8C 01 00> pushTemp: 1 inVectorAt: 0
> 47 <D2> send: halt
> 48 <7C> returnTop
>
> Really the context should have been stepped over the temp vector
> initialization code … The way it is now, there is no “selection” at all,
> the first “step” in the debugger appears to do nothing.
>
> - Bert -
>
>
> On 11.05.2016, at 12:02, Denis Kudriashov <dionisiydk at gmail.com> wrote:
>
> I found reason about it.
> When message send executed it pops receiver from current stack.
>
> But anyway it is very confusing to not see receiver as stack top in
> debugger. Maybe extra field "current receiver" should be added to debugger
> in that case
>
> 2016-05-11 11:51 GMT+02:00 Denis Kudriashov <dionisiydk at gmail.com>:
>
>> Here better example to see problem:
>>
>> | t d |
>> [ t := 'test'.
>> d := 'test2' ] value.
>> t.
>> ^ d halt
>>
>>
>> Stack top here will show #('test' test2') which is completely confusing
>>
>> 2016-05-11 11:45 GMT+02:00 Denis Kudriashov <dionisiydk at gmail.com>:
>>
>>> Hi.
>>>
>>> Try to debug following script:
>>>
>>> | t |
>>> [ t := 'test' ] value.
>>> ^ t halt
>>>
>>>
>>> You will see in debugger #('test') as stack top value. Why it is not
>>> 'test'?
>>> I understand that hidden arrays used for variables which are used in
>>> closures. But why "context top" in that cases points to vector instead of
>>> variable value?
>>>
>>> Best regards,
>>> Denis
>>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160511/46a3d387/attachment.htm


More information about the Squeak-dev mailing list