Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,198 changes: 574 additions & 624 deletions Cargo.lock

Large diffs are not rendered by default.

85 changes: 41 additions & 44 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,59 +9,56 @@ name = "componentize_py"
crate-type = ["cdylib", "rlib"]

[dependencies]
anyhow = { version = "1.0.75", features = ["backtrace"] }
clap = { version = "4.4.10", features = ["derive"] }
tar = "0.4.40"
tempfile = "3.8.1"
zstd = "0.13.0"
anyhow = { version = "1.0.86", features = ["backtrace"] }
clap = { version = "4.5.17", features = ["derive"] }
tar = "0.4.41"
tempfile = "3.12.0"
zstd = "0.13.2"
componentize-py-shared = { path = "shared" }
# TODO: switch to upstream release versions of these deps once
# https://github.com/bytecodealliance/wasm-tools/pull/1459 is merged and
# released:
wasm-encoder = { git = "https://github.com/dicej/wasm-tools", branch = "adapt-world-imports" }
wit-parser = { git = "https://github.com/dicej/wasm-tools", branch = "adapt-world-imports" }
wit-component = { git = "https://github.com/dicej/wasm-tools", branch = "adapt-world-imports" }
wasmparser = { git = "https://github.com/dicej/wasm-tools", branch = "adapt-world-imports" }
indexmap = "2.1.0"
wasm-encoder = "0.209.1"
wit-parser = "0.209.1"
wit-component = "0.209.1"
wasmparser = "0.209.1"
indexmap = "2.5.0"
bincode = "1.3.3"
heck = "0.4.1"
pyo3 = { version = "0.20.0", features = ["abi3-py37", "extension-module"], optional = true }
# TODO: switch to upstream release versions of these deps once
# https://github.com/bytecodealliance/wasm-tools/pull/1459 is merged and
# released, and Wasmtime has adopted those releases:
wasmtime = { git = "https://github.com/dicej/wasmtime", branch = "isyswasfa", features = ["component-model"] }
wasmtime-wasi = { git = "https://github.com/dicej/wasmtime", branch = "isyswasfa" }
wasi-common = { git = "https://github.com/dicej/wasmtime", branch = "isyswasfa" }
once_cell = "1.18.0"
component-init = { git = "https://github.com/dicej/component-init", rev = "70d4523b" }
wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "f4cb9b22" }
async-trait = "0.1.74"
futures = "0.3.29"
tokio = { version = "1.34.0", features = ["macros", "rt", "rt-multi-thread", "fs"] }
bytes = "1.5.0"
heck = "0.5.0"
pyo3 = { version = "0.20.0", features = [
"abi3-py37",
"extension-module",
], optional = true }
wasmtime = "22.0.0"
wasmtime-wasi = "22.0.0"
wasi-common = "22.0.0"
once_cell = "1.19.0"
component-init = { git = "https://github.com/dicej/component-init", rev = "8f25acd" }
wasm-convert = { git = "https://github.com/dicej/wasm-convert", rev = "dc76f82" }
async-trait = "0.1.82"
futures = "0.3.30"
tokio = { version = "1.40.0", features = [
"macros",
"rt",
"rt-multi-thread",
"fs",
] }
bytes = "1.7.1"
pretty_env_logger = "0.5.0"
cap-std = "2.0.0"
cap-std = "3.2.0"
im-rc = "15.1.0"
serde = { version = "1.0.193", features = ["derive"] }
toml = "0.8.8"
isyswasfa-transform = { git = "https://github.com/dicej/isyswasfa-transform", rev = "db4fb62d" }
semver = "1.0.22"
serde = { version = "1.0.209", features = ["derive"] }
toml = "0.8.19"
isyswasfa-transform = { git = "https://github.com/dicej/isyswasfa-transform", rev = "7f69d7a" }
semver = "1.0.23"

[dev-dependencies]
async-trait = "0.1.74"
once_cell = "1.18.0"
proptest = "1.4.0"
async-trait = "0.1.82"
proptest = "1.5.0"
hex = "0.4.3"

