Skip to content

Commit 05bf5b7

Browse files
committed
Remove cancellable from component model intrinsics
This commit is an implementation of WebAssembly/component-model#716 for wasmtime where the main fallout is in tests. This isn't expected to affect anything in practice as there's no known usage of this immediate at this time.
1 parent dde570a commit 05bf5b7

20 files changed

Lines changed: 108 additions & 770 deletions

File tree

Cargo.lock

Lines changed: 13 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,3 +786,18 @@ fpr = "fpr"
786786

787787
[workspace.metadata.typos.files]
788788
extend-exclude = [ "docs/js/mermaid*.js", "crates/wasi-nn/**/*.txt", "*.isle" ]
789+
790+
[patch.crates-io]
791+
wasmparser = { git = 'https://github.com/bytecodealliance/wasm-tools' }
792+
wat = { git = 'https://github.com/bytecodealliance/wasm-tools' }
793+
wast = { git = 'https://github.com/bytecodealliance/wasm-tools' }
794+
wasmprinter = { git = 'https://github.com/bytecodealliance/wasm-tools' }
795+
wasm-encoder = { git = 'https://github.com/bytecodealliance/wasm-tools' }
796+
wasm-smith = { git = 'https://github.com/bytecodealliance/wasm-tools' }
797+
wasm-mutate = { git = 'https://github.com/bytecodealliance/wasm-tools' }
798+
wasm-metadata = { git = 'https://github.com/bytecodealliance/wasm-tools' }
799+
wit-parser = { git = 'https://github.com/bytecodealliance/wasm-tools' }
800+
wit-component = { git = 'https://github.com/bytecodealliance/wasm-tools' }
801+
wasm-wave = { git = 'https://github.com/bytecodealliance/wasm-tools' }
802+
wasm-compose = { git = 'https://github.com/bytecodealliance/wasm-tools' }
803+
json-from-wast = { git = 'https://github.com/bytecodealliance/wasm-tools' }

crates/cranelift/src/compiler/component.rs

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -742,111 +742,63 @@ impl<'a> TrampolineCompiler<'a> {
742742
},
743743
);
744744
}
745-
Trampoline::ThreadSuspend {
746-
instance,
747-
cancellable,
748-
} => {
745+
Trampoline::ThreadSuspend { instance } => {
749746
self.translate_libcall(
750747
host::thread_suspend,
751748
TrapSentinel::NegativeOne,
752749
WasmArgs::InRegisters,
753750
|me, params| {
754751
params.push(me.index_value(*instance));
755-
params.push(
756-
me.builder
757-
.ins()
758-
.iconst(ir::types::I8, i64::from(*cancellable)),
759-
);
760752
},
761753
);
762754
}
763-
Trampoline::ThreadYield {
764-
instance,
765-
cancellable,
766-
} => {
755+
Trampoline::ThreadYield { instance } => {
767756
self.translate_libcall(
768757
host::thread_yield,
769758
TrapSentinel::NegativeOne,
770759
WasmArgs::InRegisters,
771760
|me, params| {
772761
params.push(me.index_value(*instance));
773-
params.push(
774-
me.builder
775-
.ins()
776-
.iconst(ir::types::I8, i64::from(*cancellable)),
777-
);
778762
},
779763
);
780764
}
781-
Trampoline::ThreadSuspendThenResume {
782-
instance,
783-
cancellable,
784-
} => {
765+
Trampoline::ThreadSuspendThenResume { instance } => {
785766
self.translate_libcall(
786767
host::thread_suspend_then_resume,
787768
TrapSentinel::NegativeOne,
788769
WasmArgs::InRegisters,
789770
|me, params| {
790771
params.push(me.index_value(*instance));
791-
params.push(
792-
me.builder
793-
.ins()
794-
.iconst(ir::types::I8, i64::from(*cancellable)),
795-
);
796772
},
797773
);
798774
}
799-
Trampoline::ThreadYieldThenResume {
800-
instance,
801-
cancellable,
802-
} => {
775+
Trampoline::ThreadYieldThenResume { instance } => {
803776
self.translate_libcall(
804777
host::thread_yield_then_resume,
805778
TrapSentinel::NegativeOne,
806779
WasmArgs::InRegisters,
807780
|me, params| {
808781
params.push(me.index_value(*instance));
809-
params.push(
810-
me.builder
811-
.ins()
812-
.iconst(ir::types::I8, i64::from(*cancellable)),
813-
);
814782
},
815783
);
816784
}
817-
Trampoline::ThreadSuspendThenPromote {
818-
instance,
819-
cancellable,
820-
} => {
785+
Trampoline::ThreadSuspendThenPromote { instance } => {
821786
self.translate_libcall(
822787
host::thread_suspend_then_promote,
823788
TrapSentinel::NegativeOne,
824789
WasmArgs::InRegisters,
825790
|me, params| {
826791
params.push(me.index_value(*instance));
827-
params.push(
828-
me.builder
829-
.ins()
830-
.iconst(ir::types::I8, i64::from(*cancellable)),
831-
);
832792
},
833793
);
834794
}
835-
Trampoline::ThreadYieldThenPromote {
836-
instance,
837-
cancellable,
838-
} => {
795+
Trampoline::ThreadYieldThenPromote { instance } => {
839796
self.translate_libcall(
840797
host::thread_yield_then_promote,
841798
TrapSentinel::NegativeOne,
842799
WasmArgs::InRegisters,
843800
|me, params| {
844801
params.push(me.index_value(*instance));
845-
params.push(
846-
me.builder
847-
.ins()
848-
.iconst(ir::types::I8, i64::from(*cancellable)),
849-
);
850802
},
851803
);
852804
}

crates/environ/src/component.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,17 @@ macro_rules! foreach_builtin_component_function {
190190
#[cfg(feature = "component-model-async")]
191191
thread_resume_later(vmctx: vmctx, caller_instance: u32, thread_idx: u32) -> bool;
192192
#[cfg(feature = "component-model-async")]
193-
thread_suspend(vmctx: vmctx, caller_instance: u32, cancellable: u8) -> u32;
193+
thread_suspend(vmctx: vmctx, caller_instance: u32) -> u32;
194194
#[cfg(feature = "component-model-async")]
195-
thread_yield(vmctx: vmctx, caller_instance: u32, cancellable: u8) -> u32;
195+
thread_yield(vmctx: vmctx, caller_instance: u32) -> u32;
196196
#[cfg(feature = "component-model-async")]
197-
thread_suspend_then_resume(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;
197+
thread_suspend_then_resume(vmctx: vmctx, caller_instance: u32, thread_idx: u32) -> u32;
198198
#[cfg(feature = "component-model-async")]
199-
thread_yield_then_resume(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;
199+
thread_yield_then_resume(vmctx: vmctx, caller_instance: u32, thread_idx: u32) -> u32;
200200
#[cfg(feature = "component-model-async")]
201-
thread_suspend_then_promote(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;
201+
thread_suspend_then_promote(vmctx: vmctx, caller_instance: u32, thread_idx: u32) -> u32;
202202
#[cfg(feature = "component-model-async")]
203-
thread_yield_then_promote(vmctx: vmctx, caller_instance: u32, cancellable: u8, thread_idx: u32) -> u32;
203+
thread_yield_then_promote(vmctx: vmctx, caller_instance: u32, thread_idx: u32) -> u32;
204204

205205
utf8_to_utf8(vmctx: vmctx, src: ptr_u8, len: size, dst: ptr_u8) -> bool;
206206
utf16_to_utf16(vmctx: vmctx, src: ptr_u16, len: size, dst: ptr_u16) -> bool;

0 commit comments

Comments
 (0)