luaur-code-gen 0.1.0

Native (A64/X64) code generation for Luau (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::functions::destroy_native_proto_exec_data::destroy_native_proto_exec_data;
use crate::functions::get_native_proto_exec_data_header_native_proto_exec_data_alt_b::get_native_proto_exec_data_header;
use crate::records::standalone_code_gen_context::StandaloneCodeGenContext;
use core::ffi::c_void;
use luaur_common::FFlag;

impl StandaloneCodeGenContext {
    pub fn standalone_code_gen_context_on_destroy_function(execdata: *mut c_void) {
        unsafe {
            if FFlag::LuauCodegenFreeBlocks.get() {
                let header = get_native_proto_exec_data_header(execdata as *const u32);
                (*header).native_module.as_ref().unwrap().release();
            } else {
                destroy_native_proto_exec_data(execdata as *mut u32);
            }
        }
    }
}