EMIT_FUNC(store_instruction, Type* type, u32 offset) {
bh_arr(WasmInstruction) code = *pcode;
+ while (type->kind == Type_Kind_Distinct) type = type->Distinct.base_type;
+
if (onyx_type_is_stored_in_memory(type)) {
emit_struct_store(mod, pcode, type, offset);
return;
if (type->kind == Type_Kind_Struct) type = type_struct_is_just_one_basic_value(type);
if (type->kind == Type_Kind_Enum) type = type->Enum.backing;
- while (type->kind == Type_Kind_Distinct) type = type->Distinct.base_type;
-
assert(type);
u32 alignment = type_get_alignment_log2(type);
EMIT_FUNC(load_instruction, Type* type, u32 offset) {
bh_arr(WasmInstruction) code = *pcode;
+ while (type->kind == Type_Kind_Distinct) type = type->Distinct.base_type;
+
if (type->kind == Type_Kind_Array || onyx_type_is_stored_in_memory(type)) {
if (offset != 0) {
WID(NULL, WI_PTR_CONST, offset);
if (type->kind == Type_Kind_Enum) type = type->Enum.backing;
if (type->kind == Type_Kind_Function) assert(1234 && 0);
- while (type->kind == Type_Kind_Distinct) type = type->Distinct.base_type;
-
assert(type);
i32 load_size = type_size_of(type);