Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Sprinkle some FIXMEs for memory64 support (#14685)

Alex Crichton2a72ae78d73f
diff --git a/crates/cranelift/src/compiler/component.rs b/crates/cranelift/src/compiler/component.rs
index 8ec76fe2a4..f36c5e2c3a 100644
--- a/crates/cranelift/src/compiler/component.rs
+++ b/crates/cranelift/src/compiler/component.rs
@@ -342,6 +342,7 @@ impl<'a> TrampolineCompiler<'a> {
me.index_value(*instance),
me.index_value(*ty),
me.index_value(*options),
+ // FIXME(#4311): needs memory64 handling
me.builder
.ins()
.iconst(ir::types::I32, i64::from(info.size32)),
@@ -379,6 +380,7 @@ impl<'a> TrampolineCompiler<'a> {
me.index_value(*instance),
me.index_value(*ty),
me.index_value(*options),
+ // FIXME(#4311): needs memory64 handling
me.builder
.ins()
.iconst(ir::types::I32, i64::from(info.size32)),
diff --git a/crates/environ/src/component.rs b/crates/environ/src/component.rs
index 3a75238c9f..c762630aca 100644
--- a/crates/environ/src/component.rs
+++ b/crates/environ/src/component.rs
@@ -122,8 +122,10 @@ macro_rules! foreach_builtin_component_function {
task_cancel(vmctx: vmctx, caller_instance: u32) -> bool;
#[cfg(feature = "component-model-async")]
waitable_set_new(vmctx: vmctx, caller_instance: u32) -> u64;
+ // FIXME(#4311): `payload` needs to be a `u64` for memory64
#[cfg(feature = "component-model-async")]
waitable_set_wait(vmctx: vmctx, caller_instance: u32, options: u32, set: u32, payload: u32) -> u64;
+ // FIXME(#4311): `payload` needs to be a `u64` for memory64
#[cfg(feature = "component-model-async")]
waitable_set_poll(vmctx: vmctx, caller_instance: u32, options: u32, set: u32, payload: u32) -> u64;
#[cfg(feature = "component-model-async")]
@@ -153,8 +155,10 @@ macro_rules! foreach_builtin_component_function {
start_call(vmctx: vmctx, callback: ptr_u8, post_return: ptr_u8, storage: ptr_u8, storage_len: size, callee: ptr_u8, param_count: u32, result_count: u32, flags: u32) -> bool;
#[cfg(feature = "component-model-async")]
future_new(vmctx: vmctx, caller_instance: u32, ty: u32) -> u64;
+ // FIXME(#4311): `address` needs to be a `u64` for memory64
#[cfg(feature = "component-model-async")]
future_write(vmctx: vmctx, caller_instance: u32, ty: u32, options: u32, future: u32, address: u32) -> u64;
+ // FIXME(#4311): `address` needs to be a `u64` for memory64
#[cfg(feature = "component-model-async")]
future_read(vmctx: vmctx, caller_instance: u32, ty: u32, options: u32, future: u32, address: u32) -> u64;
#[cfg(feature = "component-model-async")]
@@ -167,8 +171,10 @@ macro_rules! foreach_builtin_component_function {
future_drop_readable(vmctx: vmctx, caller_instance: u32, ty: u32, reader: u32) -> bool;
#[cfg(feature = "component-model-async")]
stream_new(vmctx: vmctx, caller_instance: u32, ty: u32) -> u64;
+ // FIXME(#4311): `address` and `count` need to be `u64`s for memory64
#[cfg(feature = "component-model-async")]
stream_write(vmctx: vmctx, caller_instance: u32, ty: u32, options: u32, stream: u32, address: u32, count: u32) -> u64;
+ // FIXME(#4311): `address` and `count` need to be `u64`s for memory64
#[cfg(feature = "component-model-async")]
stream_read(vmctx: vmctx, caller_instance: u32, ty: u32, options: u32, stream: u32, address: u32, count: u32) -> u64;
#[cfg(feature = "component-model-async")]
@@ -179,12 +185,16 @@ macro_rules! foreach_builtin_component_function {
stream_drop_writable(vmctx: vmctx, caller_instance: u32, ty: u32, writer: u32) -> bool;
#[cfg(feature = "component-model-async")]
stream_drop_readable(vmctx: vmctx, caller_instance: u32, ty: u32, reader: u32) -> bool;
+ // FIXME(#4311): `address` and `count` need to be `u64`s for memory64
#[cfg(feature = "component-model-async")]
flat_stream_write(vmctx: vmctx, caller_instance: u32, ty: u32, options:u32, payload_size: u32, payload_align: u32, stream: u32, address: u32, count: u32) -> u64;
+ // FIXME(#4311): `address` and `count` need to be `u64`s for memory64
#[cfg(feature = "component-model-async")]
flat_stream_read(vmctx: vmctx, caller_instance: u32, ty: u32, options: u32, payload_size: u32, payload_align: u32, stream: u32, address: u32, count: u32) -> u64;
+ // FIXME(#4311): `debug_msg_address` and `debug_msg_len` need to be `u64`s for memory64
#[cfg(feature = "component-model-async")]
error_context_new(vmctx: vmctx, caller_instance: u32, ty: u32, options: u32, debug_msg_address: u32, debug_msg_len: u32) -> u64;
+ // FIXME(#4311): `debug_msg_address` needs to be a `u64` for memory64
#[cfg(feature = "component-model-async")]
error_context_debug_message(vmctx: vmctx, caller_instance: u32, ty: u32, options: u32, err_ctx_handle: u32, debug_msg_address: u32) -> bool;
#[cfg(feature = "component-model-async")]
diff --git a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
index c99a43fc67..507335efd3 100644
--- a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
@@ -3343,6 +3343,9 @@ impl Instance {
// Validate `write_ty` w.r.t. `write_address` to ensure it's properly
// aligned and in-bounds.
+ //
+ // FIXME(#4311): this and the rest of this function use the 32-bit
+ // layout of payloads, which needs memory64 handling.
let write_payload_ty = write_ty.payload(write_types);
let write_abi = match write_payload_ty {
Some(ty) => write_types.canonical_abi(ty),
@@ -3534,6 +3537,7 @@ impl Instance {
return Ok(());
}
let abi = types.canonical_abi(&payload);
+ // FIXME(#4311): needs memory64 handling
let size = usize::try_from(abi.size32)?;
let align = usize::try_from(abi.align32)?;
if address % align != 0 {
@@ -3682,6 +3686,7 @@ impl Instance {
let instance = read_instance.id().get(store.0);
let types = instance.component().types();
+ // FIXME(#4311): needs memory64 handling
let item_size = match read_ty.payload(types) {
Some(ty) => usize::try_from(types.canonical_abi(ty).size32)?,
None => 0,
@@ -3928,6 +3933,7 @@ impl Instance {
let instance = write_instance.id().get(store.0);
let types = instance.component().types();
+ // FIXME(#4311): needs memory64 handling
let item_size = match write_ty.payload(types) {
Some(ty) => usize::try_from(types.canonical_abi(ty).size32)?,
None => 0,