Next: , Previous: Common features, Up: Standard macros


3.4.3 Supporting scheduling of delay slots

Delay slot scheduling is obtained by clients through the jit_delay macro. However this macro is not to be defined in the platform-independent layer, because gnu lightning provides a common definition in core-common.h.

Instead, the platform-independent layer must define another macro, called jit_fill_delay_after, which has to exchange the instruction to be scheduled in the delay slot with the branch instruction. The only parameter accepted by the macro is a call to a branch macro, which must be expanded exactly once by jit_fill_delay_after. The client must be able to pass the return value of jit_fill_delay_after to jit_patch_at.

There are two possible approaches that can be used in jit_fill_delay_after. They are summarized in the following pictures:

Don't forget that you can take advantage of delay slots in the implementation of boolean instructions such as le or gt.