Skip to main content

luaur_bytecode/methods/
bytecode_graph_serializer_record_jump.rs

1use crate::enums::bc_op_kind::BcOpKind;
2use crate::records::bc_inst::BcInst;
3use crate::records::bc_op::BcOp;
4use crate::records::bytecode_graph_serializer::BytecodeGraphSerializer;
5use crate::records::jump_info::JumpInfo;
6use luaur_common::macros::luau_assert::LUAU_ASSERT;
7
8impl<'a> BytecodeGraphSerializer<'a> {
9    pub fn record_jump(&mut self, insn: &mut BcInst, index: u8) {
10        LUAU_ASSERT!(index < insn.ops.len() as u8);
11        let inp: BcOp = insn.ops[index as usize];
12        LUAU_ASSERT!(inp.kind == BcOpKind::Block);
13        self.jumps.push(JumpInfo {
14            op: insn.op,
15            instructionPC: self.bcb.get_instruction_count() as u32,
16            targetBlock: inp,
17        });
18    }
19}