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

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


Il 03.03.2024 18:20 Brian G ha scritto:

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?

-- ~~~~ Brian

il the block of code is too much long, try to reduce it as follow: find some "logical block" that can be reformatted as function and move them outside the main block of code that will became smaller in this way and nto trigger the 32K limit.

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

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