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
5 changes: 4 additions & 1 deletion crates/cranelift/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,10 @@ impl Compiler {
// `VMDeferredThread` inside an old, since-unwound stack
// frame. Therefore, we must reset `current_thread` to avoid
// potential use-after-free bugs.
let forced = builder.ins().iconst(pointer_type, 1);
let forced = builder.ins().iconst(
pointer_type,
i64::try_from(wasmtime_environ::VM_LAZY_THREAD_FORCED).unwrap(),
);
alias_regions.store_vmstore_context_current_thread(
&mut builder.cursor(),
vm_store_ctx,
Expand Down
6 changes: 3 additions & 3 deletions crates/environ/src/compile/module_environ.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ pub enum FactInlineIntrinsic {
ExitSyncCall,
}

/// TODO FITZGEN
/// A statically-known function import.
#[derive(Clone, Debug)]
pub enum KnownFunc {
/// TODO FITZGEN
/// A function described by the given key.
FuncKey(FuncKey),
/// TODO FITZGEN
/// An always-inlined FACT intrinsic.
FactIntrinsic(FactInlineIntrinsic),
}

Expand Down
3 changes: 3 additions & 0 deletions crates/environ/src/vmoffsets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1411,3 +1411,6 @@ mod tests {
assert!(is_aligned(align(31, 16)));
}
}

/// The bit pattern of `VMLazyThread::forced()`.
pub const VM_LAZY_THREAD_FORCED: u64 = 1;
13 changes: 13 additions & 0 deletions crates/wasmtime/src/runtime/vm/vmcontext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,19 @@ impl VMLazyThread {
}
}

#[cfg(test)]
mod test_vmlazy_thread {
use super::*;

#[test]
fn vmlazy_thread_forced() {
assert_eq!(
VMLazyThread::forced().0.unwrap().addr().get(),
usize::try_from(wasmtime_environ::VM_LAZY_THREAD_FORCED).unwrap()
);
}
}

/// A deferred component-model thread.
///
/// This is an on-stack record pushed by a fused sync-to-sync adapter's fast
Expand Down
Loading