gatekeeper icon indicating copy to clipboard operation
gatekeeper copied to clipboard

Eliminate lls_req() and sister functions

Open AltraMayor opened this issue 6 years ago • 1 comments

submit_arp() allocates struct lls_arp_req in the execution stack just so lls_req() can allocate a mailbox message and linearly copy struct lls_arp_req. Moreover, lls_req() is mostly a big switch statement for each type. If the allocation of the mailbox message is moved to submit_arp(), not only is the data copy going to be avoided, but it'll also simplify lls_req(). Repeating this strategy on all the other case substatements of the switch statement of lls_req(), other data copies can be avoided and lls_req() would become empty, unnecessary.

This code pattern shows up in other blocks beside the LLS block used as an example above. Thus, to fully address this issue, one has to identify all the locations where this issue applies. It's also advisable to first have a small pull request dealing with only submit_arp(), so one has a reviewed model to apply in the following pull requests, which would cover all the repository.

AltraMayor avatar Jun 13 '19 13:06 AltraMayor

A side bonus of eliminating lls_req() and sisters is dropping functions that are not typesafe. An example of this risk is available in issue #287.

AltraMayor avatar Jun 13 '19 13:06 AltraMayor