| ... | @@ -632,7 +632,7 @@ fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!WValue { | ... | @@ -632,7 +632,7 @@ fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!WValue { |
| 632 | // means we must generate it from a constant. | 632 | // means we must generate it from a constant. |
| 633 | const val = self.air.value(ref).?; | 633 | const val = self.air.value(ref).?; |
| 634 | const ty = self.air.typeOf(ref); | 634 | const ty = self.air.typeOf(ref); |
| 635 | if (!ty.hasRuntimeBits() and !ty.isInt()) { | 635 | if (!ty.hasRuntimeBitsIgnoreComptime() and !ty.isInt()) { |
| 636 | gop.value_ptr.* = WValue{ .none = {} }; | 636 | gop.value_ptr.* = WValue{ .none = {} }; |
| 637 | return gop.value_ptr.*; | 637 | return gop.value_ptr.*; |
| 638 | } | 638 | } |
| ... | @@ -805,13 +805,13 @@ fn genFunctype(gpa: Allocator, fn_ty: Type, target: std.Target) !wasm.Type { | ... | @@ -805,13 +805,13 @@ fn genFunctype(gpa: Allocator, fn_ty: Type, target: std.Target) !wasm.Type { |
| 805 | defer gpa.free(fn_params); | 805 | defer gpa.free(fn_params); |
| 806 | fn_ty.fnParamTypes(fn_params); | 806 | fn_ty.fnParamTypes(fn_params); |
| 807 | for (fn_params) |param_type| { | 807 | for (fn_params) |param_type| { |
| 808 | if (!param_type.hasRuntimeBits()) continue; | 808 | if (!param_type.hasRuntimeBitsIgnoreComptime()) continue; |
| 809 | try params.append(typeToValtype(param_type, target)); | 809 | try params.append(typeToValtype(param_type, target)); |
| 810 | } | 810 | } |
| 811 | } | 811 | } |
| 812 | | 812 | |
| 813 | // return type | 813 | // return type |
| 814 | if (!want_sret and return_type.hasRuntimeBits()) { | 814 | if (!want_sret and return_type.hasRuntimeBitsIgnoreComptime()) { |
| 815 | try returns.append(typeToValtype(return_type, target)); | 815 | try returns.append(typeToValtype(return_type, target)); |
| 816 | } | 816 | } |
| 817 | | 817 | |
| ... | @@ -970,7 +970,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) InnerError!CallWValu | ... | @@ -970,7 +970,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) InnerError!CallWValu |
| 970 | .Naked => return result, | 970 | .Naked => return result, |
| 971 | .Unspecified, .C => { | 971 | .Unspecified, .C => { |
| 972 | for (param_types) |ty| { | 972 | for (param_types) |ty| { |
| 973 | if (!ty.hasRuntimeBits()) { | 973 | if (!ty.hasRuntimeBitsIgnoreComptime()) { |
| 974 | continue; | 974 | continue; |
| 975 | } | 975 | } |
| 976 | | 976 | |
| ... | @@ -1015,7 +1015,7 @@ fn restoreStackPointer(self: *Self) !void { | ... | @@ -1015,7 +1015,7 @@ fn restoreStackPointer(self: *Self) !void { |
| 1015 | /// | 1015 | /// |
| 1016 | /// Asserts Type has codegenbits | 1016 | /// Asserts Type has codegenbits |
| 1017 | fn allocStack(self: *Self, ty: Type) !WValue { | 1017 | fn allocStack(self: *Self, ty: Type) !WValue { |
| 1018 | assert(ty.hasRuntimeBits()); | 1018 | assert(ty.hasRuntimeBitsIgnoreComptime()); |
| 1019 | if (self.initial_stack_value == .none) { | 1019 | if (self.initial_stack_value == .none) { |
| 1020 | try self.initializeStack(); | 1020 | try self.initializeStack(); |
| 1021 | } | 1021 | } |
| ... | @@ -1049,7 +1049,7 @@ fn allocStackPtr(self: *Self, inst: Air.Inst.Index) !WValue { | ... | @@ -1049,7 +1049,7 @@ fn allocStackPtr(self: *Self, inst: Air.Inst.Index) !WValue { |
| 1049 | try self.initializeStack(); | 1049 | try self.initializeStack(); |
| 1050 | } | 1050 | } |
| 1051 | | 1051 | |
| 1052 | if (!pointee_ty.hasRuntimeBits()) { | 1052 | if (!pointee_ty.hasRuntimeBitsIgnoreComptime()) { |
| 1053 | return self.allocStack(Type.usize); // create a value containing just the stack pointer. | 1053 | return self.allocStack(Type.usize); // create a value containing just the stack pointer. |
| 1054 | } | 1054 | } |
| 1055 | | 1055 | |
| ... | @@ -1235,18 +1235,18 @@ fn isByRef(ty: Type, target: std.Target) bool { | ... | @@ -1235,18 +1235,18 @@ fn isByRef(ty: Type, target: std.Target) bool { |
| 1235 | .Struct, | 1235 | .Struct, |
| 1236 | .Frame, | 1236 | .Frame, |
| 1237 | .Union, | 1237 | .Union, |
| 1238 | => return ty.hasRuntimeBits(), | 1238 | => return ty.hasRuntimeBitsIgnoreComptime(), |
| 1239 | .Int => return if (ty.intInfo(target).bits > 64) true else false, | 1239 | .Int => return if (ty.intInfo(target).bits > 64) true else false, |
| 1240 | .ErrorUnion => { | 1240 | .ErrorUnion => { |
| 1241 | const has_tag = ty.errorUnionSet().hasRuntimeBits(); | 1241 | const has_tag = ty.errorUnionSet().hasRuntimeBitsIgnoreComptime(); |
| 1242 | const has_pl = ty.errorUnionPayload().hasRuntimeBits(); | 1242 | const has_pl = ty.errorUnionPayload().hasRuntimeBitsIgnoreComptime(); |
| 1243 | if (!has_tag or !has_pl) return false; | 1243 | if (!has_tag or !has_pl) return false; |
| 1244 | return ty.hasRuntimeBits(); | 1244 | return ty.hasRuntimeBitsIgnoreComptime(); |
| 1245 | }, | 1245 | }, |
| 1246 | .Optional => { | 1246 | .Optional => { |
| 1247 | if (ty.isPtrLikeOptional()) return false; | 1247 | if (ty.isPtrLikeOptional()) return false; |
| 1248 | var buf: Type.Payload.ElemType = undefined; | 1248 | var buf: Type.Payload.ElemType = undefined; |
| 1249 | return ty.optionalChild(&buf).hasRuntimeBits(); | 1249 | return ty.optionalChild(&buf).hasRuntimeBitsIgnoreComptime(); |
| 1250 | }, | 1250 | }, |
| 1251 | .Pointer => { | 1251 | .Pointer => { |
| 1252 | // Slices act like struct and will be passed by reference | 1252 | // Slices act like struct and will be passed by reference |
| ... | @@ -1511,7 +1511,7 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -1511,7 +1511,7 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 1511 | const un_op = self.air.instructions.items(.data)[inst].un_op; | 1511 | const un_op = self.air.instructions.items(.data)[inst].un_op; |
| 1512 | const operand = try self.resolveInst(un_op); | 1512 | const operand = try self.resolveInst(un_op); |
| 1513 | const ret_ty = self.air.typeOf(un_op).childType(); | 1513 | const ret_ty = self.air.typeOf(un_op).childType(); |
| 1514 | if (!ret_ty.hasRuntimeBits()) return WValue.none; | 1514 | if (!ret_ty.hasRuntimeBitsIgnoreComptime()) return WValue.none; |
| 1515 | | 1515 | |
| 1516 | if (!isByRef(ret_ty, self.target)) { | 1516 | if (!isByRef(ret_ty, self.target)) { |
| 1517 | const result = try self.load(operand, ret_ty, 0); | 1517 | const result = try self.load(operand, ret_ty, 0); |
| ... | @@ -1567,7 +1567,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. | ... | @@ -1567,7 +1567,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. |
| 1567 | const arg_val = try self.resolveInst(arg_ref); | 1567 | const arg_val = try self.resolveInst(arg_ref); |
| 1568 | | 1568 | |
| 1569 | const arg_ty = self.air.typeOf(arg_ref); | 1569 | const arg_ty = self.air.typeOf(arg_ref); |
| 1570 | if (!arg_ty.hasRuntimeBits()) continue; | 1570 | if (!arg_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 1571 | | 1571 | |
| 1572 | switch (arg_val) { | 1572 | switch (arg_val) { |
| 1573 | .stack_offset => try self.emitWValue(try self.buildPointerOffset(arg_val, 0, .new)), | 1573 | .stack_offset => try self.emitWValue(try self.buildPointerOffset(arg_val, 0, .new)), |
| ... | @@ -1591,7 +1591,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. | ... | @@ -1591,7 +1591,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallOptions. |
| 1591 | try self.addLabel(.call_indirect, fn_type_index); | 1591 | try self.addLabel(.call_indirect, fn_type_index); |
| 1592 | } | 1592 | } |
| 1593 | | 1593 | |
| 1594 | if (self.liveness.isUnused(inst) or !ret_ty.hasRuntimeBits()) { | 1594 | if (self.liveness.isUnused(inst) or !ret_ty.hasRuntimeBitsIgnoreComptime()) { |
| 1595 | return WValue.none; | 1595 | return WValue.none; |
| 1596 | } else if (ret_ty.isNoReturn()) { | 1596 | } else if (ret_ty.isNoReturn()) { |
| 1597 | try self.addTag(.@"unreachable"); | 1597 | try self.addTag(.@"unreachable"); |
| ... | @@ -1625,7 +1625,7 @@ fn store(self: *Self, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErro | ... | @@ -1625,7 +1625,7 @@ fn store(self: *Self, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErro |
| 1625 | .ErrorUnion => { | 1625 | .ErrorUnion => { |
| 1626 | const err_ty = ty.errorUnionSet(); | 1626 | const err_ty = ty.errorUnionSet(); |
| 1627 | const pl_ty = ty.errorUnionPayload(); | 1627 | const pl_ty = ty.errorUnionPayload(); |
| 1628 | if (!pl_ty.hasRuntimeBits()) { | 1628 | if (!pl_ty.hasRuntimeBitsIgnoreComptime()) { |
| 1629 | return self.store(lhs, rhs, err_ty, 0); | 1629 | return self.store(lhs, rhs, err_ty, 0); |
| 1630 | } | 1630 | } |
| 1631 | | 1631 | |
| ... | @@ -1638,7 +1638,7 @@ fn store(self: *Self, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErro | ... | @@ -1638,7 +1638,7 @@ fn store(self: *Self, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErro |
| 1638 | } | 1638 | } |
| 1639 | var buf: Type.Payload.ElemType = undefined; | 1639 | var buf: Type.Payload.ElemType = undefined; |
| 1640 | const pl_ty = ty.optionalChild(&buf); | 1640 | const pl_ty = ty.optionalChild(&buf); |
| 1641 | if (!pl_ty.hasRuntimeBits()) { | 1641 | if (!pl_ty.hasRuntimeBitsIgnoreComptime()) { |
| 1642 | return self.store(lhs, rhs, Type.u8, 0); | 1642 | return self.store(lhs, rhs, Type.u8, 0); |
| 1643 | } | 1643 | } |
| 1644 | | 1644 | |
| ... | @@ -1696,7 +1696,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -1696,7 +1696,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 1696 | const operand = try self.resolveInst(ty_op.operand); | 1696 | const operand = try self.resolveInst(ty_op.operand); |
| 1697 | const ty = self.air.getRefType(ty_op.ty); | 1697 | const ty = self.air.getRefType(ty_op.ty); |
| 1698 | | 1698 | |
| 1699 | if (!ty.hasRuntimeBits()) return WValue{ .none = {} }; | 1699 | if (!ty.hasRuntimeBitsIgnoreComptime()) return WValue{ .none = {} }; |
| 1700 | | 1700 | |
| 1701 | if (isByRef(ty, self.target)) { | 1701 | if (isByRef(ty, self.target)) { |
| 1702 | const new_local = try self.allocStack(ty); | 1702 | const new_local = try self.allocStack(ty); |
| ... | @@ -2200,7 +2200,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: std.math.CompareOperator) Inner | ... | @@ -2200,7 +2200,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: std.math.CompareOperator) Inner |
| 2200 | if (operand_ty.zigTypeTag() == .Optional and !operand_ty.isPtrLikeOptional()) { | 2200 | if (operand_ty.zigTypeTag() == .Optional and !operand_ty.isPtrLikeOptional()) { |
| 2201 | var buf: Type.Payload.ElemType = undefined; | 2201 | var buf: Type.Payload.ElemType = undefined; |
| 2202 | const payload_ty = operand_ty.optionalChild(&buf); | 2202 | const payload_ty = operand_ty.optionalChild(&buf); |
| 2203 | if (payload_ty.hasRuntimeBits()) { | 2203 | if (payload_ty.hasRuntimeBitsIgnoreComptime()) { |
| 2204 | // When we hit this case, we must check the value of optionals | 2204 | // When we hit this case, we must check the value of optionals |
| 2205 | // that are not pointers. This means first checking against non-null for | 2205 | // that are not pointers. This means first checking against non-null for |
| 2206 | // both lhs and rhs, as well as checking the payload are matching of lhs and rhs | 2206 | // both lhs and rhs, as well as checking the payload are matching of lhs and rhs |
| ... | @@ -2257,7 +2257,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -2257,7 +2257,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 2257 | const block = self.blocks.get(br.block_inst).?; | 2257 | const block = self.blocks.get(br.block_inst).?; |
| 2258 | | 2258 | |
| 2259 | // if operand has codegen bits we should break with a value | 2259 | // if operand has codegen bits we should break with a value |
| 2260 | if (self.air.typeOf(br.operand).hasRuntimeBits()) { | 2260 | if (self.air.typeOf(br.operand).hasRuntimeBitsIgnoreComptime()) { |
| 2261 | const operand = try self.resolveInst(br.operand); | 2261 | const operand = try self.resolveInst(br.operand); |
| 2262 | const op = switch (operand) { | 2262 | const op = switch (operand) { |
| 2263 | .stack_offset => try self.buildPointerOffset(operand, 0, .new), | 2263 | .stack_offset => try self.buildPointerOffset(operand, 0, .new), |
| ... | @@ -2357,7 +2357,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -2357,7 +2357,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 2357 | const operand = try self.resolveInst(struct_field.struct_operand); | 2357 | const operand = try self.resolveInst(struct_field.struct_operand); |
| 2358 | const field_index = struct_field.field_index; | 2358 | const field_index = struct_field.field_index; |
| 2359 | const field_ty = struct_ty.structFieldType(field_index); | 2359 | const field_ty = struct_ty.structFieldType(field_index); |
| 2360 | if (!field_ty.hasRuntimeBits()) return WValue{ .none = {} }; | 2360 | if (!field_ty.hasRuntimeBitsIgnoreComptime()) return WValue{ .none = {} }; |
| 2361 | const offset = std.math.cast(u32, struct_ty.structFieldOffset(field_index, self.target)) catch { | 2361 | const offset = std.math.cast(u32, struct_ty.structFieldOffset(field_index, self.target)) catch { |
| 2362 | return self.fail("Field type '{}' too big to fit into stack frame", .{field_ty.fmt(self.target)}); | 2362 | return self.fail("Field type '{}' too big to fit into stack frame", .{field_ty.fmt(self.target)}); |
| 2363 | }; | 2363 | }; |
| ... | @@ -2544,7 +2544,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerError!W | ... | @@ -2544,7 +2544,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerError!W |
| 2544 | | 2544 | |
| 2545 | // load the error tag value | 2545 | // load the error tag value |
| 2546 | try self.emitWValue(operand); | 2546 | try self.emitWValue(operand); |
| 2547 | if (pl_ty.hasRuntimeBits()) { | 2547 | if (pl_ty.hasRuntimeBitsIgnoreComptime()) { |
| 2548 | try self.addMemArg(.i32_load16_u, .{ | 2548 | try self.addMemArg(.i32_load16_u, .{ |
| 2549 | .offset = operand.offset(), | 2549 | .offset = operand.offset(), |
| 2550 | .alignment = err_ty.errorUnionSet().abiAlignment(self.target), | 2550 | .alignment = err_ty.errorUnionSet().abiAlignment(self.target), |
| ... | @@ -2567,7 +2567,7 @@ fn airUnwrapErrUnionPayload(self: *Self, inst: Air.Inst.Index, op_is_ptr: bool) | ... | @@ -2567,7 +2567,7 @@ fn airUnwrapErrUnionPayload(self: *Self, inst: Air.Inst.Index, op_is_ptr: bool) |
| 2567 | const op_ty = self.air.typeOf(ty_op.operand); | 2567 | const op_ty = self.air.typeOf(ty_op.operand); |
| 2568 | const err_ty = if (op_is_ptr) op_ty.childType() else op_ty; | 2568 | const err_ty = if (op_is_ptr) op_ty.childType() else op_ty; |
| 2569 | const payload_ty = err_ty.errorUnionPayload(); | 2569 | const payload_ty = err_ty.errorUnionPayload(); |
| 2570 | if (!payload_ty.hasRuntimeBits()) return WValue{ .none = {} }; | 2570 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) return WValue{ .none = {} }; |
| 2571 | const err_align = err_ty.abiAlignment(self.target); | 2571 | const err_align = err_ty.abiAlignment(self.target); |
| 2572 | const set_size = err_ty.errorUnionSet().abiSize(self.target); | 2572 | const set_size = err_ty.errorUnionSet().abiSize(self.target); |
| 2573 | const offset = mem.alignForwardGeneric(u64, set_size, err_align); | 2573 | const offset = mem.alignForwardGeneric(u64, set_size, err_align); |
| ... | @@ -2585,7 +2585,7 @@ fn airUnwrapErrUnionError(self: *Self, inst: Air.Inst.Index, op_is_ptr: bool) In | ... | @@ -2585,7 +2585,7 @@ fn airUnwrapErrUnionError(self: *Self, inst: Air.Inst.Index, op_is_ptr: bool) In |
| 2585 | const op_ty = self.air.typeOf(ty_op.operand); | 2585 | const op_ty = self.air.typeOf(ty_op.operand); |
| 2586 | const err_ty = if (op_is_ptr) op_ty.childType() else op_ty; | 2586 | const err_ty = if (op_is_ptr) op_ty.childType() else op_ty; |
| 2587 | const payload_ty = err_ty.errorUnionPayload(); | 2587 | const payload_ty = err_ty.errorUnionPayload(); |
| 2588 | if (op_is_ptr or !payload_ty.hasRuntimeBits()) { | 2588 | if (op_is_ptr or !payload_ty.hasRuntimeBitsIgnoreComptime()) { |
| 2589 | return operand; | 2589 | return operand; |
| 2590 | } | 2590 | } |
| 2591 | | 2591 | |
| ... | @@ -2599,7 +2599,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -2599,7 +2599,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 2599 | const operand = try self.resolveInst(ty_op.operand); | 2599 | const operand = try self.resolveInst(ty_op.operand); |
| 2600 | | 2600 | |
| 2601 | const op_ty = self.air.typeOf(ty_op.operand); | 2601 | const op_ty = self.air.typeOf(ty_op.operand); |
| 2602 | if (!op_ty.hasRuntimeBits()) return operand; | 2602 | if (!op_ty.hasRuntimeBitsIgnoreComptime()) return operand; |
| 2603 | const err_ty = self.air.getRefType(ty_op.ty); | 2603 | const err_ty = self.air.getRefType(ty_op.ty); |
| 2604 | const err_align = err_ty.abiAlignment(self.target); | 2604 | const err_align = err_ty.abiAlignment(self.target); |
| 2605 | const set_size = err_ty.errorUnionSet().abiSize(self.target); | 2605 | const set_size = err_ty.errorUnionSet().abiSize(self.target); |
| ... | @@ -2624,7 +2624,7 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -2624,7 +2624,7 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 2624 | const operand = try self.resolveInst(ty_op.operand); | 2624 | const operand = try self.resolveInst(ty_op.operand); |
| 2625 | const err_ty = self.air.getRefType(ty_op.ty); | 2625 | const err_ty = self.air.getRefType(ty_op.ty); |
| 2626 | | 2626 | |
| 2627 | if (!err_ty.errorUnionPayload().hasRuntimeBits()) return operand; | 2627 | if (!err_ty.errorUnionPayload().hasRuntimeBitsIgnoreComptime()) return operand; |
| 2628 | | 2628 | |
| 2629 | const err_union = try self.allocStack(err_ty); | 2629 | const err_union = try self.allocStack(err_ty); |
| 2630 | try self.store(err_union, operand, err_ty.errorUnionSet(), 0); | 2630 | try self.store(err_union, operand, err_ty.errorUnionSet(), 0); |
| ... | @@ -2690,7 +2690,7 @@ fn isNull(self: *Self, operand: WValue, optional_ty: Type, opcode: wasm.Opcode) | ... | @@ -2690,7 +2690,7 @@ fn isNull(self: *Self, operand: WValue, optional_ty: Type, opcode: wasm.Opcode) |
| 2690 | const payload_ty = optional_ty.optionalChild(&buf); | 2690 | const payload_ty = optional_ty.optionalChild(&buf); |
| 2691 | // When payload is zero-bits, we can treat operand as a value, rather than | 2691 | // When payload is zero-bits, we can treat operand as a value, rather than |
| 2692 | // a pointer to the stack value | 2692 | // a pointer to the stack value |
| 2693 | if (payload_ty.hasRuntimeBits()) { | 2693 | if (payload_ty.hasRuntimeBitsIgnoreComptime()) { |
| 2694 | try self.addMemArg(.i32_load8_u, .{ .offset = operand.offset(), .alignment = 1 }); | 2694 | try self.addMemArg(.i32_load8_u, .{ .offset = operand.offset(), .alignment = 1 }); |
| 2695 | } | 2695 | } |
| 2696 | } | 2696 | } |
| ... | @@ -2710,7 +2710,7 @@ fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -2710,7 +2710,7 @@ fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 2710 | const operand = try self.resolveInst(ty_op.operand); | 2710 | const operand = try self.resolveInst(ty_op.operand); |
| 2711 | const opt_ty = self.air.typeOf(ty_op.operand); | 2711 | const opt_ty = self.air.typeOf(ty_op.operand); |
| 2712 | const payload_ty = self.air.typeOfIndex(inst); | 2712 | const payload_ty = self.air.typeOfIndex(inst); |
| 2713 | if (!payload_ty.hasRuntimeBits()) return WValue{ .none = {} }; | 2713 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) return WValue{ .none = {} }; |
| 2714 | if (opt_ty.isPtrLikeOptional()) return operand; | 2714 | if (opt_ty.isPtrLikeOptional()) return operand; |
| 2715 | | 2715 | |
| 2716 | const offset = opt_ty.abiSize(self.target) - payload_ty.abiSize(self.target); | 2716 | const offset = opt_ty.abiSize(self.target) - payload_ty.abiSize(self.target); |
| ... | @@ -2731,7 +2731,7 @@ fn airOptionalPayloadPtr(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -2731,7 +2731,7 @@ fn airOptionalPayloadPtr(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 2731 | | 2731 | |
| 2732 | var buf: Type.Payload.ElemType = undefined; | 2732 | var buf: Type.Payload.ElemType = undefined; |
| 2733 | const payload_ty = opt_ty.optionalChild(&buf); | 2733 | const payload_ty = opt_ty.optionalChild(&buf); |
| 2734 | if (!payload_ty.hasRuntimeBits() or opt_ty.isPtrLikeOptional()) { | 2734 | if (!payload_ty.hasRuntimeBitsIgnoreComptime() or opt_ty.isPtrLikeOptional()) { |
| 2735 | return operand; | 2735 | return operand; |
| 2736 | } | 2736 | } |
| 2737 | | 2737 | |
| ... | @@ -2745,7 +2745,7 @@ fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) InnerError!WValue | ... | @@ -2745,7 +2745,7 @@ fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) InnerError!WValue |
| 2745 | const opt_ty = self.air.typeOf(ty_op.operand).childType(); | 2745 | const opt_ty = self.air.typeOf(ty_op.operand).childType(); |
| 2746 | var buf: Type.Payload.ElemType = undefined; | 2746 | var buf: Type.Payload.ElemType = undefined; |
| 2747 | const payload_ty = opt_ty.optionalChild(&buf); | 2747 | const payload_ty = opt_ty.optionalChild(&buf); |
| 2748 | if (!payload_ty.hasRuntimeBits()) { | 2748 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) { |
| 2749 | return self.fail("TODO: Implement OptionalPayloadPtrSet for optional with zero-sized type {}", .{payload_ty.fmtDebug()}); | 2749 | return self.fail("TODO: Implement OptionalPayloadPtrSet for optional with zero-sized type {}", .{payload_ty.fmtDebug()}); |
| 2750 | } | 2750 | } |
| 2751 | | 2751 | |
| ... | @@ -2769,7 +2769,7 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -2769,7 +2769,7 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 2769 | | 2769 | |
| 2770 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 2770 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 2771 | const payload_ty = self.air.typeOf(ty_op.operand); | 2771 | const payload_ty = self.air.typeOf(ty_op.operand); |
| 2772 | if (!payload_ty.hasRuntimeBits()) { | 2772 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) { |
| 2773 | const non_null_bit = try self.allocStack(Type.initTag(.u1)); | 2773 | const non_null_bit = try self.allocStack(Type.initTag(.u1)); |
| 2774 | try self.emitWValue(non_null_bit); | 2774 | try self.emitWValue(non_null_bit); |
| 2775 | try self.addImm32(1); | 2775 | try self.addImm32(1); |
| ... | @@ -2958,7 +2958,7 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -2958,7 +2958,7 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 2958 | const slice_local = try self.allocStack(slice_ty); | 2958 | const slice_local = try self.allocStack(slice_ty); |
| 2959 | | 2959 | |
| 2960 | // store the array ptr in the slice | 2960 | // store the array ptr in the slice |
| 2961 | if (array_ty.hasRuntimeBits()) { | 2961 | if (array_ty.hasRuntimeBitsIgnoreComptime()) { |
| 2962 | try self.store(slice_local, operand, Type.usize, 0); | 2962 | try self.store(slice_local, operand, Type.usize, 0); |
| 2963 | } | 2963 | } |
| 2964 | | 2964 | |
| ... | @@ -3408,7 +3408,7 @@ fn airWasmMemoryGrow(self: *Self, inst: Air.Inst.Index) !WValue { | ... | @@ -3408,7 +3408,7 @@ fn airWasmMemoryGrow(self: *Self, inst: Air.Inst.Index) !WValue { |
| 3408 | } | 3408 | } |
| 3409 | | 3409 | |
| 3410 | fn cmpOptionals(self: *Self, lhs: WValue, rhs: WValue, operand_ty: Type, op: std.math.CompareOperator) InnerError!WValue { | 3410 | fn cmpOptionals(self: *Self, lhs: WValue, rhs: WValue, operand_ty: Type, op: std.math.CompareOperator) InnerError!WValue { |
| 3411 | assert(operand_ty.hasRuntimeBits()); | 3411 | assert(operand_ty.hasRuntimeBitsIgnoreComptime()); |
| 3412 | assert(op == .eq or op == .neq); | 3412 | assert(op == .eq or op == .neq); |
| 3413 | var buf: Type.Payload.ElemType = undefined; | 3413 | var buf: Type.Payload.ElemType = undefined; |
| 3414 | const payload_ty = operand_ty.optionalChild(&buf); | 3414 | const payload_ty = operand_ty.optionalChild(&buf); |
| ... | @@ -3575,7 +3575,7 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) InnerError!WValue | ... | @@ -3575,7 +3575,7 @@ fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) InnerError!WValue |
| 3575 | | 3575 | |
| 3576 | if (self.liveness.isUnused(inst)) return WValue{ .none = {} }; | 3576 | if (self.liveness.isUnused(inst)) return WValue{ .none = {} }; |
| 3577 | | 3577 | |
| 3578 | if (!payload_ty.hasRuntimeBits()) { | 3578 | if (!payload_ty.hasRuntimeBitsIgnoreComptime()) { |
| 3579 | return operand; | 3579 | return operand; |
| 3580 | } | 3580 | } |
| 3581 | | 3581 | |