Skip to main content

luaur_bytecode/records/
call_inliner.rs

1use crate::records::bc_call_fb::BcCallFB;
2use crate::records::bc_function::BcFunction;
3use crate::records::bc_move::BcMove;
4use crate::records::bc_op::BcOp;
5use crate::records::bc_op_hash::BcOpHash;
6use crate::type_aliases::reg::Reg;
7use alloc::vec::Vec;
8use luaur_common::records::dense_hash_map::DenseHashMap;
9use luaur_common::records::dense_hash_set::DenseHashSet;
10
11#[derive(Debug)]
12pub struct CallInliner<'a> {
13    pub(crate) caller: &'a mut BcFunction,
14    pub(crate) target: &'a mut BcFunction,
15    pub(crate) call: BcCallFB<'a>,
16    pub(crate) call_params: Vec<BcOp>,
17    pub(crate) target_reg: Reg,
18
19    pub(crate) caller_blocks_size_before_inline: u32,
20    pub(crate) caller_inst_size_before_inline: u32,
21    pub(crate) caller_vm_const_size_before_inline: u32,
22    pub(crate) caller_proto_size_before_inline: u32,
23    pub(crate) caller_up_val_size_before_inline: u8,
24
25    pub(crate) return_ops: Vec<BcOp>,
26    pub(crate) call_projections: DenseHashSet<BcOp, BcOpHash>,
27    pub(crate) var_arg_moves: DenseHashMap<BcOp, Vec<BcOp>, BcOpHash>,
28}
29
30impl<'a> CallInliner<'a> {
31    pub(crate) const K_MAX_INLINER_COMBINED_STACK_SIZE: u32 = 256;
32}