@@ -13,7 +13,7 @@ const SymbolWithLoc = MachO.SymbolWithLoc;
13
13
14
14
const AtomTable = std .AutoHashMap (AtomIndex , void );
15
15
16
- pub fn gcAtoms (macho_file : * MachO , reverse_lookups : [][]u32 ) ! void {
16
+ pub fn gcAtoms (macho_file : * MachO , reverse_lookups : [][]u32 ) Allocator.Error ! void {
17
17
const gpa = macho_file .base .allocator ;
18
18
19
19
var arena = std .heap .ArenaAllocator .init (gpa );
@@ -26,8 +26,8 @@ pub fn gcAtoms(macho_file: *MachO, reverse_lookups: [][]u32) !void {
26
26
try alive .ensureTotalCapacity (@intCast (u32 , macho_file .atoms .items .len ));
27
27
28
28
try collectRoots (macho_file , & roots );
29
- try mark (macho_file , roots , & alive , reverse_lookups );
30
- try prune (macho_file , alive );
29
+ mark (macho_file , roots , & alive , reverse_lookups );
30
+ prune (macho_file , alive );
31
31
}
32
32
33
33
fn collectRoots (macho_file : * MachO , roots : * AtomTable ) ! void {
@@ -130,7 +130,7 @@ fn markLive(
130
130
atom_index : AtomIndex ,
131
131
alive : * AtomTable ,
132
132
reverse_lookups : [][]u32 ,
133
- ) anyerror ! void {
133
+ ) void {
134
134
if (alive .contains (atom_index )) return ;
135
135
136
136
const atom = macho_file .getAtom (atom_index );
@@ -171,7 +171,7 @@ fn markLive(
171
171
const other_atom = macho_file .getAtom (other_atom_index );
172
172
const other_sym = macho_file .getSymbol (other_atom .getSymbolWithLoc ());
173
173
if (other_sym .n_sect == sect_id ) {
174
- try markLive (macho_file , other_atom_index , alive , reverse_lookups );
174
+ markLive (macho_file , other_atom_index , alive , reverse_lookups );
175
175
}
176
176
}
177
177
continue ;
@@ -194,11 +194,11 @@ fn markLive(
194
194
macho_file .getAtom (target_atom_index ).file ,
195
195
});
196
196
197
- try markLive (macho_file , target_atom_index , alive , reverse_lookups );
197
+ markLive (macho_file , target_atom_index , alive , reverse_lookups );
198
198
}
199
199
}
200
200
201
- fn refersLive (macho_file : * MachO , atom_index : AtomIndex , alive : AtomTable , reverse_lookups : [][]u32 ) ! bool {
201
+ fn refersLive (macho_file : * MachO , atom_index : AtomIndex , alive : AtomTable , reverse_lookups : [][]u32 ) bool {
202
202
const atom = macho_file .getAtom (atom_index );
203
203
const sym_loc = atom .getSymbolWithLoc ();
204
204
@@ -242,10 +242,10 @@ fn refersLive(macho_file: *MachO, atom_index: AtomIndex, alive: AtomTable, rever
242
242
return false ;
243
243
}
244
244
245
- fn mark (macho_file : * MachO , roots : AtomTable , alive : * AtomTable , reverse_lookups : [][]u32 ) ! void {
245
+ fn mark (macho_file : * MachO , roots : AtomTable , alive : * AtomTable , reverse_lookups : [][]u32 ) void {
246
246
var it = roots .keyIterator ();
247
247
while (it .next ()) | root | {
248
- try markLive (macho_file , root .* , alive , reverse_lookups );
248
+ markLive (macho_file , root .* , alive , reverse_lookups );
249
249
}
250
250
251
251
var loop : bool = true ;
@@ -267,8 +267,8 @@ fn mark(macho_file: *MachO, roots: AtomTable, alive: *AtomTable, reverse_lookups
267
267
const source_sect = object .getSourceSection (sect_id );
268
268
269
269
if (source_sect .isDontDeadStripIfReferencesLive ()) {
270
- if (try refersLive (macho_file , atom_index , alive .* , reverse_lookups )) {
271
- try markLive (macho_file , atom_index , alive , reverse_lookups );
270
+ if (refersLive (macho_file , atom_index , alive .* , reverse_lookups )) {
271
+ markLive (macho_file , atom_index , alive , reverse_lookups );
272
272
loop = true ;
273
273
}
274
274
}
@@ -277,7 +277,7 @@ fn mark(macho_file: *MachO, roots: AtomTable, alive: *AtomTable, reverse_lookups
277
277
}
278
278
}
279
279
280
- fn prune (macho_file : * MachO , alive : AtomTable ) ! void {
280
+ fn prune (macho_file : * MachO , alive : AtomTable ) void {
281
281
log .debug ("pruning dead atoms" , .{});
282
282
for (macho_file .objects .items ) | * object | {
283
283
var i : usize = 0 ;
0 commit comments