summaryrefslogtreecommitdiff
path: root/crates/types/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/types/src')
-rw-r--r--crates/types/src/instructions.rs9
-rw-r--r--crates/types/src/lib.rs9
2 files changed, 17 insertions, 1 deletions
diff --git a/crates/types/src/instructions.rs b/crates/types/src/instructions.rs
index d8aff7b..3f7b2ef 100644
--- a/crates/types/src/instructions.rs
+++ b/crates/types/src/instructions.rs
@@ -19,6 +19,15 @@ type BrTableLen = usize;
type EndOffset = usize;
type ElseOffset = usize;
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub enum ConstInstruction {
+ I32Const(i32),
+ I64Const(i64),
+ F32Const(f32),
+ F64Const(f64),
+ GlobalGet(GlobalAddr),
+}
+
/// A WebAssembly Instruction
///
/// These are our own internal bytecode instructions so they may not match the spec exactly.
diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs
index b7bf623..ddc8ce4 100644
--- a/crates/types/src/lib.rs
+++ b/crates/types/src/lib.rs
@@ -52,9 +52,9 @@ pub struct TinyWasmModule {
/// The exports of the WebAssembly module.
pub exports: Box<[Export]>,
+ pub globals: Box<[Global]>,
// pub tables: Option<TableType>,
// pub memories: Option<MemoryType>,
- // pub globals: Option<GlobalType>,
// pub elements: Option<ElementSectionReader<'a>>,
// pub imports: Option<ImportSectionReader<'a>>,
// pub data_segments: Option<DataSectionReader<'a>>,
@@ -293,3 +293,10 @@ pub struct Export {
/// The index of the exported item.
pub index: u32,
}
+
+#[derive(Debug, Clone)]
+pub struct Global {
+ pub mutable: bool,
+ pub ty: ValType,
+ pub init: ConstInstruction,
+}