Skip to content

feat: simd support #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: next
Choose a base branch
from
112 changes: 56 additions & 56 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ default-members=[".", "crates/tinywasm", "crates/types", "crates/parser"]
resolver="2"

[workspace.dependencies]
wast="226"
wat="1.226"
wasmparser={version="0.226", default-features=false}
wast="228"
wat="1.228"
wasmparser={version="0.228", default-features=false}
eyre="0.6"
log="0.4"
pretty_env_logger="0.5"
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl FromStr for WasmArg {
"i64" => val.parse::<i64>().map_err(|e| format!("invalid argument value for i64: {e:?}"))?.into(),
"f32" => val.parse::<f32>().map_err(|e| format!("invalid argument value for f32: {e:?}"))?.into(),
"f64" => val.parse::<f64>().map_err(|e| format!("invalid argument value for f64: {e:?}"))?.into(),
"v128" => val.parse::<i128>().map_err(|e| format!("invalid argument value for v128: {e:?}"))?.into(),
t => return Err(format!("Invalid arg type: {t}")),
};

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use argh::FromArgs;
use args::WasmArg;
use eyre::Result;
use log::{debug, info};
use tinywasm::{types::WasmValue, Module};
use tinywasm::{Module, types::WasmValue};

use crate::args::to_wasm_args;
mod args;
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/wat.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use wast::{
parser::{self, ParseBuffer},
Wat,
parser::{self, ParseBuffer},
};

pub fn wat2wasm(wat: &str) -> Vec<u8> {
Expand Down
1 change: 1 addition & 0 deletions crates/parser/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ pub(crate) fn process_const_operators(ops: OperatorsReader<'_>) -> Result<ConstI
wasmparser::Operator::I64Const { value } => Ok(ConstInstruction::I64Const(*value)),
wasmparser::Operator::F32Const { value } => Ok(ConstInstruction::F32Const(f32::from_bits(value.bits()))),
wasmparser::Operator::F64Const { value } => Ok(ConstInstruction::F64Const(f64::from_bits(value.bits()))),
wasmparser::Operator::V128Const { value } => Ok(ConstInstruction::V128Const(value.i128())),
wasmparser::Operator::GlobalGet { global_index } => Ok(ConstInstruction::GlobalGet(*global_index)),
op => Err(crate::ParseError::UnsupportedOperator(format!("Unsupported const instruction: {op:?}"))),
}
Expand Down
8 changes: 5 additions & 3 deletions crates/parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,18 @@ impl Parser {
gc_types: true,
stack_switching: false,
component_model: false,
component_model_nested_names: false,
component_model_values: false,
exceptions: false,
gc: false,
memory_control: false,
relaxed_simd: false,
threads: false,
shared_everything_threads: false,
legacy_exceptions: false,
component_model_async: false,
cm_async: false,
cm_async_builtins: false,
cm_async_stackful: false,
cm_nested_names: false,
cm_values: false,
};
Validator::new_with_features(features.into())
}
Expand Down
Loading