Skip to main content

Compiler

Struct Compiler 

Source
pub struct Compiler {
Show 40 fields pub bytecode: *mut BytecodeBuilder, pub options: CompileOptions, pub functions: DenseHashMap<*mut AstExprFunction, Function>, pub locals: DenseHashMap<*mut AstLocal, Local>, pub globals: DenseHashMap<AstName, Global>, pub variables: DenseHashMap<*mut AstLocal, Variable>, pub constants: DenseHashMap<*mut AstExpr, Constant>, pub locstants: DenseHashMap<*mut AstLocal, Constant>, pub table_constants: DenseHashMap<*mut AstLocal, TableConstantKind>, pub table_shapes: DenseHashMap<*mut AstExprTable, TableShape>, pub builtins: DenseHashMap<*mut AstExprCall, i32>, pub userdata_types: DenseHashMap<AstName, u8>, pub function_types: DenseHashMap<*mut AstExprFunction, String>, pub local_types: DenseHashMap<*mut AstLocal, LuauBytecodeType>, pub expr_types: DenseHashMap<*mut AstExpr, LuauBytecodeType>, pub inline_builtins: DenseHashMap<*mut AstExprCall, i32>, pub inline_builtins_backup: DenseHashMap<*mut AstExprCall, i32>, pub expr_changes: Vec<ExprConstantChange>, pub local_changes: Vec<LocalConstantChange>, pub builtin_types: BuiltinAstTypes, pub names: *mut AstNameTable, pub export_table_local: AstLocal, pub builtins_fold: *const DenseHashMap<*mut AstExprCall, i32>, pub builtins_fold_library_k: bool, pub reg_top: u32, pub stack_size: u32, pub arg_count: usize, pub has_loops: bool, pub current_function: *mut AstExprFunction, pub block_depth: usize, pub getfenv_used: bool, pub setfenv_used: bool, pub local_stack: Vec<*mut AstLocal>, pub upvals: Vec<*mut AstLocal>, pub loop_jumps: Vec<LoopJump>, pub loops: Vec<Loop>, pub inline_frames: Vec<InlineFrame>, pub captures: Vec<Capture>, pub exported_locals: Vec<*mut AstLocal>, pub exported_classes: Vec<(AstName, u8)>,
}

Fields§

§bytecode: *mut BytecodeBuilder§options: CompileOptions§functions: DenseHashMap<*mut AstExprFunction, Function>§locals: DenseHashMap<*mut AstLocal, Local>§globals: DenseHashMap<AstName, Global>§variables: DenseHashMap<*mut AstLocal, Variable>§constants: DenseHashMap<*mut AstExpr, Constant>§locstants: DenseHashMap<*mut AstLocal, Constant>§table_constants: DenseHashMap<*mut AstLocal, TableConstantKind>§table_shapes: DenseHashMap<*mut AstExprTable, TableShape>§builtins: DenseHashMap<*mut AstExprCall, i32>§userdata_types: DenseHashMap<AstName, u8>§function_types: DenseHashMap<*mut AstExprFunction, String>§local_types: DenseHashMap<*mut AstLocal, LuauBytecodeType>§expr_types: DenseHashMap<*mut AstExpr, LuauBytecodeType>§inline_builtins: DenseHashMap<*mut AstExprCall, i32>§inline_builtins_backup: DenseHashMap<*mut AstExprCall, i32>§expr_changes: Vec<ExprConstantChange>§local_changes: Vec<LocalConstantChange>§builtin_types: BuiltinAstTypes§names: *mut AstNameTable§export_table_local: AstLocal§builtins_fold: *const DenseHashMap<*mut AstExprCall, i32>§builtins_fold_library_k: bool§reg_top: u32§stack_size: u32§arg_count: usize§has_loops: bool§current_function: *mut AstExprFunction§block_depth: usize§getfenv_used: bool§setfenv_used: bool§local_stack: Vec<*mut AstLocal>§upvals: Vec<*mut AstLocal>§loop_jumps: Vec<LoopJump>§loops: Vec<Loop>§inline_frames: Vec<InlineFrame>§captures: Vec<Capture>§exported_locals: Vec<*mut AstLocal>§exported_classes: Vec<(AstName, u8)>

