wren-lang / wren

The Wren Programming Language. Wren is a small, fast, class-based concurrent scripting language.
http://wren.io
MIT License
6.86k stars 549 forks source link

Save (and load) compiled bytecode? #535

Open jockm opened 6 years ago

jockm commented 6 years ago

I am looking to use Wren on a microcontroller. I have done a quick and dirty test to prove that it runs and that reasonable enough scripts can run within the limited memory, however since I want to load scripts from an SD card I am left with an issue:

I am giving the VM 50K (out of 64), but that means I don't have a lot of space left over for buffers and strings and such.

So what I would really like is a way to stream compiled bytecode into the system.


I may try an tackle this myself. It occurs to me that the "cheap and easy" way to tackle this might be to load and compile the source, and then save the VM as a binary that can be loaded. This isn't as ideal as having a wrenc compiler (ala luac), but it would be a useful first step.

Are there any impediments to this working, such as address fixups when saving/loading or the like?

whoozle commented 6 months ago

:+1: I'm really keen to have it as well - I'd really like to ship binary code to the production.