GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
jit Performance Win

jit: Add support for computed gotos and block addresses in libgccjit

Libgccjit now supports computed gotos and block addresses, enabling JIT-compiled interpreters for dispatch loops.

Libgccjit has been extended with new functionality to support computed gotos and block addresses, under ABI version LIBGCCJIT_ABI_39. This enhancement introduces gcc_jit_block_get_address and gcc_jit_block_end_with_indirect_jump, exposing GNU C’s labels-as-values and indirect jump capabilities. This is particularly beneficial for JIT-compiled interpreters, allowing them to implement direct-threaded code tables for dispatch loops and state machines, potentially improving performance and flexibility.

In Details

Libgccjit has been updated to ABI version 39, introducing support for computed gotos and block addresses via gcc_jit_block_get_address and gcc_jit_block_end_with_indirect_jump. This enables the generation of code that utilizes labels-as-values (&&label) and indirect jumps (goto *expr;). These features are crucial for JIT-compiled interpreters aiming to implement direct-threaded code (DTC) dispatch tables, significantly improving the performance of state machines and interpreter dispatch loops by eliminating indirect branches.

For Context
libgccjit
A C API for GCC that allows programs to generate compiled code at runtime. It acts as a frontend to GCC's internal optimization and compilation infrastructure.
JIT
Just-In-Time compilation. A method of compiling code during program execution, rather than before. This allows for runtime optimizations based on actual usage.
Computed goto
A non-standard C language extension (supported by GCC) that allows a goto statement to jump to a label whose address is determined at runtime.
Direct-threaded code
An implementation technique for interpreters where the dispatch mechanism directly jumps to the next instruction handler in a table, often using computed gotos for efficiency.
ABI
Application Binary Interface. Defines how compiled code interacts at the binary level, including function calling conventions, data structures, and system calls. Changes to the ABI can break compatibility between different versions of a library.
Filed Under: jitcompilerperformanceinterpreter