Implementations§

Source§

impl Compiler

Source

pub fn alloc_reg(&mut self, node: *mut AstNode, count: u32) -> u8

Source§

impl Compiler

Source

pub fn always_terminates(&self, node: *mut AstStat) -> bool

Source§

impl Compiler

Source

pub fn are_locals_captured(&mut self, start: usize) -> bool

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn at_top_level(&self) -> bool

Source§

impl Compiler

Source

pub fn can_import(&self, expr: *mut AstExprGlobal) -> bool

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn check_constant(&mut self, constant: i32, location: &Location)

Source§

impl Compiler

Source

pub fn check_exported_local( &mut self, local: *mut AstLocal, location: &Location, )

Source§

impl Compiler

Source

pub fn close_locals(&mut self, start: usize)

Source§

impl Compiler

Source

pub fn compile_assign( &mut self, lv: &LValue, source: u8, target_expr: *mut AstExpr, )

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn compile_compare_jump( &mut self, expr: *mut AstExprBinary, not_: bool, ) -> usize

Source§

impl Compiler

Source

pub fn compile_condition_value( &mut self, node: *mut AstExpr, target: *const u8, skip_jump: &mut Vec<usize>, only_truth: bool, )

Source§

impl Compiler

Source

pub fn compile_export_table(&mut self)

Source§

impl Compiler

Source

