Skip to content
Merged
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
123 changes: 123 additions & 0 deletions crates/cranelift/src/compiler/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,103 @@ impl<'a> TrampolineCompiler<'a> {
Trampoline::AlwaysTrap => {
self.translate_always_trap();
}
Trampoline::TaskBackpressure { instance } => {
_ = instance;
todo!()
}
Trampoline::TaskReturn => todo!(),
Trampoline::TaskWait {
instance,
async_,
memory,
} => {
_ = (instance, async_, memory);
todo!()
}
Trampoline::TaskPoll {
instance,
async_,
memory,
} => {
_ = (instance, async_, memory);
todo!()
}
Trampoline::TaskYield { async_ } => {
_ = async_;
todo!()
}
Trampoline::SubtaskDrop { instance } => {
_ = instance;
todo!()
}
Trampoline::StreamNew { ty } => {
_ = ty;
todo!()
}
Trampoline::StreamRead { ty, options } => {
_ = (ty, options);
todo!()
}
Trampoline::StreamWrite { ty, options } => {
_ = (ty, options);
todo!()
}
Trampoline::StreamCancelRead { ty, async_ } => {
_ = (ty, async_);
todo!()
}
Trampoline::StreamCancelWrite { ty, async_ } => {
_ = (ty, async_);
todo!()
}
Trampoline::StreamCloseReadable { ty } => {
_ = ty;
todo!()
}
Trampoline::StreamCloseWritable { ty } => {
_ = ty;
todo!()
}
Trampoline::FutureNew { ty } => {
_ = ty;
todo!()
}
Trampoline::FutureRead { ty, options } => {
_ = (ty, options);
todo!()
}
Trampoline::FutureWrite { ty, options } => {
_ = (ty, options);
todo!()
}
Trampoline::FutureCancelRead { ty, async_ } => {
_ = (ty, async_);
todo!()
}
Trampoline::FutureCancelWrite { ty, async_ } => {
_ = (ty, async_);
todo!()
}
Trampoline::FutureCloseReadable { ty } => {
_ = ty;
todo!()
}
Trampoline::FutureCloseWritable { ty } => {
_ = ty;
todo!()
}
Trampoline::ErrorContextNew { ty, options } => {
_ = (ty, options);
todo!()
}
Trampoline::ErrorContextDebugMessage { ty, options } => {
_ = (ty, options);
todo!()
}
Trampoline::ErrorContextDrop { ty } => {
_ = ty;
todo!()
}
Trampoline::ResourceNew(ty) => self.translate_resource_new(*ty),
Trampoline::ResourceRep(ty) => self.translate_resource_rep(*ty),
Trampoline::ResourceDrop(ty) => self.translate_resource_drop(*ty),
Expand All @@ -115,6 +212,26 @@ impl<'a> TrampolineCompiler<'a> {
me.raise_if_host_trapped(rets.pop().unwrap());
})
}
Trampoline::AsyncEnterCall => todo!(),
Trampoline::AsyncExitCall {
callback,
post_return,
} => {
_ = (callback, post_return);
todo!()
}
Trampoline::FutureTransfer => {
_ = host::future_transfer;
todo!()
}
Trampoline::StreamTransfer => {
_ = host::stream_transfer;
todo!()
}
Trampoline::ErrorContextTransfer => {
_ = host::error_context_transfer;
todo!()
}
}
}

Expand Down Expand Up @@ -159,8 +276,14 @@ impl<'a> TrampolineCompiler<'a> {
realloc,
post_return,
string_encoding,
callback: _,
async_,
} = *options;

if async_ {
todo!()
}

// vmctx: *mut VMComponentContext
host_sig.params.push(ir::AbiParam::new(pointer_type));
callee_args.push(vmctx);
Expand Down
4 changes: 4 additions & 0 deletions crates/environ/examples/factc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ impl Factc {
realloc: Some(dummy_def()),
// Lowering never allows `post-return`
post_return: None,
async_: false,
callback: None,
},
lift_options: AdapterOptions {
instance: RuntimeComponentInstanceIndex::from_u32(1),
Expand All @@ -159,6 +161,8 @@ impl Factc {
} else {
None
},
async_: false,
callback: None,
},
func: dummy_def(),
});
Expand Down
7 changes: 7 additions & 0 deletions crates/environ/fuzz/fuzz_targets/fact-valid-module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ fn target(data: &[u8]) -> arbitrary::Result<()> {
realloc: Some(dummy_def()),
// Lowering never allows `post-return`
post_return: None,
// Lowering never allows `callback`
callback: None,
// TODO: support async lowers
async_: false,
},
lift_options: AdapterOptions {
instance: RuntimeComponentInstanceIndex::from_u32(1),
Expand All @@ -180,6 +184,9 @@ fn target(data: &[u8]) -> arbitrary::Result<()> {
} else {
None
},
// TODO: support async lowers
callback: None,
async_: false,
},
func: dummy_def(),
});
Expand Down
4 changes: 4 additions & 0 deletions crates/environ/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ macro_rules! foreach_builtin_component_function {
resource_enter_call(vmctx: vmctx);
resource_exit_call(vmctx: vmctx) -> bool;

future_transfer(vmctx: vmctx, src_idx: u32, src_table: u32, dst_table: u32) -> u64;
stream_transfer(vmctx: vmctx, src_idx: u32, src_table: u32, dst_table: u32) -> u64;
error_context_transfer(vmctx: vmctx, src_idx: u32, src_table: u32, dst_table: u32) -> u64;

trap(vmctx: vmctx, code: u8);

utf8_to_utf8(src: ptr_u8, len: size, dst: ptr_u8) -> bool;
Expand Down
Loading
Loading