From Spivey's Corner
Jump to: navigation, search

Thunder is a portable library for dynamic generation of machine code, with backends (so far) for the x86/amd64 (in both 32 and 64 bit mode), the ARM32 and (to come) the MIPS32. It presents an interface rather like a generic RISC(Reduced Instruction Set Computer) A style of computer design where there are multiple, identical registers, arithmetic instructions that operate between registers, and separate load and store instructions with a limited set of addressing modes. machine, and on each target generates the native instructions needed to realise each RISC operation.

Thunder was designed to support a JIT-based implementation of the Keiko stack machine, itself the target of the Oxford Oberon-2 compiler. It began as a re-implementation of GNU Lightning, but has evolved since. GNU Lightning supports fairly well applications where target registers are used for fixed tasks, but it does not work so well when the client is (like the Keiko JIT) able to allocate and use multiple general-purpose registers: in such cases, the compile-time simplifications assumed by the design of Lightning are less effective, and there is danger of significant code bloat.

Thunder can be downloaded from Bitbucket (, and there is a page here with a basic tutorial, another page that discusses a larger example, and a listing of the Thunder instruction set.

Personal tools