Skip to main content

luaur_bytecode/methods/
bytecode_graph_parser_add_jump_input.rs

1use crate::records::bc_inst::BcInst;
2use crate::records::bytecode_graph_parser::BytecodeGraphParser;
3use luaur_common::enums::luau_opcode::LuauOpcode;
4use luaur_common::functions::is_fast_call::is_fast_call;
5use luaur_common::macros::luau_assert::LUAU_ASSERT;
6
7impl<'a> BytecodeGraphParser<'a> {
8    pub fn add_jump_input(&mut self, inst: *mut BcInst, target: i32) {
9        let inst = unsafe { &mut *inst };
10        LUAU_ASSERT!(!is_fast_call(inst.op));
11        if target < 0 {
12            LUAU_ASSERT!(inst.op == LuauOpcode::LOP_LOADB);
13            return;
14        }
15        let target = target as u32;
16        let it = self.block_by_pc.find(&target);
17        LUAU_ASSERT!(it.is_some());
18        let bc_op = *it.unwrap();
19        inst.ops.push(bc_op);
20    }
21}