Block Compiles to greater than 1K bytes of code Walkback

Bert Freudenberg bert at
Thu May 20 13:25:17 UTC 2004

Am 20.05.2004 um 05:09 schrieb Lynn Hales:

> Hello squeak-dev,
>   I know I shouldn't have a block anywhere near as large as 1K bytes of
>   code but I do and need a little more before I begin refactoring.
>   I have tried to edit BlockNode(ParseNode)>>emitLong:code:on to no
>   avail.  Can someone tell me where I need to make changes to have
>   larger compiled blocks.

In the current interpreter, you would have to introduce a new bytecode 
that allows unconditional jumps > 1K. If you look at the bytecode, 
you'll notice that right before a block, a jump is performed to skip 
the actual block. Since the #longUnconditionalJump bytecode uses 11 
bits for the offset, you can only jump to addresses +/- 1024 bytes 
away. There are still 2 reserved bytecodes which you could use for this 
purpose (but please do not release such a modified VM to the public).

Another option would be to use the experimental block closure VM, which 
I assume allows larger blocks.

But honestly - why can't you stash some of the huge block into an extra 
method? 1K code really seems more than enough.

- Bert -

More information about the Squeak-dev mailing list