mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 00:50:40 +00:00
a697f87d36
The current IPC::Message constructor takes a large number of arguments, three of which--the nesting level, the priority, and the compression--are almost always constant by virtue of the vast majority of Message construction being done by auto-generated IPDL code. But then we take these constant values into the Message constructor, we check them for various values, and then based on those values, we perform a bunch of bitfield operations to store flags based on those values. This is wasted work. Furthermore, for replies to IPDL messages, we'll construct a Message object, and then call mutating setters on the Message object that will perform even more bitfield manipulations. Again, these operations are performing tasks at runtime that are the same every single time, and use information we already have at compile time. The impact of these extra operations is not large, maybe 15-30K of extra code, depending on platform. Nonetheless, we can easily make them go away, and make everything cleaner to boot. This patch adds a HeaderFlags class that encapsulates all the knowledge about the various kinds of flags Message needs to know about. We can construct HeaderFlags objects with strongly-typed enum arguments for the various kinds of flags, and the compiler can take care of folding all of those flags together into a constant when possible (and it is possible for all the IPDL-generated code that instantiates Messages). The upshot is that we do no unnecessary work in the Message constructor itself. We can also remove various mutating operations on Message, as those operations were only there to support post-constructor flag twiddling, which is no longer necessary. |
||
---|---|---|
.. | ||
ipdl | ||
test | ||
ipdl.py | ||
Makefile.in | ||
message-metadata.ini | ||
moz.build | ||
msgtype-components | ||
sync-messages.ini |