From 0b3dc0eb015fadeee3d6417451e6951cb8a6d751 Mon Sep 17 00:00:00 2001
From: Henry Gressmann
Date: Sun, 3 Dec 2023 00:09:39 +0100
Subject: docs: update readme
Signed-off-by: Henry Gressmann
---
README.md | 9 +++++----
crates/parser/src/conversion.rs | 2 +-
crates/types/src/instructions.rs | 7 +++++--
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index edd188f..4548033 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
TinyWasm
- A tiny, interpreted WebAssembly Runtime written in Rust.
+ A tiny WebAssembly Runtime written in Rust.
@@ -11,10 +11,11 @@
# 🎯 Goals
+* Interpreted Runtime
* No unsafe code
-* Works on `no_std` (with `alloc` the feature and nightly cler)
-* Fully support WebAssembly MVP
-* Low Memory Usage
+* Works on `no_std` (with `alloc` the feature and nightly compiler)
+* Fully support WebAssembly MVP (1.0)
+* Low Memory Usage (less than 10kb)
* Fast Startup Time
* Preemptive multitasking support
diff --git a/crates/parser/src/conversion.rs b/crates/parser/src/conversion.rs
index ee30db9..86810a1 100644
--- a/crates/parser/src/conversion.rs
+++ b/crates/parser/src/conversion.rs
@@ -109,7 +109,7 @@ pub fn process_operators<'a>(
.targets()
.collect::, wasmparser::BinaryReaderError>>()?
.into_iter()
- .map(Instruction::Br),
+ .map(Instruction::BrLabel),
);
}
op => instructions.push(process_operator(&op)?),
diff --git a/crates/types/src/instructions.rs b/crates/types/src/instructions.rs
index dca99fe..2be0ce7 100644
--- a/crates/types/src/instructions.rs
+++ b/crates/types/src/instructions.rs
@@ -16,7 +16,9 @@ pub struct MemArg {
/// A WebAssembly Instruction
/// See https://webassembly.github.io/spec/core/binary/instructions.html
-/// Currently includes all instructions from the MVP (1.0) spec
+/// These are our own internal bytecode instructions so they may not match the spec exactly.
+/// Wasm Bytecode can map to multiple of these instructions.
+/// For example, `br_table` stores the jump lables in the following `br_label` instructions to keep this enum small.
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Instruction {
// Control Instructions
@@ -30,7 +32,8 @@ pub enum Instruction {
End,
Br(LabelAddr),
BrIf(LabelAddr),
- BrTable(u32), // not to spec, has to be followed by multiple Br instructions with labels
+ BrTable(u32), // has to be followed by multiple BrLabel instructions
+ BrLabel(LabelAddr),
Return,
Call(FuncAddr),
CallIndirect(TypeAddr, TableAddr),
--
cgit v1.3.1