gecko-dev/ipc/ipdl
Nathan Froyd a697f87d36 Bug 1397823 - part 3 - do a better job setting IPC::Message flags; r=kanru
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.
2017-09-15 08:06:11 -04:00
..
ipdl Bug 1397823 - part 3 - do a better job setting IPC::Message flags; r=kanru 2017-09-15 08:06:11 -04:00
test Bug 1397506 - IPDL unit test fix (r=kmag) 2017-09-07 22:31:34 -07:00
ipdl.py Bug 1384713 - remove unused *MsgStartChild constants; r=billm 2017-07-27 13:32:15 -04:00
Makefile.in
message-metadata.ini Bug 1380974 - Use custom size for small frequent messages. r=billm 2017-07-20 11:37:09 +08:00
moz.build
msgtype-components
sync-messages.ini Bug 1245527 - Remove NSS U2F SoftToken. r=ttaubert, r=jed 2017-09-05 12:32:42 -07:00