Skip to content

extension: Upgrade wasmtime to v21#15210

Merged
maxdeviant merged 6 commits intomainfrom
marshall/upgrade-wasmtime-to-v20
Jul 25, 2024
Merged

extension: Upgrade wasmtime to v21#15210
maxdeviant merged 6 commits intomainfrom
marshall/upgrade-wasmtime-to-v20

Conversation

@maxdeviant
Copy link
Copy Markdown
Member

@maxdeviant maxdeviant commented Jul 25, 2024

This PR upgrades the version of wasmtime and wasmtime-wasi in use to v21.0.1.

We have to skip v20 because Tree-sitter also skipped it.

Here are the changes that had to be made:

v19 -> v20

After upgrading the wasmtime packages to v20, I also had to run cargo update -p mach2 to pull in v0.4.2 to fix some compile errors.

There were a few minor API changes in wasmtime-wasi from bytecodealliance/wasmtime#8228 that we needed to account for.

v20 -> v21

Since there isn't a Tree-sitter version that depends on wasmtime@v20, we're jumping straight to v21.

The published version of Tree-sitter (v0.22.6) still depends on wasmtime@v19, but there was a commit (tree-sitter/tree-sitter@7f4a578) later that month that upgrades the wasmtime dependency to v21.

We're patching Tree-sitter to that commit so we can get the new wasmtime version.

The main change in v21 is that imports generated by bindgen! are no longer automatically trapped (bytecodealliance/wasmtime#8310), so we need to add trappable_imports: true to our bindgen! calls.

Release Notes:

  • N/A

Also needed to run `cargo update -p mach2` to fix some compilation errors.
@maxdeviant maxdeviant self-assigned this Jul 25, 2024
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jul 25, 2024
@maxdeviant maxdeviant marked this pull request as draft July 25, 2024 16:16
@maxdeviant maxdeviant changed the title extension: Upgrade wasmtime to v20 extension: Upgrade wasmtime to v21 Jul 25, 2024
@maxdeviant maxdeviant marked this pull request as ready for review July 25, 2024 16:54
) -> Linker<WasmState> {
let mut linker = Linker::new(&wasm_engine());
wasmtime_wasi::command::add_to_linker(&mut linker).unwrap();
wasmtime_wasi::add_to_linker_async(&mut linker).unwrap();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

.preopened_dir(current_dir_preopen, dir_perms, perms, ".")
.preopened_dir(work_dir_preopen, dir_perms, perms, &extension_work_dir)
.env("PWD", &extension_work_dir)
.preopened_dir(&extension_work_dir, ".", dir_perms, file_perms)?
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

preopened_dir now takes an AsRef<Path> for the host directory, so we don't need to call Dir::open_ambient_dir ourselves.

The order of the parameters also changed a bit, with the guest_path moving from the last parameter to the second.

For reference:

https://github.com/bytecodealliance/wasmtime/pull/8228/files#diff-e590d3fac47f1511c34190cc30c0d5488c555844c118be047feba373e108d420L100-R100

@maxdeviant maxdeviant merged commit d755d29 into main Jul 25, 2024
@maxdeviant maxdeviant deleted the marshall/upgrade-wasmtime-to-v20 branch July 25, 2024 17:56
CharlesChen0823 pushed a commit to CharlesChen0823/zed that referenced this pull request Jul 29, 2024
This PR upgrades the version of `wasmtime` and `wasmtime-wasi` in use to
v21.0.1.

We have to skip v20 because Tree-sitter also skipped it.

Here are the changes that had to be made:

### v19 -> v20

After upgrading the `wasmtime` packages to v20, I also had to run `cargo
update -p mach2` to pull in
[v0.4.2](https://github.com/JohnTitor/mach2/releases/tag/0.4.2) to fix
some compile errors.

There were a few minor API changes in `wasmtime-wasi` from
bytecodealliance/wasmtime#8228 that we needed to
account for.

### v20 -> v21

Since there isn't a Tree-sitter version that depends on `wasmtime@v20`,
we're jumping straight to v21.

The published version of Tree-sitter (v0.22.6) still depends on
`wasmtime@v19`, but there was a commit
(tree-sitter/tree-sitter@7f4a578)
later that month that upgrades the `wasmtime` dependency to v21.

We're patching Tree-sitter to that commit so we can get the new
`wasmtime` version.

The main change in v21 is that imports generated by `bindgen!` are no
longer automatically trapped
(bytecodealliance/wasmtime#8310), so we need to
add `trappable_imports: true` to our `bindgen!` calls.

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant