aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_proc.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-06-06 23:11:42 +0100
committergingerBill <bill@gingerbill.org>2023-06-06 23:11:42 +0100
commitca6cef9a7ddb1e3714cc9f5a43053bc7a240b115 (patch)
treebf2720a1535cd48cf919d6e33e0ed9f40de7c0ac /src/llvm_backend_proc.cpp
parent1c2a30d7e9a0f2ce29d2e8c2f06adf83d16779ac (diff)
Fix wasm intrinsics; fix `len` for strings and slices
Diffstat (limited to 'src/llvm_backend_proc.cpp')
-rw-r--r--src/llvm_backend_proc.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp
index ddae64ef0..f7298a4a6 100644
--- a/src/llvm_backend_proc.cpp
+++ b/src/llvm_backend_proc.cpp
@@ -2890,7 +2890,7 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
{
char const *name = "llvm.wasm.memory.grow";
LLVMTypeRef types[1] = {
- lb_type(p->module, t_uintptr),
+ lb_type(p->module, t_i32),
};
LLVMValueRef args[2] = {};
@@ -2898,24 +2898,24 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
args[1] = lb_emit_conv(p, lb_build_expr(p, ce->args[1]), t_uintptr).value;
lbValue res = {};
- res.type = tv.type;
+ res.type = t_i32;
res.value = lb_call_intrinsic(p, name, args, gb_count_of(args), types, gb_count_of(types));
- return res;
+ return lb_emit_conv(p, res, tv.type);
}
case BuiltinProc_wasm_memory_size:
{
char const *name = "llvm.wasm.memory.size";
LLVMTypeRef types[1] = {
- lb_type(p->module, t_uintptr),
+ lb_type(p->module, t_i32),
};
LLVMValueRef args[1] = {};
args[0] = lb_emit_conv(p, lb_build_expr(p, ce->args[0]), t_uintptr).value;
lbValue res = {};
- res.type = tv.type;
+ res.type = t_i32;
res.value = lb_call_intrinsic(p, name, args, gb_count_of(args), types, gb_count_of(types));
- return res;
+ return lb_emit_conv(p, res, tv.type);
}
case BuiltinProc_wasm_memory_atomic_wait32: