Skip to main content

luaur_code_gen/methods/
const_prop_state_const_prop_state.rs

1use crate::records::const_prop_state::ConstPropState;
2use crate::records::ir_builder::IrBuilder;
3use crate::records::ir_data::k_invalid_inst_idx;
4use crate::records::ir_function::IrFunction;
5use crate::records::ir_inst::IrInst;
6
7impl ConstPropState {
8    pub fn const_prop_state_const_prop_state(
9        build: &mut IrBuilder,
10        function: &mut IrFunction,
11    ) -> Self {
12        Self {
13            build: build as *mut IrBuilder,
14            function: function as *mut IrFunction,
15            regs: [crate::records::register_info::RegisterInfo::default(); 256],
16            max_reg: 0,
17            inst_pos: 0,
18            in_safe_env: false,
19            checked_gc: false,
20            inst_link: luaur_common::records::dense_hash_map::DenseHashMap::new(k_invalid_inst_idx),
21            inst_tag: luaur_common::records::dense_hash_map::DenseHashMap::new(k_invalid_inst_idx),
22            inst_value: luaur_common::records::dense_hash_map::DenseHashMap::new(
23                k_invalid_inst_idx,
24            ),
25            value_map: luaur_common::records::dense_hash_map::DenseHashMap::new(IrInst::default()),
26            upvalue_map: luaur_common::records::dense_hash_map::DenseHashMap::new(0xff),
27            hash_value_cache: luaur_common::records::dense_hash_map::DenseHashMap::new(
28                k_invalid_inst_idx,
29            ),
30            array_value_cache: alloc::vec::Vec::new(),
31            try_num_to_index_cache: alloc::vec::Vec::new(),
32            get_slot_node_cache: alloc::vec::Vec::new(),
33            check_slot_match_cache: alloc::vec::Vec::new(),
34            get_arr_addr_cache: alloc::vec::Vec::new(),
35            check_array_size_cache: alloc::vec::Vec::new(),
36            check_buffer_len_cache: alloc::vec::Vec::new(),
37            useradata_tag_cache: alloc::vec::Vec::new(),
38            buffer_load_store_info: alloc::vec::Vec::new(),
39            load_env_idx: k_invalid_inst_idx,
40            inst_not_readonly: luaur_common::records::dense_hash_set::DenseHashSet::new(
41                k_invalid_inst_idx,
42            ),
43            inst_no_metatable: luaur_common::records::dense_hash_set::DenseHashSet::new(
44                k_invalid_inst_idx,
45            ),
46            inst_array_size: luaur_common::records::dense_hash_map::DenseHashMap::new(
47                k_invalid_inst_idx,
48            ),
49            range_end_temp: alloc::vec::Vec::new(),
50        }
51    }
52}