luaur_analysis/methods/
txn_log_empty.rs1use crate::records::txn_log::TxnLog;
2use alloc::boxed::Box;
3use alloc::vec::Vec;
4use luaur_common::records::dense_hash_map::DenseHashMap;
5use std::sync::OnceLock;
6
7impl TxnLog {
8 pub fn empty() -> *const TxnLog {
9 static EMPTY_LOG: OnceLock<usize> = OnceLock::new();
10
11 *EMPTY_LOG.get_or_init(|| {
12 let mut log = Box::new(TxnLog {
13 type_var_changes: DenseHashMap::new(core::ptr::null()),
14 type_pack_changes: DenseHashMap::new(core::ptr::null()),
15 parent: core::ptr::null_mut(),
16 owned_seen: Vec::new(),
17 shared_seen: core::ptr::null_mut(),
18 radioactive: false,
19 });
20
21 log.shared_seen = &mut log.owned_seen;
22 Box::into_raw(log) as usize
23 }) as *const TxnLog
24 }
25}