[Gambas-user] Are "On ... Gosub" implemented with a jump table?

Fabien Bodard gambas.fr at gmail.com
Wed May 22 12:00:18 CEST 2019


can I delete my previous mail ? (yes I know we can't ... arf)  :'(

... I've misunderstood the Cedron mail ... sorry... I apologize

Le mer. 22 mai 2019 à 10:11, Tobias Boege <taboege at gmail.com> a écrit :

> On Tue, 21 May 2019, Cedron Dawg wrote:
> > In other words are they efficient or syntax sugar?
> >
>
> If you compile a project with `gbc3 -av` you recompile all classes and
> do it verbosely. This will emit the generated bytecode in plain text.
> There you can see that the "On" part of the instruction compiles to an
> inline jump table. That's as far as I looked.
>
> Next step would be to go into main/gbx/gbx_exec_loop.c and trace the
> implementation of that instruction from the big bytecode jump_table,
> if you *really* care about what it does exactly.
>
> Anyway, it's not syntactic sugar. It's a dedicated instruction.
> Interestingly, in the bytecode, the ON part seems to do the jumping
> and the GOSUB part afterwards just handles the "fall-through" case.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>


-- 
Fabien Bodard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190522/aec4284d/attachment.html>


More information about the User mailing list