Lines Matching defs:opcodes

213 // Rebases are communicated to dyld using a bytecode, whose opcodes cause the
424 // Encode a sequence of opcodes that tell dyld to write the address of symbol +
432 std::vector<BindIR> &opcodes) {
436 opcodes.push_back(
443 opcodes.push_back({BIND_OPCODE_ADD_ADDR_ULEB, offset - lastBinding.offset});
448 opcodes.push_back(
453 opcodes.push_back({BIND_OPCODE_DO_BIND, 0});
458 static void optimizeOpcodes(std::vector<BindIR> &opcodes) {
462 for (i = 1; i < opcodes.size(); ++i, ++pWrite) {
463 if ((opcodes[i].opcode == BIND_OPCODE_ADD_ADDR_ULEB) &&
464 (opcodes[i - 1].opcode == BIND_OPCODE_DO_BIND)) {
465 opcodes[pWrite].opcode = BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB;
466 opcodes[pWrite].data = opcodes[i].data;
469 opcodes[pWrite] = opcodes[i - 1];
472 if (i == opcodes.size())
473 opcodes[pWrite] = opcodes[i - 1];
474 opcodes.resize(pWrite + 1);
476 // Pass 2: Compress two or more bind_add opcodes
478 for (i = 1; i < opcodes.size(); ++i, ++pWrite) {
479 if ((opcodes[i].opcode == BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB) &&
480 (opcodes[i - 1].opcode == BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB) &&
481 (opcodes[i].data == opcodes[i - 1].data)) {
482 opcodes[pWrite].opcode = BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB;
483 opcodes[pWrite].consecutiveCount = 2;
484 opcodes[pWrite].data = opcodes[i].data;
486 while (i < opcodes.size() &&
487 (opcodes[i].opcode == BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB) &&
488 (opcodes[i].data == opcodes[i - 1].data)) {
489 opcodes[pWrite].consecutiveCount++;
493 opcodes[pWrite] = opcodes[i - 1];
496 if (i == opcodes.size())
497 opcodes[pWrite] = opcodes[i - 1];
498 opcodes.resize(pWrite + 1);
505 for (auto &p : opcodes) {
591 // Organize the bindings so we can encoded them with fewer opcodes.
622 // Emit bind opcodes, which are a stream of byte-sized opcodes that dyld
634 // subsequent opcodes only need to encode the differences between bindings.
653 std::vector<BindIR> opcodes;
657 lastBinding, opcodes);
659 optimizeOpcodes(opcodes);
660 for (const auto &op : opcodes)
687 std::vector<BindIR> opcodes;
691 lastBinding, opcodes);
693 optimizeOpcodes(opcodes);
694 for (const auto &op : opcodes)
1017 // Unlike the non-lazy binding section, the bind opcodes in this section aren't
1018 // interpreted all at once. Rather, dyld will start interpreting opcodes at a