Home | History | Annotate | Download | only in seccomp-bpf

Lines Matching refs:instructions

42   for (Instructions::iterator iter = instructions_.begin();
138 // We can handle non-jumping instructions and "always" jumps. Both of
147 SANDBOX_DIE("Cannot append instructions after a return statement");
155 // Non-jumping instructions do not use any of the branch targets.
191 // Merge two instructions, or set the branch target for an "always" jump.
197 SANDBOX_DIE("Cannot append instructions in the middle of a sequence");
206 SANDBOX_DIE("Cannot append instructions after a jump");
210 SANDBOX_DIE("Cannot append instructions after a return statement");
212 SANDBOX_DIE("Cannot append instructions in the middle of a sequence");
230 void CodeGen::FindBranchTargets(const Instruction& instructions,
232 // Follow all possible paths through the "instructions" graph and compute
235 // We maintain a set of all instructions that we have previously seen. This
236 // set ultimately converges on all instructions in the program.
238 Instructions stack;
239 for (const Instruction *insn = &instructions; insn; ) {
303 // Iterate over all the instructions between "head" and "tail" and
307 bb->instructions.push_back(head);
341 Instruction *instructions, const BranchTargets& branch_targets,
349 Instructions stack;
351 Instruction *head = instructions;
381 // We successfully traversed all reachable instructions.
408 // We define a comparator that inspects the sequence of instructions in our
422 // We compare the sequence of instructions in both basic blocks.
423 const Instructions& insns1 = block1->instructions;
424 const Instructions& insns2 = block2->instructions;
425 Instructions::const_iterator iter1 = insns1.begin();
426 Instructions::const_iterator iter2 = insns2.begin();
428 instructions in one or
437 // Compare the individual fields for both instructions.
442 // Only conditional jump instructions use the jt_ptr and jf_ptr
492 // instructions to map to the same entry in the set. Whenever we discover
493 // that a particular chain of instructions is already in the set, we merge
496 // N.B. We don't merge instructions on a granularity that is finer than
501 // merge arbitrary sub-sequences of instructions.
512 // instructions. Enter the basic block into the set of known
517 // sequence of instructions. Merge the two blocks and update the
532 Instruction *last_insn = block->instructions.back();
573 Instruction *last_insn = first_block->instructions.back();
602 first_block->instructions.push_back(ja);
622 // instructions to their targets, we now convert these jumps to relative
636 Instruction *insn = bb->instructions.back();
654 // can only jump at most 255 instructions forward. If we have to jump
656 Instructions::size_type jmp = bb->instructions.size();
659 bb->instructions.push_back(ja);
670 bb->instructions.insert(bb->instructions.begin() + jmp, ja);
692 offset += bb->instructions.size();
701 // computed. The last remaining step is for all the instructions in our
708 for (Instructions::const_iterator insn_iter = bb.instructions.begin();
709 insn_iter != bb.instructions.end();
719 void CodeGen::Compile(Instruction *instructions, Sandbox::Program *program) {
727 FindBranchTargets(*instructions, &branch_targets);
730 CutGraphIntoBasicBlocks(instructions, branch_targets, &all_blocks);