| ... | @@ -795,11 +795,7 @@ pub const Context = struct { | ... | @@ -795,11 +795,7 @@ pub const Context = struct { |
| 795 | | 795 | |
| 796 | fn genAlloc(self: *Context, inst: *Inst.NoOp) InnerError!WValue { | 796 | fn genAlloc(self: *Context, inst: *Inst.NoOp) InnerError!WValue { |
| 797 | const elem_type = inst.base.ty.elemType(); | 797 | const elem_type = inst.base.ty.elemType(); |
| 798 | const valtype = try self.genValtype(inst.base.src, elem_type); | | |
| 799 | try self.locals.append(self.gpa, valtype); | | |
| 800 | | | |
| 801 | const local_value = WValue{ .local = self.local_index }; | 798 | const local_value = WValue{ .local = self.local_index }; |
| 802 | self.local_index += 1; | | |
| 803 | | 799 | |
| 804 | switch (elem_type.zigTypeTag()) { | 800 | switch (elem_type.zigTypeTag()) { |
| 805 | .Struct => { | 801 | .Struct => { |
| ... | @@ -816,7 +812,11 @@ pub const Context = struct { | ... | @@ -816,7 +812,11 @@ pub const Context = struct { |
| 816 | } | 812 | } |
| 817 | }, | 813 | }, |
| 818 | // TODO: Add more types that require extra locals such as optionals | 814 | // TODO: Add more types that require extra locals such as optionals |
| 819 | else => {}, | 815 | else => { |
| | 816 | const valtype = try self.genValtype(inst.base.src, elem_type); |
| | 817 | try self.locals.append(self.gpa, valtype); |
| | 818 | self.local_index += 1; |
| | 819 | }, |
| 820 | } | 820 | } |
| 821 | | 821 | |
| 822 | return local_value; | 822 | return local_value; |
| ... | @@ -1115,6 +1115,6 @@ pub const Context = struct { | ... | @@ -1115,6 +1115,6 @@ pub const Context = struct { |
| 1115 | fn genStructFieldPtr(self: *Context, inst: *Inst.StructFieldPtr) InnerError!WValue { | 1115 | fn genStructFieldPtr(self: *Context, inst: *Inst.StructFieldPtr) InnerError!WValue { |
| 1116 | const struct_ptr = self.resolveInst(inst.struct_ptr); | 1116 | const struct_ptr = self.resolveInst(inst.struct_ptr); |
| 1117 | | 1117 | |
| 1118 | return WValue{ .local = struct_ptr.local + @intCast(u32, inst.field_index) + 1 }; | 1118 | return WValue{ .local = struct_ptr.local + @intCast(u32, inst.field_index) }; |
| 1119 | } | 1119 | } |
| 1120 | }; | 1120 | }; |