diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-05-01 17:10:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-01 17:10:25 +0200 |
| commit | 02134611cefa7c0d45503c91375653af216a40bc (patch) | |
| tree | 5037496dd39f48c4b8270edb6e53e567bc097913 /compiler/rustc_codegen_llvm/src/abi.rs | |
| parent | 0a2562bf4de82b897beacf788e153f5738458325 (diff) | |
| parent | 500a8e13361787ad24c9ee88f8345d853ff628d3 (diff) | |
| download | rust-02134611cefa7c0d45503c91375653af216a40bc.tar.gz rust-02134611cefa7c0d45503c91375653af216a40bc.zip | |
Rollup merge of #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`.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/abi.rs')
0 files changed, 0 insertions, 0 deletions
