| ... | ... | @@ -98,6 +98,10 @@ string_literal_bytes: ArrayListUnmanaged(u8) = .{}, |
| 98 | 98 | |
| 99 | 99 | /// Stores all Type and Value objects; periodically garbage collected. |
| 100 | 100 | intern_pool: InternPool = .{}, |
| 101 | /// Temporarily used for some unfortunate allocations made by backends that need to construct |
| 102 | /// pointer types that can't be represented by the InternPool. Once all types are migrated |
| 103 | /// to be stored in the InternPool, this can be removed. |
| 104 | tmp_hack_arena: std.heap.ArenaAllocator, |
| 101 | 105 | |
| 102 | 106 | /// The set of all the generic function instantiations. This is used so that when a generic |
| 103 | 107 | /// function is called twice with the same comptime parameter arguments, both calls dispatch |
| ... | ... | @@ -3552,6 +3556,7 @@ pub fn deinit(mod: *Module) void { |
| 3552 | 3556 | mod.string_literal_bytes.deinit(gpa); |
| 3553 | 3557 | |
| 3554 | 3558 | mod.intern_pool.deinit(gpa); |
| 3559 | mod.tmp_hack_arena.deinit(); |
| 3555 | 3560 | } |
| 3556 | 3561 | |
| 3557 | 3562 | pub fn destroyDecl(mod: *Module, decl_index: Decl.Index) void { |
| ... | ... | @@ -6848,10 +6853,25 @@ pub fn ptrType(mod: *Module, info: InternPool.Key.PtrType) Allocator.Error!Type |
| 6848 | 6853 | } |
| 6849 | 6854 | |
| 6850 | 6855 | pub fn singleMutPtrType(mod: *Module, child_type: Type) Allocator.Error!Type { |
| 6856 | if (child_type.ip_index == .none) { |
| 6857 | // TODO remove this after all types can be represented via the InternPool |
| 6858 | return Type.Tag.pointer.create(mod.tmp_hack_arena.allocator(), .{ |
| 6859 | .pointee_type = child_type, |
| 6860 | .@"addrspace" = .generic, |
| 6861 | }); |
| 6862 | } |
| 6851 | 6863 | return ptrType(mod, .{ .elem_type = child_type.ip_index }); |
| 6852 | 6864 | } |
| 6853 | 6865 | |
| 6854 | 6866 | pub fn singleConstPtrType(mod: *Module, child_type: Type) Allocator.Error!Type { |
| 6867 | if (child_type.ip_index == .none) { |
| 6868 | // TODO remove this after all types can be represented via the InternPool |
| 6869 | return Type.Tag.pointer.create(mod.tmp_hack_arena.allocator(), .{ |
| 6870 | .pointee_type = child_type, |
| 6871 | .mutable = false, |
| 6872 | .@"addrspace" = .generic, |
| 6873 | }); |
| 6874 | } |
| 6855 | 6875 | return ptrType(mod, .{ .elem_type = child_type.ip_index, .is_const = true }); |
| 6856 | 6876 | } |
| 6857 | 6877 | |