[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gambas-user] Re: Script error 'jump too far' ????


Le 03/03/2024 à 18:20, Brian G a écrit :

On 3/3/24 08:17, Brian G wrote:
I have started getting this error on my larger scripts

# Gambas module file : MMain:13575:14: Jump is too far

13575*:        wend
                    ^ Jump is too far


Any idea, is there a limit somewhere?

Benoit?

Ok I found this in the compiler, It seems to indicate that no single block of code can be larger than 32k when compiled?

void CODE_jump_length(ushort src, ushort dst)
{
     if (src >= (cur_func->ncode - 1))
         return;

     int diff = (int)dst - (int)src;

     if (diff < -32768 || diff > 32767)
         THROW("Jump is too far");

     if (cur_func->code[src] == C_BREAK)
        cur_func->code[src + 2] = (short)(diff - 3); //dst - (src + 2) - 1;
     else if (cur_func->code[src] == C_NOP)
         cur_func->code[src] = (short)diff; //dst - src;
     else
        cur_func->code[src + 1] = (short)(diff - 2); //dst - (src + 1) - 1;
}

I am guessing there is no work around for this?


No, this is a bytecode limit. This usually means that your function is far too big! Are your code written by hand or generated?

--
Benoît Minisini.

----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Follow-Ups:
Re: [Gambas-user] Re: Script error 'jump too far' ????brian <brian@xxxxxxxxxxxxxxxx>
References:
[Gambas-user] Script error 'jump too far' ????Brian G <brian@xxxxxxxxxxxxxxxx>
[Gambas-user] Re: Script error 'jump too far' ????Brian G <brian@xxxxxxxxxxxxxxxx>