1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

Everywhere: Stop using NonnullOwnPtrVector

Same as NonnullRefPtrVector: weird semantics, questionable benefits.
This commit is contained in:
Andreas Kling 2023-03-06 17:16:25 +01:00
parent 689ca370d4
commit 359d6e7b0b
111 changed files with 517 additions and 503 deletions

View file

@ -164,7 +164,7 @@ void GenerateCFG::perform(PassPipelineExecutable& executable)
unwind_frames.append(&top_level_frame);
generate_cfg_for_block(executable.executable.basic_blocks.first(), executable);
generate_cfg_for_block(*executable.executable.basic_blocks.first(), executable);
finished();
}

View file

@ -175,20 +175,20 @@ void EliminateLoads::perform(PassPipelineExecutable& executable)
// save some work between blocks
for (auto it = executable.executable.basic_blocks.begin(); it != executable.executable.basic_blocks.end(); ++it) {
auto const& old_block = *it;
auto new_block = eliminate_loads(old_block, executable.executable.number_of_registers);
auto new_block = eliminate_loads(*old_block, executable.executable.number_of_registers);
// We will replace the old block, with a new one, so we need to replace all references,
// to the old one with the new one
for (auto& block : executable.executable.basic_blocks) {
InstructionStreamIterator it { block.instruction_stream() };
InstructionStreamIterator it { block->instruction_stream() };
while (!it.at_end()) {
auto& instruction = *it;
++it;
const_cast<Instruction&>(instruction).replace_references(old_block, *new_block);
const_cast<Instruction&>(instruction).replace_references(*old_block, *new_block);
}
}
executable.executable.basic_blocks.ptr_at(it.index()) = move(new_block);
executable.executable.basic_blocks[it.index()] = move(new_block);
}
finished();

View file

@ -81,7 +81,7 @@ void MergeBlocks::perform(PassPipelineExecutable& executable)
first_successor_position = it.index();
}
for (auto& block : executable.executable.basic_blocks) {
InstructionStreamIterator it { block.instruction_stream() };
InstructionStreamIterator it { block->instruction_stream() };
while (!it.at_end()) {
auto& instruction = *it;
++it;

View file

@ -35,7 +35,7 @@ void PlaceBlocks::perform(PassPipelineExecutable& executable)
};
// Make sure to visit the entry block first
visit(&executable.executable.basic_blocks.first());
visit(executable.executable.basic_blocks.first());
for (auto& entry : cfg)
visit(entry.key);

View file

@ -22,19 +22,19 @@ void UnifySameBlocks::perform(PassPipelineExecutable& executable)
for (size_t i = 0; i < executable.executable.basic_blocks.size(); ++i) {
auto& block = executable.executable.basic_blocks[i];
auto block_bytes = block.instruction_stream();
auto block_bytes = block->instruction_stream();
for (auto& candidate_block : executable.executable.basic_blocks.span().slice(i + 1)) {
if (equal_blocks.contains(&*candidate_block))
continue;
// FIXME: This can probably be relaxed a bit...
if (candidate_block->size() != block.size())
if (candidate_block->size() != block->size())
continue;
auto candidate_bytes = candidate_block->instruction_stream();
// FIXME: NewBigInt's value is not correctly reflected by its encoding in memory,
// this will yield false negatives for blocks containing that
if (memcmp(candidate_bytes.data(), block_bytes.data(), candidate_block->size()) == 0)
equal_blocks.set(&*candidate_block, &block);
equal_blocks.set(candidate_block.ptr(), block);
}
}
@ -47,7 +47,7 @@ void UnifySameBlocks::perform(PassPipelineExecutable& executable)
first_successor_position = it.index();
for (auto& block : executable.executable.basic_blocks) {
InstructionStreamIterator it { block.instruction_stream() };
InstructionStreamIterator it { block->instruction_stream() };
while (!it.at_end()) {
auto& instruction = *it;
++it;