Skip to content

Commit ef1ec37

Browse files
authored
Annotate some FIXMEs with issue numbers (bytecodealliance#9951)
Fill out bytecodealliance#4311 throughout the codebase where I know of that it needs to be handled.
1 parent 4ad53fa commit ef1ec37

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

crates/wasmtime/src/runtime/component/func.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ impl Func {
668668
results: &mut [Val],
669669
src: &mut core::slice::Iter<'_, ValRaw>,
670670
) -> Result<()> {
671-
// FIXME: needs to read an i64 for memory64
671+
// FIXME(#4311): needs to read an i64 for memory64
672672
let ptr = usize::try_from(src.next().unwrap().get_u32())?;
673673
if ptr % usize::try_from(results_ty.abi.align32)? != 0 {
674674
bail!("return pointer not aligned");

crates/wasmtime/src/runtime/component/func/host.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ where
274274
}
275275

276276
fn validate_inbounds<T: ComponentType>(memory: &[u8], ptr: &ValRaw) -> Result<usize> {
277-
// FIXME: needs memory64 support
277+
// FIXME(#4311): needs memory64 support
278278
let ptr = usize::try_from(ptr.get_u32())?;
279279
if ptr % usize::try_from(T::ALIGN32)? != 0 {
280280
bail!("pointer not aligned");
@@ -406,7 +406,7 @@ where
406406
}
407407

408408
fn validate_inbounds_dynamic(abi: &CanonicalAbiInfo, memory: &[u8], ptr: &ValRaw) -> Result<usize> {
409-
// FIXME: needs memory64 support
409+
// FIXME(#4311): needs memory64 support
410410
let ptr = usize::try_from(ptr.get_u32())?;
411411
if ptr % usize::try_from(abi.align32)? != 0 {
412412
bail!("pointer not aligned");

crates/wasmtime/src/runtime/component/func/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ unsafe impl Send for Options {}
5252
unsafe impl Sync for Options {}
5353

5454
impl Options {
55-
// TODO: prevent a ctor where the memory is memory64
55+
// FIXME(#4311): prevent a ctor where the memory is memory64
5656

5757
/// Creates a new set of options with the specified components.
5858
///

crates/wasmtime/src/runtime/component/func/typed.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ where
314314
dst: &ValRaw,
315315
) -> Result<Return> {
316316
assert!(Return::flatten_count() > MAX_FLAT_RESULTS);
317-
// FIXME: needs to read an i64 for memory64
317+
// FIXME(#4311): needs to read an i64 for memory64
318318
let ptr = usize::try_from(dst.get_u32())?;
319319
if ptr % usize::try_from(Return::ALIGN32)? != 0 {
320320
bail!("return pointer not aligned");
@@ -1052,7 +1052,7 @@ unsafe impl Lift for char {
10521052
}
10531053
}
10541054

1055-
// TODO: these probably need different constants for memory64
1055+
// FIXME(#4311): these probably need different constants for memory64
10561056
const UTF16_TAG: usize = 1 << 31;
10571057
const MAX_STRING_BYTE_LENGTH: usize = (1 << 31) - 1;
10581058

@@ -1096,7 +1096,7 @@ unsafe impl Lower for str {
10961096
debug_assert!(matches!(ty, InterfaceType::String));
10971097
debug_assert!(offset % (Self::ALIGN32 as usize) == 0);
10981098
let (ptr, len) = lower_string(cx, self)?;
1099-
// FIXME: needs memory64 handling
1099+
// FIXME(#4311): needs memory64 handling
11001100
*cx.get(offset + 0) = u32::try_from(ptr).unwrap().to_le_bytes();
11011101
*cx.get(offset + 4) = u32::try_from(len).unwrap().to_le_bytes();
11021102
Ok(())
@@ -1366,7 +1366,7 @@ unsafe impl Lift for WasmStr {
13661366
#[inline]
13671367
fn lift(cx: &mut LiftContext<'_>, ty: InterfaceType, src: &Self::Lower) -> Result<Self> {
13681368
debug_assert!(matches!(ty, InterfaceType::String));
1369-
// FIXME: needs memory64 treatment
1369+
// FIXME(#4311): needs memory64 treatment
13701370
let ptr = src[0].get_u32();
13711371
let len = src[1].get_u32();
13721372
let (ptr, len) = (usize::try_from(ptr)?, usize::try_from(len)?);
@@ -1377,7 +1377,7 @@ unsafe impl Lift for WasmStr {
13771377
fn load(cx: &mut LiftContext<'_>, ty: InterfaceType, bytes: &[u8]) -> Result<Self> {
13781378
debug_assert!(matches!(ty, InterfaceType::String));
13791379
debug_assert!((bytes.as_ptr() as usize) % (Self::ALIGN32 as usize) == 0);
1380-
// FIXME: needs memory64 treatment
1380+
// FIXME(#4311): needs memory64 treatment
13811381
let ptr = u32::from_le_bytes(bytes[..4].try_into().unwrap());
13821382
let len = u32::from_le_bytes(bytes[4..].try_into().unwrap());
13831383
let (ptr, len) = (usize::try_from(ptr)?, usize::try_from(len)?);
@@ -1670,7 +1670,7 @@ unsafe impl<T: Lift> Lift for WasmList<T> {
16701670
InterfaceType::List(i) => cx.types[i].element,
16711671
_ => bad_type_info(),
16721672
};
1673-
// FIXME: needs memory64 treatment
1673+
// FIXME(#4311): needs memory64 treatment
16741674
let ptr = src[0].get_u32();
16751675
let len = src[1].get_u32();
16761676
let (ptr, len) = (usize::try_from(ptr)?, usize::try_from(len)?);
@@ -1683,7 +1683,7 @@ unsafe impl<T: Lift> Lift for WasmList<T> {
16831683
_ => bad_type_info(),
16841684
};
16851685
debug_assert!((bytes.as_ptr() as usize) % (Self::ALIGN32 as usize) == 0);
1686-
// FIXME: needs memory64 treatment
1686+
// FIXME(#4311): needs memory64 treatment
16871687
let ptr = u32::from_le_bytes(bytes[..4].try_into().unwrap());
16881688
let len = u32::from_le_bytes(bytes[4..].try_into().unwrap());
16891689
let (ptr, len) = (usize::try_from(ptr)?, usize::try_from(len)?);

crates/wasmtime/src/runtime/component/values.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Val {
113113
}
114114
InterfaceType::String => Val::String(<_>::lift(cx, ty, &[*next(src), *next(src)])?),
115115
InterfaceType::List(i) => {
116-
// FIXME: needs memory64 treatment
116+
// FIXME(#4311): needs memory64 treatment
117117
let ptr = u32::lift(cx, InterfaceType::U32, next(src))? as usize;
118118
let len = u32::lift(cx, InterfaceType::U32, next(src))? as usize;
119119
load_list(cx, i, ptr, len)?
@@ -221,7 +221,7 @@ impl Val {
221221
Val::Resource(ResourceAny::load(cx, ty, bytes)?)
222222
}
223223
InterfaceType::List(i) => {
224-
// FIXME: needs memory64 treatment
224+
// FIXME(#4311): needs memory64 treatment
225225
let ptr = u32::from_le_bytes(bytes[..4].try_into().unwrap()) as usize;
226226
let len = u32::from_le_bytes(bytes[4..].try_into().unwrap()) as usize;
227227
load_list(cx, i, ptr, len)?
@@ -477,7 +477,7 @@ impl Val {
477477
(InterfaceType::List(ty), Val::List(values)) => {
478478
let ty = &cx.types[ty];
479479
let (ptr, len) = lower_list(cx, ty.element, values)?;
480-
// FIXME: needs memory64 handling
480+
// FIXME(#4311): needs memory64 handling
481481
*cx.get(offset + 0) = u32::try_from(ptr).unwrap().to_le_bytes();
482482
*cx.get(offset + 4) = u32::try_from(len).unwrap().to_le_bytes();
483483
Ok(())

0 commit comments

Comments
 (0)