| ... | @@ -1143,12 +1143,14 @@ fn addModuleTableToCacheHash( | ... | @@ -1143,12 +1143,14 @@ fn addModuleTableToCacheHash( |
| 1143 | try seen_table.put(gpa, main_mod, {}); | 1143 | try seen_table.put(gpa, main_mod, {}); |
| 1144 | | 1144 | |
| 1145 | const SortByName = struct { | 1145 | const SortByName = struct { |
| | 1146 | has_builtin: bool, |
| 1146 | names: []const []const u8, | 1147 | names: []const []const u8, |
| 1147 | | 1148 | |
| 1148 | pub fn lessThan(ctx: @This(), lhs_index: usize, rhs_index: usize) bool { | 1149 | pub fn lessThan(ctx: @This(), lhs: usize, rhs: usize) bool { |
| 1149 | const lhs_key = ctx.names[lhs_index]; | 1150 | return if (ctx.has_builtin and (lhs == 0 or rhs == 0)) |
| 1150 | const rhs_key = ctx.names[rhs_index]; | 1151 | lhs < rhs |
| 1151 | return mem.lessThan(u8, lhs_key, rhs_key); | 1152 | else |
| | 1153 | mem.lessThan(u8, ctx.names[lhs], ctx.names[rhs]); |
| 1152 | } | 1154 | } |
| 1153 | }; | 1155 | }; |
| 1154 | | 1156 | |
| ... | @@ -1175,7 +1177,11 @@ fn addModuleTableToCacheHash( | ... | @@ -1175,7 +1177,11 @@ fn addModuleTableToCacheHash( |
| 1175 | }, | 1177 | }, |
| 1176 | } | 1178 | } |
| 1177 | | 1179 | |
| 1178 | mod.deps.sortUnstable(SortByName{ .names = mod.deps.keys() }); | 1180 | mod.deps.sortUnstable(SortByName{ |
| | 1181 | .has_builtin = mod.deps.count() >= 1 and |
| | 1182 | mod.deps.values()[0].isBuiltin(), |
| | 1183 | .names = mod.deps.keys(), |
| | 1184 | }); |
| 1179 | | 1185 | |
| 1180 | hash.addListOfBytes(mod.deps.keys()); | 1186 | hash.addListOfBytes(mod.deps.keys()); |
| 1181 | | 1187 | |