rune icon indicating copy to clipboard operation
rune copied to clipboard

feature: a bytecode format for units

Open udoprog opened this issue 4 years ago • 2 comments

Units have been designed so that they can be serialized. This can be used in the future cache a compilation or distribute units in bytecode format for later execution.

This task is to design a preliminary format which will probably be subject to change before becoming stable.

A unit contains:

  • A sequence of instructions, starting at 0x0.
  • A hash-to-function map.
  • A hash-to-type information map, which answers the question "what is this type hash?".
  • Zero-based collection of static strings, byte arrays, and object keys.

To allow for checking that a context is compatible to execute a unit, the format should also include:

udoprog avatar Sep 07 '20 07:09 udoprog

Since 216daa3125838204531c9c95c2af8308ab2677df Unit now implements Serialize and Deserialize. And there's a prototype implementation in rune_cli which uses bincode to cache the compilation unit.

udoprog avatar Sep 08 '20 19:09 udoprog

we could also emit a .rnu.map a file that contains a map of the functions, locations that could be used for debugging .. I would prefer that to be a separate file instead of been embedded into the .rnu that would be similar to typescript source maps

shekohex avatar Sep 09 '20 10:09 shekohex