Skip to main content

luaur_code_gen/records/
assembly_builder_x_64.rs

1use crate::enums::abix_64::ABIX64;
2use crate::enums::alignment_data_x_64::AlignmentDataX64;
3use crate::enums::condition_x_64::ConditionX64;
4use crate::enums::rounding_mode_x_64::RoundingModeX64;
5use crate::enums::size_x_64::SizeX64;
6use crate::records::label::Label;
7use crate::records::operand_x_64::OperandX64;
8use crate::records::register_x_64::RegisterX64;
9use alloc::string::String;
10use alloc::vec::Vec;
11use luaur_common::records::dense_hash_map::DenseHashMap;
12
13#[derive(Debug, Clone)]
14#[repr(C)]
15pub struct AssemblyBuilderX64 {
16    pub data: Vec<u8>,
17    pub code: Vec<u8>,
18    pub text: String,
19    pub log_text: bool,
20    pub abi: ABIX64,
21    pub features: u32,
22    pub(crate) next_label: u32,
23    pub(crate) pending_labels: Vec<Label>,
24    pub(crate) label_locations: Vec<u32>,
25    pub(crate) const_cache_32: DenseHashMap<u32, i32>,
26    pub(crate) const_cache_64: DenseHashMap<u64, i32>,
27    pub(crate) finalized: bool,
28    pub(crate) data_pos: usize,
29    pub(crate) code_pos: *mut u8,
30    pub(crate) code_end: *mut u8,
31    pub(crate) instruction_count: u32,
32}
33
34impl AssemblyBuilderX64 {
35    pub fn get_label_offset(&self, label: &Label) -> u32 {
36        luaur_common::LUAU_ASSERT!(label.location != !0u32);
37        label.location
38    }
39}