Open
Bug 1479933
Opened 7 years ago
Updated 3 years ago
IPDL shouldn't pass integers and other small POD types by reference
Categories
(Core :: IPC, enhancement, P3)
Core
IPC
Tracking
()
NEW
People
(Reporter: jld, Unassigned)
References
Details
IPDL autogenerated methods use references even for small types that can be more efficiently (or at least not less efficiently) passed by value, like integers and bool and int-based types like nsresult. It would be nice to fix that.
Implementation-wise, my vague idea here is to give type objects a method to indicate how they want to be passed (which might also be useful for pass-by-move in bug 1479930), make the built-in types do the right thing, and adjust the code that decides what kind of type to use in declarations accordingly. Also nice would be to add a keyword to the language to flag imported C++ types that should be passed by value (the same place in the syntax as `refcounted`); some of them are enums or wrapped integers that an be trivially copy-constructed.
This is, of course, going to need thousands of lines of changes to change the types in all the override methods. I had reasonably good success using simple text-processing (a Perl one-liner; the scalar .. operator is useful here) with a local proof-of-concept to auto-edit all the `const T&` to `T&&` in every Recv/Answer method declaration/definition argument list; the hardest part was finding all the files with actor classes in them (because I didn't feel entirely confident letting it loose across the entire tree). The hardest part of trying to actually *land* that kind of patch is probably going to be correcting for bit-rot in the time it takes to get reviews.
![]() |
||
Updated•7 years ago
|
Priority: -- → P3
Reporter | ||
Comment 1•6 years ago
|
||
Now that IPC callback devirtualization has landed, this should be doable on the Recv
side just by changing the types in the concrete classes. (The classes that still use virtual dispatch can't be converted yet, so this might need a followup.)
The Send
methods would need a change to the autogenerated code, for which see comment #0, but it would be useful to get an idea of how much, if anything, passing by value would save us on metrics of interest (probably code size). This side isn't exposed to code, so it's not an ergonomic problem, and it's not as straightforward to fix, so if it doesn't help then we could just leave it (or break it out into a lower-priority bug).
Depends on: ipc-devirt
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•