Extandable bytecode
We shell compile a program into extendable portable byte-code, preserving as much as possible information from the source code; a description of extensions will define how to express it through a low-level instructions, or such extensions can be compiled (during installation) by a target-specific compiler into efficient native code, if the runtime and hardware supports it directly.
This will allow us to
- preserve as much as possible information from the source code; encoded as extensions, semantic nodes of the extendable code will be available to compilers directly, so it will not need to guess what did a programmer mean, to compile the program into most optimized native code.
- having descriptions of fall-back rewriting of extensions via low-level instructions will allow executing the code on different targets, compiling with full optimization for the hardware which supports these extensions directly, or less efficiently for less capable hardware or runtime.
- the same extension may have multiple fall-back rewriting descriptions, suitable for different target hardware or runtime; also target-specific compilers may compile the same generic extension into most optimal representation for a given hardware.
- compilation and verification of portable bytecode can be split between hast and target hardware; for instance, most weak and cheap consumer devices may not be able to verify and compile the code, relaying completely on host compilation; more powerful devices may have simple compilers for target-specific bytecode, prepared by host compiler from portable bytecode; most powerful computers may have JIT/AOT compilers which will compile the program into native directly from portable bytecode; in overall it will allow to improve scalability and minimize hardware requirements for consumer electronics.
- a target-specific compiler, knowing everything about current computer (installed hardware – CPU and co-processors, bus width, memory limitations; assignment of the computer – a dedicated server, an application server, a multi-purpose computer or electronic device) can choose the best strategy and provide most efficient executable for the current target and so on.