| ... | @@ -862,6 +862,14 @@ pub const Context = struct { | ... | @@ -862,6 +862,14 @@ pub const Context = struct { |
| 862 | const lhs = self.resolveInst(inst.lhs); | 862 | const lhs = self.resolveInst(inst.lhs); |
| 863 | const rhs = self.resolveInst(inst.rhs); | 863 | const rhs = self.resolveInst(inst.rhs); |
| 864 | | 864 | |
| | 865 | // it's possible for both lhs and/or rhs to return an offset as well, |
| | 866 | // in which case we return the first offset occurance we find. |
| | 867 | const offset = blk: { |
| | 868 | if (lhs == .code_offset) break :blk lhs.code_offset; |
| | 869 | if (rhs == .code_offset) break :blk rhs.code_offset; |
| | 870 | break :blk self.code.items.len; |
| | 871 | }; |
| | 872 | |
| 865 | try self.emitWValue(lhs); | 873 | try self.emitWValue(lhs); |
| 866 | try self.emitWValue(rhs); | 874 | try self.emitWValue(rhs); |
| 867 | | 875 | |
| ... | @@ -871,7 +879,7 @@ pub const Context = struct { | ... | @@ -871,7 +879,7 @@ pub const Context = struct { |
| 871 | .signedness = if (inst.base.ty.isSignedInt()) .signed else .unsigned, | 879 | .signedness = if (inst.base.ty.isSignedInt()) .signed else .unsigned, |
| 872 | }); | 880 | }); |
| 873 | try self.code.append(wasm.opcode(opcode)); | 881 | try self.code.append(wasm.opcode(opcode)); |
| 874 | return .none; | 882 | return WValue{ .code_offset = offset }; |
| 875 | } | 883 | } |
| 876 | | 884 | |
| 877 | fn emitConstant(self: *Context, src: LazySrcLoc, value: Value, ty: Type) InnerError!void { | 885 | fn emitConstant(self: *Context, src: LazySrcLoc, value: Value, ty: Type) InnerError!void { |