[Cuis-dev] Error: genJumpLong: distance index is out of range

Nicolás Papagna Maldonado nicolas.papagna at gmail.com
Fri Jan 29 05:58:24 PST 2021


Yay! Tried compiling the method with optimizations turned off (essentially
forcing the message send instead of inlining) and it worked fine.

Thanks for the pointers and the quick response, this was really helpful.

Cheers,
Nico PM


On Fri, Jan 29, 2021 at 10:24 AM Nicolas Cellier via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> It's a limitation of bytecodes. There are possible workarounds, like
> splitting the jump in several pieces... Very technical, and will fool the
> decompiler and the debugger. If closures bytecodes are stored separately
> then it's also possible to un-optimize the block (do not inline but just
> use a message send).
>
> Le ven. 29 janv. 2021 à 13:33, Nicolás Papagna Maldonado via Cuis-dev <
> cuis-dev at lists.cuis.st> a écrit :
>
>> Aloha folks,
>>
>> I was making some changes to Code Coverage and ran into this compiler
>> error while I was trying to re-compile a method with code coverage tracing
>> added to it.
>> In short, Code Coverage wraps each message send in a block and calls a
>> special selector on it that evaluates it and register code coverage
>> information of the wrapped collaborations.
>>
>> I've found that for some methods the "genJumpLong: distance index is out
>> of range" and I quite don't understand why.
>> In this case "emitCodeForWhile: stack encoder: encoder value: forValue"
>> is called, which in turn calls "emitCodeForJump: dist encoder: encoder",
>> which ends up raising the error a couple stack frames later.
>>
>> As far as I understand, it looks like "the body of the while loop was
>> long enough to make the compiler unable to generate the jump". But that's
>> all I got :)
>>
>> Do you have any pointers about how to avoid this altogether?
>> It's kind of a blocker to me, as there are some methods that cannot be
>> analyzed by Code Coverage right now.
>>
>> Thanks in advance!
>> Nico PM
>>
>> --
>> Cuis-dev mailing list
>> Cuis-dev at lists.cuis.st
>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 

Nicolás Papagna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210129/5a822aca/attachment.htm>


More information about the Cuis-dev mailing list