pub fn compile_expr( &mut self, node: *mut AstExpr, target: u8, target_temp: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_and_or( &mut self, expr: *mut AstExprBinary, target: u8, target_temp: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_auto( &mut self, node: *mut AstExpr, _rs: &mut RegScope, ) -> u8

Source§

impl Compiler

Source

pub fn compile_expr_binary( &mut self, expr: *mut AstExprBinary, target: u8, _target_temp: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_call( &mut self, expr: *mut AstExprCall, target: u8, target_count: u8, target_top: bool, mult_ret: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_constant( &mut self, node: *mut AstExpr, cv: &Constant, target: u8, )

Source§

impl Compiler

Source

pub fn compile_expr_fastcall_n( &mut self, expr: *mut AstExprCall, target: u8, target_count: u8, target_top: bool, mult_ret: bool, regs: u8, bfid: i32, bf_k: i32, )

Source§

impl Compiler

Source

pub fn compile_expr_function(&mut self, expr: *mut AstExprFunction, target: u8)

Source§

impl Compiler

Source

pub fn compile_expr_if_else( &mut self, expr: *mut AstExprIfElse, target: u8, target_temp: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_if_else_and_or( &mut self, and_: bool, creg: u8, other: *mut AstExpr, target: u8, )

Source§

impl Compiler

Source

pub fn compile_expr_index_expr( &mut self, expr: *mut AstExprIndexExpr, target: u8, )

Source§

impl Compiler

Source

pub fn compile_expr_index_name( &mut self, expr: *mut AstExprIndexName, target: u8, target_temp: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_interp_string( &mut self, expr: *mut AstExprInterpString, target: u8, target_temp: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_list_temp( &mut self, list: &AstArray<*mut AstExpr>, target: u8, target_count: u8, target_top: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_select_vararg( &mut self, expr: *mut AstExprCall, target: u8, target_count: u8, target_top: bool, mult_ret: bool, regs: u8, )

Source§

impl Compiler

Source

pub fn compile_expr_side(&mut self, node: *mut AstExpr)

Source§

impl Compiler

Source

pub fn compile_expr_table( &mut self, expr: *mut AstExprTable, target: u8, target_temp: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_temp(&mut self, node: *mut AstExpr, target: u8)

Source§

impl Compiler

Source

pub fn compile_expr_temp_mult_ret( &mut self, node: *mut AstExpr, target: u8, ) -> bool

Source§

impl Compiler

Source

pub fn compile_expr_temp_n( &mut self, node: *mut AstExpr, target: u8, target_count: u8, target_top: bool, )

Source§

impl Compiler

Source

pub fn compile_expr_temp_top(&mut self, node: *mut AstExpr, target: u8)

Source§

impl Compiler

Source

pub fn compile_expr_unary(&mut self, expr: *mut AstExprUnary, target: u8)

Source§

impl Compiler

Source

pub fn compile_expr_varargs( &mut self, expr: *mut AstExprVarargs, target: u8, target_count: u8, mult_ret: bool, )

Source§

impl Compiler

Source

pub fn compile_function( &mut self, func: *mut AstExprFunction, protoflags: &mut u8, ) -> u32

Source§

impl Compiler

Source

pub fn compile_inline_return( &mut self, stat: *mut AstStatReturn, _fallthrough: bool, )

Source§

impl Compiler

Source

pub fn compile_inlined_call( &mut self, expr: *mut AstExprCall, func: *mut AstExprFunction, target: u8, target_count: u8, )

Source§

impl Compiler

Source

pub fn compile_l_value( &mut self, node: *mut AstExpr, rs: &mut RegScope, ) -> LValue

Source§

impl Compiler

Source

pub fn compile_l_value_index( &mut self, reg: u8, index: *mut AstExpr, rs: &mut RegScope, ) -> LValue

Source§

impl Compiler

Source

pub fn compile_l_value_use( &mut self, lv: &LValue, reg: u8, set: bool, target_expr: *mut AstExpr, )

Source§

impl Compiler

Source

pub fn compile_stat(&mut self, node: *mut AstStat)

Source§

impl Compiler

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn compile_stat_for(&mut self, stat: *mut AstStatFor)

Source§

impl Compiler

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn compile_stat_if(&mut self, stat: *mut AstStatIf)

Source§

impl Compiler

Source§

impl Compiler

Source§

impl Compiler

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn compile_unrolled_for( &mut self, stat: *mut AstStatFor, trip_count: i32, from: f64, step: f64, )

Source§

impl Compiler

Source

pub fn compiler( bytecode: &mut BytecodeBuilder, options: &CompileOptions, names: &mut AstNameTable, ) -> Compiler

Source§

impl Compiler

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn emit_load_k(&mut self, target: u8, cid: i32)

Source§

impl Compiler

Source

pub fn encode_hash_size(hash_size: u32) -> u8

Source§

impl Compiler

Source

pub fn ensure_export_table(&mut self, node: *mut AstNode)

Source§

impl Compiler

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn get_binary_op_arith( &mut self, op: AstExprBinaryOp, k: bool, ) -> LuauOpcode

Source§

impl Compiler

Source

pub fn get_constant(&mut self, node: *mut AstExpr) -> Constant

Source§

impl Compiler

Source

pub fn get_constant_index(&mut self, node: *mut AstExpr) -> i32

Source§

impl Compiler

Source

pub fn get_constant_number(&mut self, node: *mut AstExpr) -> i32

Source§

impl Compiler

Source

pub fn get_export_table_reg(&mut self, node: *mut AstNode) -> u8

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn get_expr_local_reg(&mut self, node: *mut AstExpr) -> i32

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn get_jump_op_compare( &mut self, op: AstExprBinaryOp, not_: bool, ) -> LuauOpcode

Source§

impl Compiler

Source

pub fn get_local_reg(&mut self, local: *mut AstLocal) -> i32

Source§

impl Compiler

Source

pub fn get_unary_op(&mut self, op: AstExprUnaryOp) -> LuauOpcode

Source§

impl Compiler

Source

pub fn get_upval(&mut self, local: *mut AstLocal) -> u8

Source§

impl Compiler

Source

pub fn hint_temporary_expr_reg_type( &mut self, expr: *mut AstExpr, reg: i32, expected_type: LuauBytecodeType, inst_length: i32, )

Source§

impl Compiler

Source

pub fn hint_temporary_reg_type( &mut self, expr: *mut AstExpr, reg: i32, expected_type: LuauBytecodeType, inst_length: i32, )

Source§

impl Compiler

Source

pub fn is_condition_fast(&mut self, node: *mut AstExpr) -> bool

Source§

impl Compiler

Source

pub fn is_constant(&mut self, node: *mut AstExpr) -> bool

Source§

impl Compiler

Source

pub fn is_constant_false(&mut self, node: *mut AstExpr) -> bool

Source§

impl Compiler

Source

pub fn is_constant_integer(&mut self, node: *mut AstExpr) -> bool

Source§

impl Compiler

Source

pub fn is_constant_true(&mut self, node: *mut AstExpr) -> bool

Source§

impl Compiler

Source

pub fn is_constant_vector(&mut self, node: *mut AstExpr) -> bool

Source§

impl Compiler

Source

pub fn is_expr_mult_ret(&mut self, node: *mut AstExpr) -> bool

Source§

impl Compiler

Source

pub fn is_stat_break(&mut self, node: *mut AstStat) -> bool

Source§

impl Compiler

Source

pub fn needs_coverage(&mut self, node: *mut AstNode) -> bool

Source§

impl Compiler

Source

pub fn patch_jump(&mut self, node: *mut AstNode, label: usize, target: usize)

Source§

impl Compiler

Source

pub fn patch_jumps( &mut self, node: *mut AstNode, labels: &mut Vec<usize>, target: usize, )

Source§

impl Compiler

Source

pub fn patch_loop_jumps( &mut self, node: *mut AstNode, old_jumps: usize, end_label: usize, cont_label: usize, )

Source§

impl Compiler

Source

pub fn pop_locals(&mut self, start: usize)

Source§

impl Compiler

Source

pub fn push_local(&mut self, local: *mut AstLocal, reg: u8, allocpc: u32)

Source§

impl Compiler

Source

pub fn reg_scope_compiler(&mut self) -> RegScope

Source§

impl Compiler

Source

pub fn reg_scope_compiler_i32(&mut self, top: u32) -> RegScope

Source§

impl Compiler

Source

pub fn resolve_assign_conflicts( &mut self, stat: *mut AstStat, vars: &mut Vec<Assignment>, values: &AstArray<*mut AstExpr>, )

Source§

impl Compiler

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn set_debug_line_location(&mut self, location: &Location)

Source§

impl Compiler

Source

pub fn set_debug_line_end(&mut self, node: *mut AstNode)

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn try_compile_inlined_call( &mut self, expr: *mut AstExprCall, func: *mut AstExprFunction, target: u8, target_count: u8, mult_ret: bool, threshold_base: i32, threshold_max_boost: i32, depth_limit: i32, ) -> bool

Source§

impl Compiler

Source

pub fn try_compile_unrolled_for( &mut self, stat: *mut AstStatFor, threshold_base: i32, threshold_max_boost: i32, ) -> bool

Source§

impl Compiler

Source§

impl Compiler

Source§

impl Compiler

Source

pub fn unroll_concats(&mut self, args: &mut Vec<*mut AstExpr>)

Source§

impl Compiler

Source

pub fn validate_continue_until( &mut self, cont: *mut AstStat, condition: *mut AstExpr, body: *mut AstStatBlock, start: usize, )

Source§

impl Compiler

Source

pub fn visitor_visitor(&mut self) -> Visitor

Source§

impl Compiler

Source

pub fn compile_expr_global(&mut self, expr: *mut AstExprGlobal, target: u8)

Trait Implementations§

Source§

impl Debug for Compiler

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.