| ... | @@ -1999,15 +1999,17 @@ fn resolveMaybeUndefValAllowVariablesMaybeRuntime( | ... | @@ -1999,15 +1999,17 @@ fn resolveMaybeUndefValAllowVariablesMaybeRuntime( |
| 1999 | return opv; | 1999 | return opv; |
| 2000 | } | 2000 | } |
| 2001 | const air_datas = sema.air_instructions.items(.data); | 2001 | const air_datas = sema.air_instructions.items(.data); |
| 2002 | switch (air_tags[i]) { | 2002 | const val = switch (air_tags[i]) { |
| 2003 | .interned => { | 2003 | .inferred_alloc, .inferred_alloc_comptime => val: { |
| 2004 | const val = air_datas[i].interned.toValue(); | 2004 | const ty_pl = sema.air_instructions.items(.data)[i].ty_pl; |
| 2005 | if (val.isRuntimeValue(sema.mod)) make_runtime.* = true; | 2005 | break :val sema.air_values.items[ty_pl.payload]; |
| 2006 | if (val.isPtrToThreadLocal(sema.mod)) make_runtime.* = true; | | |
| 2007 | return val; | | |
| 2008 | }, | 2006 | }, |
| | 2007 | .interned => air_datas[i].interned.toValue(), |
| 2009 | else => return null, | 2008 | else => return null, |
| 2010 | } | 2009 | }; |
| | 2010 | if (val.isRuntimeValue(sema.mod)) make_runtime.* = true; |
| | 2011 | if (val.isPtrToThreadLocal(sema.mod)) make_runtime.* = true; |
| | 2012 | return val; |
| 2011 | } | 2013 | } |
| 2012 | | 2014 | |
| 2013 | fn failWithNeededComptime(sema: *Sema, block: *Block, src: LazySrcLoc, reason: []const u8) CompileError { | 2015 | fn failWithNeededComptime(sema: *Sema, block: *Block, src: LazySrcLoc, reason: []const u8) CompileError { |
| ... | @@ -3762,13 +3764,17 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -3762,13 +3764,17 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3762 | sema.air_instructions.items(.data)[ptr_inst].ty_pl.ty = final_ptr_ty_inst; | 3764 | sema.air_instructions.items(.data)[ptr_inst].ty_pl.ty = final_ptr_ty_inst; |
| 3763 | | 3765 | |
| 3764 | try sema.maybeQueueFuncBodyAnalysis(decl_index); | 3766 | try sema.maybeQueueFuncBodyAnalysis(decl_index); |
| 3765 | sema.air_values.items[value_index] = (try sema.mod.intern(.{ .ptr = .{ | 3767 | // Change it to an interned. |
| 3766 | .ty = final_ptr_ty.toIntern(), | 3768 | sema.air_instructions.set(ptr_inst, .{ |
| 3767 | .addr = if (var_is_mut) .{ .mut_decl = .{ | 3769 | .tag = .interned, |
| 3768 | .decl = decl_index, | 3770 | .data = .{ .interned = try sema.mod.intern(.{ .ptr = .{ |
| 3769 | .runtime_index = block.runtime_index, | 3771 | .ty = final_ptr_ty.toIntern(), |
| 3770 | } } else .{ .decl = decl_index }, | 3772 | .addr = if (var_is_mut) .{ .mut_decl = .{ |
| 3771 | } })).toValue(); | 3773 | .decl = decl_index, |
| | 3774 | .runtime_index = block.runtime_index, |
| | 3775 | } } else .{ .decl = decl_index }, |
| | 3776 | } }) }, |
| | 3777 | }); |
| 3772 | }, | 3778 | }, |
| 3773 | .inferred_alloc => { | 3779 | .inferred_alloc => { |
| 3774 | assert(sema.unresolved_inferred_allocs.remove(ptr_inst)); | 3780 | assert(sema.unresolved_inferred_allocs.remove(ptr_inst)); |