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

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



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

Attachment: OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


Follow-Ups:
[Gambas-user] Re: Script error 'jump too far' ????Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: [Gambas-user] Re: Script error 'jump too far' ????roberto.premoli@xxxxxxxxxx
References:
[Gambas-user] Script error 'jump too far' ????Brian G <brian@xxxxxxxxxxxxxxxx>