Turn VMMemoryDefinition::current_length into a u32.

The current wasm spec limits the size to 32-bits, and attempting to use a larger size causes problems with compiler-cranelift.
This commit is contained in:
Nick Lewycky
2020-08-19 18:04:12 -07:00
parent 5a6ecd4d00
commit 8a27a2938b
8 changed files with 26 additions and 15 deletions

View File

@@ -1033,6 +1033,8 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
format!("memory {} length", memory_index.as_u32()),
current_length.as_instruction_value().unwrap(),
);
let current_length =
builder.build_int_z_extend(current_length, intrinsics.i64_ty, "");
builder.build_int_compare(
IntPredicate::ULE,

View File

@@ -463,7 +463,7 @@ impl<'ctx> Intrinsics<'ctx> {
// TODO: this i64 is actually a rust usize
vmmemory_definition_ptr_ty: context
.struct_type(&[i8_ptr_ty_basic, i64_ty_basic], false)
.struct_type(&[i8_ptr_ty_basic, i32_ty_basic], false)
.ptr_type(AddressSpace::Generic),
vmmemory_definition_base_element: 0,
vmmemory_definition_current_length_element: 1,