Commit f0b6d68
flambda-backend: Simplify processing and remove dead code (error paths) in asmlink (port upstream PR#9943) (oxcaml#557)
* Asmlink.object_file_name removal: add object_file_name_of_file
An analysis of the code should convince yourself that the
[object_file_name] function is not needed and that its erroring paths
are dead code.
The reasoning is the following: all the uses of [object_file_name] in
asmlink.ml are performed on [obj_name]s which went through [read_file]
before. The latter does exactly the same file name lookup and erroring
treatement, except not in a stringly manner like [object_file_name]
does.
This new function derives the same information as [object_file_name]
except it does it on the [file] datatype returned by [read_file].
Note that all the erroring code paths of [object_file_name] have been
handled by the [read_file] which derived the [file] value.
We integrate the logic added by PR #9011 for empty cmxa here.
* Asmlink.object_file_name removal: remove.
This commit does the following four things (it's difficult
to them in separate commits that compile).
1) It removes the [read_file] from [scan_file]. Reading the files is
done seperately before returning an [obj_infos] list of [file]
values. This turns [scan_file] into a function that operates on
values of type [file].
2) In [scan_file] it removes the separate list of [obj_files]
introduced by #9011. We can derive the same list using the function
[object_file_name_of_file] introduced in the previous commit on the
list of [obj_infos]. Effectively we bring back [scan_file] to the
state before #9011 modulo the [read_file] removal.
3) We derive the list of [obj_files] directly from the
[obj_infos] list via [object_file_name_of_file]. Note that
the logic introduced by #9011 is preserved by virtue of
[object_file_name_of_file]'s optional result.
4) Deletes [object_file_name] which is no longer used.
Co-authored-by: Daniel Bünzli <daniel.buenzli@erratique.ch>1 parent 90c6746 commit f0b6d68
1 file changed
Lines changed: 34 additions & 50 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | 127 | | |
141 | 128 | | |
142 | 129 | | |
| |||
164 | 151 | | |
165 | 152 | | |
166 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
167 | 165 | | |
168 | 166 | | |
169 | 167 | | |
| |||
186 | 184 | | |
187 | 185 | | |
188 | 186 | | |
189 | | - | |
| 187 | + | |
190 | 188 | | |
191 | 189 | | |
192 | 190 | | |
193 | 191 | | |
194 | | - | |
| 192 | + | |
195 | 193 | | |
196 | 194 | | |
197 | 195 | | |
198 | 196 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
225 | 211 | | |
226 | 212 | | |
227 | 213 | | |
| |||
295 | 281 | | |
296 | 282 | | |
297 | 283 | | |
298 | | - | |
299 | | - | |
300 | | - | |
| 284 | + | |
| 285 | + | |
301 | 286 | | |
302 | 287 | | |
303 | 288 | | |
304 | 289 | | |
305 | 290 | | |
306 | | - | |
| 291 | + | |
| 292 | + | |
307 | 293 | | |
308 | | - | |
309 | 294 | | |
310 | 295 | | |
311 | 296 | | |
| |||
355 | 340 | | |
356 | 341 | | |
357 | 342 | | |
358 | | - | |
359 | | - | |
360 | | - | |
| 343 | + | |
| 344 | + | |
361 | 345 | | |
362 | 346 | | |
363 | 347 | | |
| |||
381 | 365 | | |
382 | 366 | | |
383 | 367 | | |
384 | | - | |
| 368 | + | |
385 | 369 | | |
386 | 370 | | |
387 | 371 | | |
| |||
0 commit comments