This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 0213461
authored
Rollup merge of rust-lang#111057 - xfix:tcpstream-as-raw-fd-inline, r=m-ou-se
Make sure the implementation of TcpStream::as_raw_fd is fully inlined
Currently the following function:
```rust
use std::os::fd::{AsRawFd, RawFd};
use std::net::TcpStream;
pub fn as_raw_fd(socket: &TcpStream) -> RawFd {
socket.as_raw_fd()
}
```
Is optimized to the following:
```asm
example::as_raw_fd:
push rax
call qword ptr [rip + <std::net::tcp::TcpStream as std::sys_common::AsInner<std::sys_common::net::TcpStream>>::as_inner@GOTPCREL]
mov rdi, rax
call qword ptr [rip + std::sys_common::net::TcpStream::socket@GOTPCREL]
mov rdi, rax
pop rax
jmp qword ptr [rip + _ZN73_$LT$std..sys..unix..net..Socket$u20$as$u20$std..os..fd..raw..AsRawFd$GT$9as_raw_fd17h633bcf7e481df8bbE@GOTPCREL]
```
I think it would make more sense to inline trivial functions used within `TcpStream::AsRawFd`.26 files changed
+69
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
| 712 | + | |
712 | 713 | | |
713 | 714 | | |
714 | 715 | | |
| |||
1087 | 1088 | | |
1088 | 1089 | | |
1089 | 1090 | | |
| 1091 | + | |
1090 | 1092 | | |
1091 | 1093 | | |
1092 | 1094 | | |
1093 | 1095 | | |
1094 | 1096 | | |
1095 | 1097 | | |
| 1098 | + | |
1096 | 1099 | | |
1097 | 1100 | | |
1098 | 1101 | | |
| |||
1352 | 1355 | | |
1353 | 1356 | | |
1354 | 1357 | | |
| 1358 | + | |
1355 | 1359 | | |
1356 | 1360 | | |
1357 | 1361 | | |
| |||
1604 | 1608 | | |
1605 | 1609 | | |
1606 | 1610 | | |
| 1611 | + | |
1607 | 1612 | | |
1608 | 1613 | | |
1609 | 1614 | | |
| |||
1616 | 1621 | | |
1617 | 1622 | | |
1618 | 1623 | | |
| 1624 | + | |
1619 | 1625 | | |
1620 | 1626 | | |
1621 | 1627 | | |
| |||
1770 | 1776 | | |
1771 | 1777 | | |
1772 | 1778 | | |
| 1779 | + | |
1773 | 1780 | | |
1774 | 1781 | | |
1775 | 1782 | | |
| |||
2510 | 2517 | | |
2511 | 2518 | | |
2512 | 2519 | | |
| 2520 | + | |
2513 | 2521 | | |
2514 | 2522 | | |
2515 | 2523 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
691 | 691 | | |
692 | 692 | | |
693 | 693 | | |
| 694 | + | |
694 | 695 | | |
695 | 696 | | |
696 | 697 | | |
| |||
1033 | 1034 | | |
1034 | 1035 | | |
1035 | 1036 | | |
| 1037 | + | |
1036 | 1038 | | |
1037 | 1039 | | |
1038 | 1040 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
788 | 788 | | |
789 | 789 | | |
790 | 790 | | |
| 791 | + | |
791 | 792 | | |
792 | 793 | | |
793 | 794 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
| |||
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
| 308 | + | |
307 | 309 | | |
308 | 310 | | |
309 | 311 | | |
| |||
373 | 375 | | |
374 | 376 | | |
375 | 377 | | |
| 378 | + | |
376 | 379 | | |
377 | 380 | | |
378 | 381 | | |
| |||
438 | 441 | | |
439 | 442 | | |
440 | 443 | | |
| 444 | + | |
441 | 445 | | |
442 | 446 | | |
443 | 447 | | |
| |||
1107 | 1111 | | |
1108 | 1112 | | |
1109 | 1113 | | |
| 1114 | + | |
1110 | 1115 | | |
1111 | 1116 | | |
1112 | 1117 | | |
1113 | 1118 | | |
1114 | 1119 | | |
1115 | 1120 | | |
| 1121 | + | |
1116 | 1122 | | |
1117 | 1123 | | |
1118 | 1124 | | |
| |||
1605 | 1611 | | |
1606 | 1612 | | |
1607 | 1613 | | |
| 1614 | + | |
1608 | 1615 | | |
1609 | 1616 | | |
1610 | 1617 | | |
| |||
1884 | 1891 | | |
1885 | 1892 | | |
1886 | 1893 | | |
| 1894 | + | |
1887 | 1895 | | |
1888 | 1896 | | |
1889 | 1897 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
370 | 371 | | |
371 | 372 | | |
372 | 373 | | |
373 | 374 | | |
374 | 375 | | |
375 | 376 | | |
| 377 | + | |
376 | 378 | | |
377 | 379 | | |
378 | 380 | | |
| |||
397 | 399 | | |
398 | 400 | | |
399 | 401 | | |
| 402 | + | |
400 | 403 | | |
401 | 404 | | |
402 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| 343 | + | |
343 | 344 | | |
344 | 345 | | |
345 | 346 | | |
| |||
364 | 365 | | |
365 | 366 | | |
366 | 367 | | |
| 368 | + | |
367 | 369 | | |
368 | 370 | | |
369 | 371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
| 224 | + | |
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
| |||
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
| 309 | + | |
307 | 310 | | |
308 | 311 | | |
309 | 312 | | |
| |||
0 commit comments