Skip to content

Add support for bytecode generation to cpm and IDE

Camil Staps requested to merge (removed):master into master

This adds support for generating binary and optimised ABC code to cpm and the IDE.

In target environments, four new options are added:

  • EnvironmentABCOptimise, path to the ABC optimiser (generates <module> from <module>.abc)
  • EnvironmentByteCodeGen, path to the bytecode generator (generates <module>.bc from <module>[.opt].abc)
  • EnvironmentByteCodeLink, path to the bytecode linker (generates one <application>.bc from all bytecode files)
  • EnvironmentByteCodeStrip, path to the bytecode stripper (strips an <application>.bc, overwriting that file)

In project files, four new options are added:

  • ByteCode, path to the main bytecode file to generate (result of the bytecode linker)
  • CodeGen/OptimiseABC, boolean indicating whether to generate optimised ABC code
  • CodeGen/GenerateByteCode, boolean indicating whether to generate bytecode
  • Link/StripByteCode, boolean indicating whether the bytecode stripper should be used


  • The default behaviour is unchanged: no bytecode is generated when these options are absent.
  • When ByteCode is non-empty but CodeGen/GenerateByteCode is false, some files may be missing which can lead to errors in the linking step.
  • If CodeGen/GenerateByteCode is true but CodeGen/OptimiseABC is false, we generate bytecode from the unoptimised ABC files. This has no real use case for now.
  • Link/StripByteCode should be false to use the serialization library, but can be true if you just want to run the interpreter stand-alone for example).
  • In the IDE one can set all project options except Link/StripBytecode, which has no real use case for now.
Edited by Camil Staps

Merge request reports