rune-rs / rune

An embeddable dynamic programming language for Rust.
https://rune-rs.github.io
Apache License 2.0
1.76k stars 89 forks source link

feature: a bytecode format for units #25

Open udoprog opened 4 years ago

udoprog commented 4 years ago

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:

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

udoprog commented 4 years ago

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.

shekohex commented 4 years ago

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