Docs for valuescript_program_embed

This commit is contained in:
Andrew Morris
2023-03-10 13:27:21 +11:00
parent 4e77747ae6
commit 93496816a1

View File

@@ -6,6 +6,26 @@ pub fn main() {
let mut vm = VirtualMachine::new();
let result = vm.run(
&Rc::new(vec![
//
// This is the compiled bytecode for inputs/passing/projEuler/p28.ts.
//
// Using `RUSTFLAGS="-C opt-level=s" cargo build --release` it currently compiles to 534KiB.
// A program with just println!("Test") is 315KiB, so we might be able to get down to around
// 219KiB by simplifying the way we print the result.
//
// Since we're still in early development, the bytecode is subject to change, which means this
// bytecode might break.
//
// If you need to fix it, or use a different program, use vstc:
// vstc compile program.ts
// vstc assemble out.vsm
// # Output is in out.vsb. Use the xxd program (or otherwise) to see the bytes.
//
// Another option is to checkout the commit from when this was originally written:
// git checkout 4e77747ae67e0ef27f9841111058599c8e916a2f
// cargo build
// ./target/debug/valuescript_program_embed
//
0x0d, 0x05, 0x00, 0x0a, 0x00, 0x0b, 0x08, 0x00, 0x21, 0x0d, 0x9c, 0x00, 0x09, 0x09, 0x06,
0x01, 0x06, 0x09, 0x06, 0x19, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x7f, 0x40,
0x00, 0x02, 0x05, 0x0e, 0x02, 0x06, 0x01, 0x03, 0x21, 0x0d, 0x9c, 0x00, 0x09, 0x09, 0x06,