Avoid varargs in socket syscall layer. NFC#27153
Conversation
Passing a small number of integer arguments may be cheaper than marshalling varargs on wasm64.
This is an automatic change generated by tools/maint/rebaseline_tests.py. The following (1) test expectation files were updated by running the tests with `--rebaseline`: ``` codesize/test_codesize_hello_dylink_all.json: 855843 => 855818 [-25 bytes / -0.00%] Average change: -0.00% (-0.00% - -0.00%) ```
|
It looks like we still have explicit usage of varargs in 4 syscalls: ioctl fcntl64 fstatfs64 openat. Presumably removing that is more complex? But if we did then we could remove the whole syscallGetVararg thing? |
| return 0; | ||
| }, | ||
| __syscall_getpeername__deps: ['$getSocketFromFD', '$writeSockaddr', '$DNS'], | ||
| __syscall_getpeername: (fd, addr, addrlen, d1, d2, d3) => { |
There was a problem hiding this comment.
The man page calls this addrlen. Is there some reason to change it?
There was a problem hiding this comment.
I was trying to sync these syscalls argument names with their corresponding callers:
emscripten/system/lib/libc/musl/src/network/getpeername.c
Lines 4 to 7 in 8484a7b
| "$__syscall_munmap", | ||
| "$__syscall_prlimit64", | ||
| "$__syscall_recvmmsg", | ||
| "$__syscall_sendmmsg", |
There was a problem hiding this comment.
I wonder why this change effects this list?
There was a problem hiding this comment.
Probably due to identical code folding (ICF). At least it saves 25 bytes. :)
| "$__syscall_munmap", | ||
| "$__syscall_prlimit64", | ||
| "$__syscall_recvmmsg", | ||
| "$__syscall_sendmmsg", |
There was a problem hiding this comment.
Oh I think maybe some optimization phase was doing duplicate function merging before on this stub, but its no longer identical maybe.
Indeed, it's probably too complex. And unlike the socket syscalls, these varargs are actually used and cannot be turned into constants (afaik). |
Passing a small number of integer arguments may be cheaper than
marshalling varargs on wasm64.
Split out from #19559.