Computed goto (or labels as values) in Julia?

No we currently don’t have computed goto. Though it is used in flisp and the GC.

Your current usage shouldn’t need it though. LLVM should be smart enough to lower the branch into a switch and that’ll be equivalent (or better than) what you want to change to (it’s much easier for the compiler to find the target array). For the two advantages mentioned in that blog post, the first one doesn’t apply and should also be possible with an assume function. The second one is basically jump threading. Since you aren’t doing that here, LLVM might do that for you and it’s a less useful optimization on modern hardware, I don’t think it’ll make a huge difference.

1 Like