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
25 changes: 0 additions & 25 deletions crates/cranelift/src/compiler/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ impl From<GetLibcallFn> for HostCallee {

/// How to interpret the results of a host function.
enum HostResult {
/// The host function has no results.
None,

/// The host function returns the sentinel specified which is interpreted
/// and translated to the real return value.
Sentinel(TrapSentinel),
Expand Down Expand Up @@ -622,22 +619,6 @@ impl<'a> TrampolineCompiler<'a> {
|_, _| {},
);
}
Trampoline::ResourceEnterCall => {
self.translate_libcall(
host::resource_enter_call,
HostResult::None,
WasmArgs::InRegisters,
|_, _| {},
);
}
Trampoline::ResourceExitCall => {
self.translate_libcall(
host::resource_exit_call,
TrapSentinel::Falsy,
WasmArgs::InRegisters,
|_, _| {},
);
}
Trampoline::PrepareCall { memory } => {
self.translate_libcall(
host::prepare_call,
Expand Down Expand Up @@ -1043,10 +1024,6 @@ impl<'a> TrampolineCompiler<'a> {
self.abi_store_results(&[]);
}
HostResult::Sentinel(_) => todo!("support additional return types if/when necessary"),
HostResult::None => {
assert!(result.is_none());
self.abi_store_results(&[]);
}

HostResult::MultiValue { ptr, len } => {
let ptr = ptr.or(val_raw_ptr).unwrap();
Expand Down Expand Up @@ -1472,8 +1449,6 @@ impl<'a> TrampolineCompiler<'a> {
// directly from guest wasm, so no check is needed.
Trampoline::ResourceTransferOwn
| Trampoline::ResourceTransferBorrow
| Trampoline::ResourceEnterCall
| Trampoline::ResourceExitCall
| Trampoline::PrepareCall { .. }
| Trampoline::SyncStartCall { .. }
| Trampoline::AsyncStartCall { .. }
Expand Down
4 changes: 0 additions & 4 deletions crates/environ/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,8 @@ macro_rules! foreach_builtin_component_function {

resource_transfer_own(vmctx: vmctx, src_idx: u32, src_table: u32, dst_table: u32) -> u64;
resource_transfer_borrow(vmctx: vmctx, src_idx: u32, src_table: u32, dst_table: u32) -> u64;
resource_enter_call(vmctx: vmctx);
resource_exit_call(vmctx: vmctx) -> bool;

#[cfg(feature = "component-model-async")]
enter_sync_call(vmctx: vmctx, caller_instance: u32, callee_async: u32, callee_instance: u32) -> bool;
#[cfg(feature = "component-model-async")]
exit_sync_call(vmctx: vmctx) -> bool;

#[cfg(feature = "component-model-async")]
Expand Down
4 changes: 0 additions & 4 deletions crates/environ/src/component/dfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,6 @@ pub enum Trampoline {
},
ResourceTransferOwn,
ResourceTransferBorrow,
ResourceEnterCall,
ResourceExitCall,
PrepareCall {
memory: Option<MemoryId>,
},
Expand Down Expand Up @@ -1146,8 +1144,6 @@ impl LinearizeDfg<'_> {
},
Trampoline::ResourceTransferOwn => info::Trampoline::ResourceTransferOwn,
Trampoline::ResourceTransferBorrow => info::Trampoline::ResourceTransferBorrow,
Trampoline::ResourceEnterCall => info::Trampoline::ResourceEnterCall,
Trampoline::ResourceExitCall => info::Trampoline::ResourceExitCall,
Trampoline::PrepareCall { memory } => info::Trampoline::PrepareCall {
memory: memory.map(|v| self.runtime_memory(v)),
},
Expand Down
12 changes: 0 additions & 12 deletions crates/environ/src/component/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,16 +1044,6 @@ pub enum Trampoline {
/// Same as `ResourceTransferOwn` but for borrows.
ResourceTransferBorrow,

/// An intrinsic used by FACT-generated modules which indicates that a call
/// is being entered and resource-related metadata needs to be configured.
///
/// Note that this is currently only invoked when borrowed resources are
/// detected, otherwise this is "optimized out".
ResourceEnterCall,

/// Same as `ResourceEnterCall` except for when exiting a call.
ResourceExitCall,

/// An intrinsic used by FACT-generated modules to prepare a call involving
/// an async-lowered import and/or an async-lifted export.
PrepareCall {
Expand Down Expand Up @@ -1239,8 +1229,6 @@ impl Trampoline {
ErrorContextDrop { .. } => format!("error-context-drop"),
ResourceTransferOwn => format!("component-resource-transfer-own"),
ResourceTransferBorrow => format!("component-resource-transfer-borrow"),
ResourceEnterCall => format!("component-resource-enter-call"),
ResourceExitCall => format!("component-resource-exit-call"),
PrepareCall { .. } => format!("component-prepare-call"),
SyncStartCall { .. } => format!("component-sync-start-call"),
AsyncStartCall { .. } => format!("component-async-start-call"),
Expand Down
2 changes: 0 additions & 2 deletions crates/environ/src/component/translate/adapt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,6 @@ fn fact_import_to_core_def(
fact::Import::ResourceTransferBorrow => {
simple_intrinsic(dfg::Trampoline::ResourceTransferBorrow)
}
fact::Import::ResourceEnterCall => simple_intrinsic(dfg::Trampoline::ResourceEnterCall),
fact::Import::ResourceExitCall => simple_intrinsic(dfg::Trampoline::ResourceExitCall),
fact::Import::PrepareCall { memory } => simple_intrinsic(dfg::Trampoline::PrepareCall {
memory: memory.as_ref().map(|v| dfg.memories.push(unwrap_memory(v))),
}),
Expand Down
31 changes: 0 additions & 31 deletions crates/environ/src/fact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ pub struct Module<'a> {
/// Cached versions of imported trampolines for working with resources.
imported_resource_transfer_own: Option<FuncIndex>,
imported_resource_transfer_borrow: Option<FuncIndex>,
imported_resource_enter_call: Option<FuncIndex>,
imported_resource_exit_call: Option<FuncIndex>,

// Cached versions of imported trampolines for working with the async ABI.
imported_async_start_calls: HashMap<(Option<FuncIndex>, Option<FuncIndex>), FuncIndex>,
Expand Down Expand Up @@ -261,8 +259,6 @@ impl<'a> Module<'a> {
helper_worklist: Vec::new(),
imported_resource_transfer_own: None,
imported_resource_transfer_borrow: None,
imported_resource_enter_call: None,
imported_resource_exit_call: None,
imported_async_start_calls: HashMap::new(),
imported_future_transfer: None,
imported_stream_transfer: None,
Expand Down Expand Up @@ -720,28 +716,6 @@ impl<'a> Module<'a> {
)
}

fn import_resource_enter_call(&mut self) -> FuncIndex {
self.import_simple(
"resource",
"enter-call",
&[],
&[],
Import::ResourceEnterCall,
|me| &mut me.imported_resource_enter_call,
)
}

fn import_resource_exit_call(&mut self) -> FuncIndex {
self.import_simple(
"resource",
"exit-call",
&[],
&[],
Import::ResourceExitCall,
|me| &mut me.imported_resource_exit_call,
)
}

fn import_enter_sync_call(&mut self) -> FuncIndex {
self.import_simple(
"async",
Expand Down Expand Up @@ -881,11 +855,6 @@ pub enum Import {
ResourceTransferOwn,
/// Transfers a borrowed resource from one table to another.
ResourceTransferBorrow,
/// Sets up entry metadata for a borrow resources when a call starts.
ResourceEnterCall,
/// Tears down a previous entry and handles checking borrow-related
/// metadata.
ResourceExitCall,
/// An intrinsic used by FACT-generated modules to begin a call involving
/// an async-lowered import and/or an async-lifted export.
PrepareCall {
Expand Down
18 changes: 7 additions & 11 deletions crates/environ/src/fact/trampoline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,15 +797,14 @@ impl<'a, 'b> Compiler<'a, 'b> {
self.instruction(Call(enter_sync_call.as_u32()));

old_task_may_block
} else if self.emit_resource_call {
let enter_sync_call = self.module.import_enter_sync_call();
self.instruction(Call(enter_sync_call.as_u32()));
None
} else {
None
};

if self.emit_resource_call {
let enter = self.module.import_resource_enter_call();
self.instruction(Call(enter.as_u32()));
}

// Perform the translation of arguments. Note that `FLAG_MAY_LEAVE` is
// cleared around this invocation for the callee as per the
// `canon_lift` definition in the spec. Additionally note that the
Expand Down Expand Up @@ -866,18 +865,15 @@ impl<'a, 'b> Compiler<'a, 'b> {
self.free_temp_local(tmp);
}

if self.emit_resource_call {
let exit = self.module.import_resource_exit_call();
self.instruction(Call(exit.as_u32()));
}

if self.module.tunables.concurrency_support {
if self.emit_resource_call || self.module.tunables.concurrency_support {
// Pop the task we pushed earlier off of the current task stack.
//
// FIXME: Apply the optimizations described in #12311.
let exit_sync_call = self.module.import_exit_sync_call();
self.instruction(Call(exit_sync_call.as_u32()));
}

if self.module.tunables.concurrency_support {
// Restore old `may_block_field`
if let Some(old_task_may_block) = old_task_may_block {
let task_may_block = self.module.import_task_may_block();
Expand Down
3 changes: 1 addition & 2 deletions crates/test-util/src/wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ pub fn find_tests(root: &Path) -> Result<Vec<WastTest>> {
// panics, loops, etc).
{
let skip_list = &[
// FIXME(#12510)
"drop-cross-task-borrow.wast",
// .. empty currently ..
];
tests.retain(|test| {
test.path
Expand Down
Loading
Loading