[build-dependencies]
anyhow = "1.0.75"
tar = "0.4.40"
zstd = "0.13.0"
anyhow = "1.0.86"
tar = "0.4.41"
zstd = "0.13.2"
test-generator = { path = "test-generator" }

[workspace]
members = [
"runtime",
"shared",
"test-generator",
]
members = ["runtime", "shared", "test-generator"]
8 changes: 4 additions & 4 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ version = "0.1.0"
edition = "2021"

[lib]
crate-type = [ "staticlib" ]
crate-type = ["staticlib"]

[dependencies]
anyhow = "1.0.75"
once_cell = "1.18.0"
anyhow = "1.0.86"
once_cell = "1.19.0"
pyo3 = { version = "0.20.0", features = ["abi3-py311", "num-bigint"] }
componentize-py-shared = { path = "../shared" }
num-bigint = "0.4.4"
num-bigint = "0.4.6"
wit-bindgen = "0.16.0"
8 changes: 4 additions & 4 deletions src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ pub fn has_pointer(resolve: &Resolve, ty: Type) -> bool {
| Type::Char
| Type::U64
| Type::S64
| Type::Float32
| Type::Float64 => false,
| Type::F32
| Type::F64 => false,
Type::String => true,
Type::Id(id) => match &resolve.types[id].kind {
TypeDefKind::Record(record) => record
Expand Down Expand Up @@ -174,12 +174,12 @@ pub fn abi(resolve: &Resolve, ty: Type) -> Abi {
align: 8,
flattened: vec![ValType::I64],
},
Type::Float32 => Abi {
Type::F32 => Abi {
size: 4,
align: 4,
flattened: vec![ValType::F32],
},
Type::Float64 => Abi {
Type::F64 => Abi {
size: 8,
align: 8,
flattened: vec![ValType::F64],
Expand Down
32 changes: 16 additions & 16 deletions src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,14 @@ impl<'a> FunctionBindgen<'a> {
*IMPORTS.get("componentize-py#ToCanonI64").unwrap(),
));
}
Type::Float32 => {
Type::F32 => {
self.push(Ins::LocalGet(context));
self.push(Ins::LocalGet(value));
self.push(Ins::Call(
*IMPORTS.get("componentize-py#ToCanonF32").unwrap(),
));
}
Type::Float64 => {
Type::F64 => {
self.push(Ins::LocalGet(context));
self.push(Ins::LocalGet(value));
self.push(Ins::Call(
Expand Down Expand Up @@ -896,12 +896,12 @@ impl<'a> FunctionBindgen<'a> {
self.to_canon(ty, context, value);
self.push(Ins::I64Store(mem_arg(0, 3)));
}
Type::Float32 => {
Type::F32 => {
self.push(Ins::LocalGet(destination));
self.to_canon(ty, context, value);
self.push(Ins::F32Store(mem_arg(0, 2)));
}
Type::Float64 => {
Type::F64 => {
self.push(Ins::LocalGet(destination));
self.to_canon(ty, context, value);
self.push(Ins::F64Store(mem_arg(0, 3)));
Expand Down Expand Up @@ -1188,12 +1188,12 @@ impl<'a> FunctionBindgen<'a> {
self.push(Ins::LocalGet(source[0]));
self.push(Ins::I64Store(mem_arg(0, 3)));
}
Type::Float32 => {
Type::F32 => {
self.push(Ins::LocalGet(destination));
self.push(Ins::LocalGet(source[0]));
self.push(Ins::F32Store(mem_arg(0, 2)));
}
Type::Float64 => {
Type::F64 => {
self.push(Ins::LocalGet(destination));
self.push(Ins::LocalGet(source[0]));
self.push(Ins::F64Store(mem_arg(0, 3)));
Expand Down Expand Up @@ -1431,14 +1431,14 @@ impl<'a> FunctionBindgen<'a> {
*IMPORTS.get("componentize-py#FromCanonI64").unwrap(),
));
}
Type::Float32 => {
Type::F32 => {
self.push(Ins::LocalGet(context));
self.push(Ins::LocalGet(value[0]));
self.push(Ins::Call(
*IMPORTS.get("componentize-py#FromCanonF32").unwrap(),
));
}
Type::Float64 => {
Type::F64 => {
self.push(Ins::LocalGet(context));
self.push(Ins::LocalGet(value[0]));
self.push(Ins::Call(
Expand Down Expand Up @@ -1761,15 +1761,15 @@ impl<'a> FunctionBindgen<'a> {
self.from_canon(ty, context, &[value]);
self.pop_local(value, ValType::I64);
}
Type::Float32 => {
Type::F32 => {
let value = self.push_local(ValType::F32);
self.push(Ins::LocalGet(source));
self.push(Ins::F32Load(mem_arg(0, 2)));
self.push(Ins::LocalSet(value));
self.from_canon(ty, context, &[value]);
self.pop_local(value, ValType::F32);
}
Type::Float64 => {
Type::F64 => {
let value = self.push_local(ValType::F64);
self.push(Ins::LocalGet(source));
self.push(Ins::F64Load(mem_arg(0, 3)));
Expand Down Expand Up @@ -2051,11 +2051,11 @@ impl<'a> FunctionBindgen<'a> {
self.push(Ins::LocalGet(source));
self.push(Ins::I64Load(mem_arg(0, 3)));
}
Type::Float32 => {
Type::F32 => {
self.push(Ins::LocalGet(source));
self.push(Ins::F32Load(mem_arg(0, 2)));
}
Type::Float64 => {
Type::F64 => {
self.push(Ins::LocalGet(source));
self.push(Ins::F64Load(mem_arg(0, 3)));
}
Expand Down Expand Up @@ -2258,8 +2258,8 @@ impl<'a> FunctionBindgen<'a> {
| Type::Char
| Type::U64
| Type::S64
| Type::Float32
| Type::Float64 => {}
| Type::F32
| Type::F64 => {}

Type::String => {
self.push(Ins::LocalGet(value[0]));
Expand Down Expand Up @@ -2417,8 +2417,8 @@ impl<'a> FunctionBindgen<'a> {
| Type::Char
| Type::U64
| Type::S64
| Type::Float32
| Type::Float64 => {}
| Type::F32
| Type::F64 => {}

Type::String => {
self.push(Ins::LocalGet(value));
Expand Down
11 changes: 6 additions & 5 deletions src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use {
std::borrow::Cow,
wasm_encoder::{
CodeSection, ConstExpr, CustomSection, ElementSection, Elements, Encode, EntityType,
ExportKind, ExportSection, Function, FunctionSection, GlobalType, HeapType, ImportSection,
ExportKind, ExportSection, Function, FunctionSection, GlobalType, ImportSection,
Instruction as Ins, MemoryType, Module, RefType, TableType, TypeSection, ValType,
},
wit_component::metadata,
Expand Down Expand Up @@ -112,6 +112,7 @@ pub fn make_bindings(
EntityType::Global(GlobalType {
val_type: ValType::I32,
mutable: false,
shared: false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs all had this as false, but I don't know what the correct value should be.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false is correct in this context. true would mean the global can be accessed from more than one thread, but WASIp2 and the component model are strictly single threaded for the time being.

}),
);
global_names.push((table_base, "__table_base".to_owned()));
Expand All @@ -123,6 +124,7 @@ pub fn make_bindings(
EntityType::Global(GlobalType {
val_type: ValType::I32,
mutable: true,
shared: false,
}),
);
global_names.push((stack_pointer, "__stack_pointer".to_owned()));
Expand All @@ -135,17 +137,15 @@ pub fn make_bindings(
maximum: None,
memory64: false,
shared: false,
page_size_log2: None,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. I assumed the default

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we have no use for non-default page sizes at this point. That's primarily meant for embedded systems.

}),
);

imports.import(
"env",
"__indirect_function_table",
EntityType::Table(TableType {
element_type: RefType {
nullable: true,
heap_type: HeapType::Func,
},
element_type: RefType::FUNCREF,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed that this constant was a convenience wrapper around the same thing, but I could be wrong

minimum: summary
.functions
.iter()
Expand All @@ -154,6 +154,7 @@ pub fn make_bindings(
.try_into()
.unwrap(),
maximum: None,
table64: false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Followed the doc example here as well

}),
);

Expand Down
Loading