Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
220 changes: 107 additions & 113 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
wasmtime (39.0.1)
wasmtime (40.0.0)
rb_sys (~> 0.9.124)

GEM
Expand Down
8 changes: 4 additions & 4 deletions ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ magnus = { version = "0.8", features = ["rb-sys"] }
rb-sys = { version = "*", default-features = false, features = [
"stable-api-compiled-fallback",
] }
wasmtime = { version = "=39.0.1", features = ["memory-protection-keys"] }
wasmtime-wasi = "=39.0.1"
wasmtime = { version = "=40.0.0", features = ["memory-protection-keys"] }
wasmtime-wasi = "=40.0.0"
cap-std = "4.0.0"
wat = "1.244.0"
tokio = { version = "1.47.1", features = [
Expand All @@ -38,8 +38,8 @@ async-timer = { version = "1.0.0-beta.15", features = [
"tokio1",
], optional = true }
static_assertions = "1.1.0"
wasmtime-environ = "=39.0.1"
deterministic-wasi-ctx = { version = "=3.0.4" }
wasmtime-environ = "=40.0.0"
deterministic-wasi-ctx = { version = "=3.0.5" }

[build-dependencies]
rb-sys-env = "0.2.2"
8 changes: 6 additions & 2 deletions ext/src/ruby_api/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,12 @@ impl From<ComponentImpl> for Component {
let start = range.start;
let end = range.end;

assert!(end > start);
let size = unsafe { end.offset_from(start) };
let size = if end > start {
unsafe { end.offset_from(start) }
} else {
// Happens when component does not contain any Wasm functions.
0
};

Self {
inner,
Expand Down
3 changes: 1 addition & 2 deletions ext/src/ruby_api/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ impl From<ModuleImpl> for Module {
let size = if end > start {
unsafe { end.offset_from(start) }
} else {
// This is mostly a safety mechanism; this should never happen if
// things are correctly configured.
// Happens when module does not contain any Wasm functions.
0
};

Expand Down
2 changes: 1 addition & 1 deletion lib/wasmtime/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Wasmtime
VERSION = "39.0.1"
VERSION = "40.0.0"
end
4 changes: 2 additions & 2 deletions spec/unit/component/component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module Component
tmpfile = create_tmpfile(Component.new(engine, "(component)").serialize)
component, increase_bytes = measure_gc_stat(:malloc_increase_bytes) { Component.deserialize_file(engine, tmpfile) }

expect(increase_bytes).to be > File.size(tmpfile)
expect(increase_bytes).to be > 0
expect(component).to be_a(Component)
end

Expand All @@ -80,7 +80,7 @@ def create_tmpfile(content)
serialized = Component.new(engine, "(component)").serialize
component, increase_bytes = measure_gc_stat(:malloc_increase_bytes) { Component.deserialize(engine, serialized) }

expect(increase_bytes).to be > serialized.bytesize
expect(increase_bytes).to be > 0
expect(component).to be_a(Wasmtime::Component::Component)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/module_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module Wasmtime
tmpfile = create_tmpfile(Module.new(engine, "(module)").serialize)
mod, increase_bytes = measure_gc_stat(:malloc_increase_bytes) { Module.deserialize_file(engine, tmpfile) }

expect(increase_bytes).to be > File.size(tmpfile)
expect(increase_bytes).to be > 0
expect(mod).to be_a(Wasmtime::Module)
end

Expand All @@ -82,7 +82,7 @@ def create_tmpfile(content)
serialized = Module.new(engine, wat).serialize
mod, increase_bytes = measure_gc_stat(:malloc_increase_bytes) { Module.deserialize(engine, serialized) }

expect(increase_bytes).to be > serialized.bytesize
expect(increase_bytes).to be > 0
expect(mod).to be_a(Wasmtime::Module)
end
end
Expand Down
Loading