mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-24 17:29:26 +00:00
Fix dynamic memory styles in llvm.
Dynamic memory has the same struct as static memory, in particular the length field is not a pointer to a length field. Also, send the correct trap code.
This commit is contained in:
@ -1000,7 +1000,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
{
|
||||
MemoryCache::Dynamic {
|
||||
ptr_to_base_ptr,
|
||||
current_length_ptr,
|
||||
ptr_to_current_length,
|
||||
} => {
|
||||
// Bounds check it.
|
||||
let minimum = self.wasm_module.memories[memory_index].minimum;
|
||||
@ -1024,8 +1024,9 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
.unwrap_or_else(|| {
|
||||
let load_offset_end = builder.build_int_add(offset, value_size_v, "");
|
||||
|
||||
let current_length =
|
||||
builder.build_load(current_length_ptr, "").into_int_value();
|
||||
let current_length = builder
|
||||
.build_load(ptr_to_current_length, "")
|
||||
.into_int_value();
|
||||
tbaa_label(
|
||||
self.module,
|
||||
self.intrinsics,
|
||||
@ -1053,7 +1054,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
intrinsics.expect_i1,
|
||||
&[
|
||||
ptr_in_bounds.as_basic_value_enum(),
|
||||
intrinsics.i1_ty.const_int(1, false).as_basic_value_enum(),
|
||||
intrinsics.i1_ty.const_int(1, true).as_basic_value_enum(),
|
||||
],
|
||||
"ptr_in_bounds_expect",
|
||||
)
|
||||
|
Reference in New Issue
Block a user