instance of a block context from #mustBeBoolean (was: Re: source code of a block context)

Rob Withers reefedjib at yahoo.com
Thu Aug 11 18:38:57 UTC 2005


On Aug 11, 2005, at 1:23 AM, Marcus Denker wrote:
> Am 11.08.2005 um 04:50 schrieb Rob Withers:
>
>> Hi,
>>
>> I have a related question, that I have been recently struggling with. 
>>   Short of removing the ifTrue:ifFalse: bytecodes from the VM and the 
>> compiler, I am trying to write a #mustBeBoolean method and find the 
>> boolean protocol sent (#ifTrue:) and the block.  Then I am going to 
>> resend it with #perform:with:.  I reached through the methodNode and 
>> got the selector.  I can't find the block argument, however.  Is it 
>> lost because the #mustBeBoolean overwrote the frame for #ifTrue:?
>
> there is no frame for ifTrue:, we inline ifTrue to jumps because we 
> then don't need a frame.

That is most unfortunate.  The blocks are lost  off the stack and I 
will have to change the vm and/or the compiler to stop the inlining.


>> mustBeBoolean
>>     | ctx msgNode sel |
>>     ctx := thisContext sender.
>>     msgNode := ctx methodNode block statements at: ctx stackPtr.
>
> Is this mapping valid? stackPtr --> statement in the method that is
> executed. Why should it?

No, probably not.  It just happened to work when I was throwing it 
together.    I guess I need to use the pc with the sourceMap to find 
the current selector, since the Compiler and VM overwrote the original 
selector.   I guess I really don't like the VM changing reality like 
that.

thanks,
Rob



More information about the Squeak-dev mailing list