Skip to content

Commit c1a8cfa

Browse files
Merge pull request #39 from explodingcamera/feat/simd
initial simd support
2 parents 1252a89 + 3664c8b commit c1a8cfa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+714
-142
lines changed

Cargo.lock

+56-56
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ default-members=[".", "crates/tinywasm", "crates/types", "crates/parser"]
44
resolver="2"
55

66
[workspace.dependencies]
7-
wast="226"
8-
wat="1.226"
9-
wasmparser={version="0.226", default-features=false}
7+
wast="229"
8+
wat="1.229"
9+
wasmparser={version="0.229", default-features=false}
1010
eyre="0.6"
1111
log="0.4"
1212
pretty_env_logger="0.5"

crates/cli/src/args.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ impl FromStr for WasmArg {
2525
"i64" => val.parse::<i64>().map_err(|e| format!("invalid argument value for i64: {e:?}"))?.into(),
2626
"f32" => val.parse::<f32>().map_err(|e| format!("invalid argument value for f32: {e:?}"))?.into(),
2727
"f64" => val.parse::<f64>().map_err(|e| format!("invalid argument value for f64: {e:?}"))?.into(),
28+
"v128" => val.parse::<i128>().map_err(|e| format!("invalid argument value for v128: {e:?}"))?.into(),
2829
t => return Err(format!("Invalid arg type: {t}")),
2930
};
3031

crates/cli/src/bin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use argh::FromArgs;
44
use args::WasmArg;
55
use eyre::Result;
66
use log::{debug, info};
7-
use tinywasm::{types::WasmValue, Module};
7+
use tinywasm::{Module, types::WasmValue};
88

99
use crate::args::to_wasm_args;
1010
mod args;

crates/cli/src/wat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use wast::{
2-
parser::{self, ParseBuffer},
32
Wat,
3+
parser::{self, ParseBuffer},
44
};
55

66
pub fn wat2wasm(wat: &str) -> Vec<u8> {

crates/parser/src/conversion.rs

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ pub(crate) fn process_const_operators(ops: OperatorsReader<'_>) -> Result<ConstI
261261
wasmparser::Operator::I64Const { value } => Ok(ConstInstruction::I64Const(*value)),
262262
wasmparser::Operator::F32Const { value } => Ok(ConstInstruction::F32Const(f32::from_bits(value.bits()))),
263263
wasmparser::Operator::F64Const { value } => Ok(ConstInstruction::F64Const(f64::from_bits(value.bits()))),
264+
wasmparser::Operator::V128Const { value } => Ok(ConstInstruction::V128Const(value.i128())),
264265
wasmparser::Operator::GlobalGet { global_index } => Ok(ConstInstruction::GlobalGet(*global_index)),
265266
op => Err(crate::ParseError::UnsupportedOperator(format!("Unsupported const instruction: {op:?}"))),
266267
}

crates/parser/src/lib.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,19 @@ impl Parser {
7070
gc_types: true,
7171
stack_switching: false,
7272
component_model: false,
73-
component_model_nested_names: false,
74-
component_model_values: false,
7573
exceptions: false,
7674
gc: false,
7775
memory_control: false,
7876
relaxed_simd: false,
7977
threads: false,
8078
shared_everything_threads: false,
8179
legacy_exceptions: false,
82-
component_model_async: false,
80+
cm_async: false,
81+
cm_async_builtins: false,
82+
cm_async_stackful: false,
83+
cm_nested_names: false,
84+
cm_values: false,
85+
cm_error_context: false,
8386
};
8487
Validator::new_with_features(features.into())
8588
}

crates/parser/src/module.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl ModuleReader {
130130
return Err(ParseError::DuplicateSection("Code section".into()));
131131
}
132132
self.code.reserve(count as usize);
133-
validator.code_section_start(count, &range)?;
133+
validator.code_section_start(&range)?;
134134
}
135135
CodeSectionEntry(function) => {
136136
debug!("Found code section entry");

0 commit comments

Comments
 (0)