mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-08 11:34:20 +00:00
Fix wasm intrinsics; fix len for strings and slices
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -932,6 +932,11 @@ gb_internal i32 lb_convert_struct_index(lbModule *m, Type *t, i32 index) {
|
||||
return field_remapping[index];
|
||||
} else if (build_context.ptr_size != build_context.int_size) {
|
||||
switch (t->kind) {
|
||||
case Type_Basic:
|
||||
if (t->Basic.kind != Basic_string) {
|
||||
break;
|
||||
}
|
||||
/*fallthrough*/
|
||||
case Type_Slice:
|
||||
GB_ASSERT(build_context.ptr_size*2 == build_context.int_size);
|
||||
switch (index) {
|
||||
|
||||
Reference in New Issue
Block a user