Fix call_indirect.

This commit is contained in:
Nick Lewycky
2020-05-11 17:12:47 -07:00
parent fce8dacc10
commit 3b23ab2146
2 changed files with 9 additions and 9 deletions

View File

@@ -2425,7 +2425,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
};
// Load things from the anyfunc data structure.
let (func_ptr, ctx_ptr, found_dynamic_sigindex) = unsafe {
let (func_ptr, found_dynamic_sigindex, ctx_ptr) = unsafe {
(
builder
.build_load(
@@ -2435,20 +2435,20 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
"func_ptr",
)
.into_pointer_value(),
builder.build_load(
builder
.build_struct_gep(anyfunc_struct_ptr, 1, "ctx_ptr_ptr")
.unwrap(),
"ctx_ptr",
),
builder
.build_load(
builder
.build_struct_gep(anyfunc_struct_ptr, 2, "sigindex_ptr")
.build_struct_gep(anyfunc_struct_ptr, 1, "sigindex_ptr")
.unwrap(),
"sigindex",
)
.into_int_value(),
builder.build_load(
builder
.build_struct_gep(anyfunc_struct_ptr, 2, "ctx_ptr_ptr")
.unwrap(),
"ctx_ptr",
),
)
};

View File

@@ -258,8 +258,8 @@ impl<'ctx> Intrinsics<'ctx> {
let anyfunc_ty = context.struct_type(
&[
i8_ptr_ty_basic,
ctx_ptr_ty.as_basic_type_enum(),
sigindex_ty.as_basic_type_enum(),
ctx_ptr_ty.as_basic_type_enum(),
],
false,
);