Skip to content
This repository was archived by the owner on Oct 3, 2025. It is now read-only.

Commit ffb1e09

Browse files
chore: update deps, cleanup
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
1 parent 9d7c192 commit ffb1e09

File tree

10 files changed

+210
-173
lines changed

10 files changed

+210
-173
lines changed

Cargo.lock

Lines changed: 191 additions & 147 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,3 @@ opt-level=3
3737
lto="thin"
3838
codegen-units=1
3939
debug=true
40-
41-
[patch.crates-io]
42-
# https://github.com/servo/pathfinder/pull/548 & https://github.com/servo/pathfinder/issues/558
43-
pathfinder_simd={git="https://github.com/servo/pathfinder", rev="30419d07660dc11a21e42ef4a7fa329600cff152"}

benchmarks/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition.workspace=true
77
criterion={version="0.5", features=["html_reports"]}
88
tinywasm={path="../crates/tinywasm"}
99
wat={version="1"}
10-
wasmi={version="0.31", features=["std"]}
10+
wasmi={version="0.32", features=["std"]}
1111
wasmer={version="4.3", features=["cranelift", "singlepass"]}
1212
argon2={version="0.5"}
1313

crates/parser/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl Parser {
9292
return Err(ParseError::EndNotReached);
9393
}
9494

95-
reader.to_module()
95+
reader.into_module()
9696
}
9797

9898
#[cfg(feature = "std")]
@@ -132,7 +132,7 @@ impl Parser {
132132
reader.process_payload(payload, &mut validator)?;
133133
buffer.drain(..consumed);
134134
if eof || reader.end_reached {
135-
return reader.to_module();
135+
return reader.into_module();
136136
}
137137
}
138138
};
@@ -144,6 +144,6 @@ impl TryFrom<ModuleReader> for TinyWasmModule {
144144
type Error = ParseError;
145145

146146
fn try_from(reader: ModuleReader) -> Result<Self> {
147-
reader.to_module()
147+
reader.into_module()
148148
}
149149
}

crates/parser/src/module.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,12 @@ impl ModuleReader {
179179
}
180180

181181
#[inline]
182-
pub(crate) fn to_module(self) -> Result<TinyWasmModule> {
182+
pub(crate) fn into_module(self) -> Result<TinyWasmModule> {
183183
if !self.end_reached {
184184
return Err(ParseError::EndNotReached);
185185
}
186186

187-
let local_function_count = self.code.len();
188-
189-
if self.code_type_addrs.len() != local_function_count {
187+
if self.code_type_addrs.len() != self.code.len() {
190188
return Err(ParseError::Other("Code and code type address count mismatch".to_string()));
191189
}
192190

@@ -199,13 +197,14 @@ impl ModuleReader {
199197
locals,
200198
ty: self.func_types.get(ty_idx as usize).expect("No func type for func, this is a bug").clone(),
201199
})
202-
.collect::<Vec<_>>();
200+
.collect::<Vec<_>>()
201+
.into_boxed_slice();
203202

204203
let globals = self.globals;
205204
let table_types = self.table_types;
206205

207206
Ok(TinyWasmModule {
208-
funcs: funcs.into_boxed_slice(),
207+
funcs,
209208
func_types: self.func_types.into_boxed_slice(),
210209
globals: globals.into_boxed_slice(),
211210
table_types: table_types.into_boxed_slice(),

crates/tinywasm/src/runtime/stack/block_stack.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
use crate::{cold, unlikely, Error, Result};
22
use alloc::vec::Vec;
33

4-
#[derive(Debug, Clone)]
4+
#[derive(Debug)]
55
pub(crate) struct BlockStack(Vec<BlockFrame>);
66

7-
impl BlockStack {
8-
pub(crate) fn new() -> Self {
7+
impl Default for BlockStack {
8+
fn default() -> Self {
99
Self(Vec::with_capacity(128))
1010
}
11+
}
1112

13+
impl BlockStack {
1214
#[inline(always)]
1315
pub(crate) fn len(&self) -> usize {
1416
self.0.len()
@@ -50,7 +52,7 @@ impl BlockStack {
5052
}
5153
}
5254

53-
#[derive(Debug, Clone, Copy)]
55+
#[derive(Debug)]
5456
pub(crate) struct BlockFrame {
5557
pub(crate) instr_ptr: usize, // position of the instruction pointer when the block was entered
5658
pub(crate) end_instr_offset: u32, // position of the end instruction of the block
@@ -69,10 +71,7 @@ pub(crate) struct BlockFrame {
6971
pub(crate) ty: BlockType,
7072
}
7173

72-
impl BlockFrame {}
73-
74-
#[derive(Debug, Copy, Clone)]
75-
#[allow(dead_code)]
74+
#[derive(Debug)]
7675
pub(crate) enum BlockType {
7776
Loop,
7877
If,

crates/tinywasm/src/runtime/stack/call_stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl CallStack {
3737
}
3838
}
3939

40-
#[derive(Debug, Clone)]
40+
#[derive(Debug)]
4141
pub(crate) struct CallFrame {
4242
pub(crate) instr_ptr: usize,
4343
pub(crate) block_ptr: u32,

crates/tinywasm/src/runtime/stack/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ pub(crate) struct Stack {
1616

1717
impl Stack {
1818
pub(crate) fn new(call_frame: CallFrame) -> Self {
19-
Self { values: ValueStack::default(), blocks: BlockStack::new(), call_stack: CallStack::new(call_frame) }
19+
Self { values: ValueStack::default(), blocks: BlockStack::default(), call_stack: CallStack::new(call_frame) }
2020
}
2121
}

crates/tinywasm/src/runtime/stack/value_stack.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ impl ValueStack {
6868
self.stack.end >= 2 && self.stack.end <= self.stack.data.len(),
6969
"invalid stack state (should be impossible)"
7070
);
71-
7271
self.stack.data[self.stack.end - 2] =
7372
func(self.stack.data[self.stack.end - 2], self.stack.data[self.stack.end - 1]);
7473

crates/types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ pub enum ElementKind {
307307
Declared,
308308
}
309309

310-
#[derive(Debug, Clone, PartialEq)]
310+
#[derive(Debug, Clone, Copy, PartialEq)]
311311
#[cfg_attr(feature = "archive", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize), archive(check_bytes))]
312312
pub enum ElementItem {
313313
Func(FuncAddr),

0 commit comments

Comments
 (0)