Lines Matching full:opcodes
214 // Rebases are communicated to dyld using a bytecode, whose opcodes cause the
425 // Encode a sequence of opcodes that tell dyld to write the address of symbol +
433 std::vector<BindIR> &opcodes) {
437 opcodes.push_back(
444 opcodes.push_back({BIND_OPCODE_ADD_ADDR_ULEB, offset - lastBinding.offset});
449 opcodes.push_back(
454 opcodes.push_back({BIND_OPCODE_DO_BIND, 0});
459 static void optimizeOpcodes(std::vector<BindIR> &opcodes) {
463 for (i = 1; i < opcodes.size(); ++i, ++pWrite) {
464 if ((opcodes[i].opcode == BIND_OPCODE_ADD_ADDR_ULEB) &&
465 (opcodes[i - 1].opcode == BIND_OPCODE_DO_BIND)) {
466 opcodes[pWrite].opcode = BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB;
467 opcodes[pWrite].data = opcodes[i].data;
470 opcodes[pWrite] = opcodes[i - 1];
473 if (i == opcodes.size())
474 opcodes[pWrite] = opcodes[i - 1];
475 opcodes.resize(pWrite + 1);
477 // Pass 2: Compress two or more bind_add opcodes
479 for (i = 1; i < opcodes.size(); ++i, ++pWrite) {
480 if ((opcodes[i].opcode == BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB) &&
481 (opcodes[i - 1].opcode == BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB) &&
482 (opcodes[i].data == opcodes[i - 1].data)) {
483 opcodes[pWrite].opcode = BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB;
484 opcodes[pWrite].consecutiveCount = 2;
485 opcodes[pWrite].data = opcodes[i].data;
487 while (i < opcodes.size() &&
488 (opcodes[i].opcode == BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB) &&
489 (opcodes[i].data == opcodes[i - 1].data)) {
490 opcodes[pWrite].consecutiveCount++;
494 opcodes[pWrite] = opcodes[i - 1];
497 if (i == opcodes.size())
498 opcodes[pWrite] = opcodes[i - 1];
499 opcodes.resize(pWrite + 1);
506 for (auto &p : opcodes) {
592 // Organize the bindings so we can encoded them with fewer opcodes.
623 // Emit bind opcodes, which are a stream of byte-sized opcodes that dyld
635 // subsequent opcodes only need to encode the differences between bindings.
654 std::vector<BindIR> opcodes;
658 lastBinding, opcodes);
660 optimizeOpcodes(opcodes);
661 for (const auto &op : opcodes)
688 std::vector<BindIR> opcodes;
692 lastBinding, opcodes);
694 optimizeOpcodes(opcodes);
695 for (const auto &op : opcodes)
1018 // Unlike the non-lazy binding section, the bind opcodes in this section aren't
1019 // interpreted all at once. Rather, dyld will start interpreting opcodes at a