luaur_code_gen/functions/log_perf_functions.rs
1use alloc::vec::Vec;
2use core::ffi::{c_char, c_void};
3
4use crate::functions::get_native_proto_exec_data_header_native_proto_exec_data_alt_b::get_native_proto_exec_data_header;
5use crate::functions::log_perf_function::log_perf_function;
6use crate::records::native_proto_exec_data_header::NativeProtoExecDataHeader;
7use crate::type_aliases::native_proto_exec_data_ptr::NativeProtoExecDataPtr;
8
9// NOTE: This is a native-only debug/perf logging hook.
10// The original C++ iterates over module protos and native protos, logging each function.
11// We preserve the null-check behavior on gPerfLogFn by checking the global flag.
12// The global gPerfLogFn and gPerfLogContext are defined elsewhere and accessed via FFlag-like globals.
13// Since the source uses a function pointer global, we model it as a static Option<fn> in luau-common.
14// However, the current luau-common does not expose gPerfLogFn as a Rust global.
15// To avoid a missing dependency, we keep this stub and assert if called.
16// The actual logging is conditional on gPerfLogFn being non-null; we cannot implement that here.
17//
18// This function is called from StandaloneCodeGenContext::bindModule and SharedCodeGenContext::bindModule.
19// It is native-only and not used in wasm builds.
20#[allow(non_snake_case)]
21pub(crate) fn log_perf_functions(
22 _moduleProtos: *const *mut c_void,
23 _moduleProtosLen: usize,
24 _nativeModuleBaseAddress: *const u8,
25 _nativeProtos: *const NativeProtoExecDataPtr,
26 _nativeProtosLen: usize,
27) {
28 // NOTE: This stub preserves the signature and avoids a link error.
29 // The real implementation would check gPerfLogFn and iterate the vectors.
30 // Since gPerfLogFn is not exposed as a Rust global, we cannot implement the full logic here.
31 // The caller (bindModule) is responsible for ensuring this is only called when gPerfLogFn is set.
32 // We do not panic here to avoid breaking builds where this hook is unused.
33 let _ = _moduleProtos;
34 let _ = _moduleProtosLen;
35 let _ = _nativeModuleBaseAddress;
36 let _ = _nativeProtos;
37 let _ = _nativeProtosLen;
38}