mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
LibJS/Bytecode: Store labels as basic block index during compilation
Instead of storing a BasicBlock* and forcing the size of Label to be sizeof(BasicBlock*), we now store the basic block index as a u32. This means the final version of the bytecode is able to keep labels at sizeof(u32), shrinking the size of many instructions. :^)
This commit is contained in:
@@ -135,7 +135,7 @@ CodeGenerationErrorOr<NonnullGCPtr<Executable>> Generator::generate(VM& vm, ASTN
|
||||
}
|
||||
for (auto label_offset : label_offsets) {
|
||||
auto& label = *reinterpret_cast<Label*>(bytecode.data() + label_offset);
|
||||
auto* block = &label.block();
|
||||
auto* block = generator.m_root_basic_blocks[label.basic_block_index()].ptr();
|
||||
label.set_address(block_offsets.get(block).value());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user