| ... | @@ -37,6 +37,8 @@ attributes_map: std.AutoArrayHashMapUnmanaged(void, void), | ... | @@ -37,6 +37,8 @@ attributes_map: std.AutoArrayHashMapUnmanaged(void, void), |
| 37 | attributes_indices: std.ArrayListUnmanaged(u32), | 37 | attributes_indices: std.ArrayListUnmanaged(u32), |
| 38 | attributes_extra: std.ArrayListUnmanaged(u32), | 38 | attributes_extra: std.ArrayListUnmanaged(u32), |
| 39 | | 39 | |
| | 40 | function_attributes_set: std.AutoArrayHashMapUnmanaged(FunctionAttributes, void), |
| | 41 | |
| 40 | globals: std.AutoArrayHashMapUnmanaged(String, Global), | 42 | globals: std.AutoArrayHashMapUnmanaged(String, Global), |
| 41 | next_unnamed_global: String, | 43 | next_unnamed_global: String, |
| 42 | next_replaced_global: String, | 44 | next_replaced_global: String, |
| ... | @@ -8248,6 +8250,8 @@ pub fn init(options: Options) InitError!Builder { | ... | @@ -8248,6 +8250,8 @@ pub fn init(options: Options) InitError!Builder { |
| 8248 | .attributes_indices = .{}, | 8250 | .attributes_indices = .{}, |
| 8249 | .attributes_extra = .{}, | 8251 | .attributes_extra = .{}, |
| 8250 | | 8252 | |
| | 8253 | .function_attributes_set = .{}, |
| | 8254 | |
| 8251 | .globals = .{}, | 8255 | .globals = .{}, |
| 8252 | .next_unnamed_global = @enumFromInt(0), | 8256 | .next_unnamed_global = @enumFromInt(0), |
| 8253 | .next_replaced_global = .none, | 8257 | .next_replaced_global = .none, |
| ... | @@ -8385,6 +8389,8 @@ pub fn deinit(self: *Builder) void { | ... | @@ -8385,6 +8389,8 @@ pub fn deinit(self: *Builder) void { |
| 8385 | self.attributes_indices.deinit(self.gpa); | 8389 | self.attributes_indices.deinit(self.gpa); |
| 8386 | self.attributes_extra.deinit(self.gpa); | 8390 | self.attributes_extra.deinit(self.gpa); |
| 8387 | | 8391 | |
| | 8392 | self.function_attributes_set.deinit(self.gpa); |
| | 8393 | |
| 8388 | self.globals.deinit(self.gpa); | 8394 | self.globals.deinit(self.gpa); |
| 8389 | self.next_unique_global_id.deinit(self.gpa); | 8395 | self.next_unique_global_id.deinit(self.gpa); |
| 8390 | self.aliases.deinit(self.gpa); | 8396 | self.aliases.deinit(self.gpa); |
| ... | @@ -8825,12 +8831,16 @@ pub fn attrs(self: *Builder, attributes: []Attribute.Index) Allocator.Error!Attr | ... | @@ -8825,12 +8831,16 @@ pub fn attrs(self: *Builder, attributes: []Attribute.Index) Allocator.Error!Attr |
| 8825 | } | 8831 | } |
| 8826 | | 8832 | |
| 8827 | pub fn fnAttrs(self: *Builder, fn_attributes: []const Attributes) Allocator.Error!FunctionAttributes { | 8833 | pub fn fnAttrs(self: *Builder, fn_attributes: []const Attributes) Allocator.Error!FunctionAttributes { |
| 8828 | return @enumFromInt(try self.attrGeneric(@ptrCast( | 8834 | try self.function_attributes_set.ensureUnusedCapacity(self.gpa, 1); |
| | 8835 | const function_attributes: FunctionAttributes = @enumFromInt(try self.attrGeneric(@ptrCast( |
| 8829 | fn_attributes[0..if (std.mem.lastIndexOfNone(Attributes, fn_attributes, &.{.none})) |last| | 8836 | fn_attributes[0..if (std.mem.lastIndexOfNone(Attributes, fn_attributes, &.{.none})) |last| |
| 8830 | last + 1 | 8837 | last + 1 |
| 8831 | else | 8838 | else |
| 8832 | 0], | 8839 | 0], |
| 8833 | ))); | 8840 | ))); |
| | 8841 | |
| | 8842 | _ = self.function_attributes_set.getOrPutAssumeCapacity(function_attributes); |
| | 8843 | return function_attributes; |
| 8834 | } | 8844 | } |
| 8835 | | 8845 | |
| 8836 | pub fn addGlobal(self: *Builder, name: String, global: Global) Allocator.Error!Global.Index { | 8846 | pub fn addGlobal(self: *Builder, name: String, global: Global) Allocator.Error!Global.Index { |