DescriptionSplit AssembleFilter into comprehensible chunks
Previously SandboxBPF constructed the CodeGen Instruction sequence
primarily in one large, complex function. Additionally, it made
extensive use of the CodeGen::JoinInstructions() function to
conditionally arrange various bits of instructions, which made it
harder to follow.
This CL splits the Instruction assembly code into 5 mostly distinct
functions and eliminates all use of JoinInstruction() in favor of
function composition. E.g., instead of
foo = gen->MakeInstruction(...);
bar = gen->MakeInstruction(...);
gen->JoinInstructions(foo, bar);
this CL favors writing
MakeFoo(MakeBar())
with the convention that Instruction-constructing functions should
arrange for control to transfer to the Instruction sequence argument
when complete. (I.e., "continuation-passing style":
http://en.wikipedia.org/wiki/Continuation-passing_style)
BUG=414363
Committed: https://crrev.com/d2283ac2cb84e59bf67ecb2cb4efa0e48602ceb5
Cr-Commit-Position: refs/heads/master@{#295015}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Respond to jln feedback #
Messages
Total messages: 12 (2 generated)
|