Skip to main content

luaur_vm/macros/
lua_c_objbarrier.rs

1//! Source: `VM/src/lgc.h:109` (hand-ported)
2// #define luaC_objbarrier(L, p, o)
3//     { if (isblack(obj2gco(p)) && iswhite(obj2gco(o))) luaC_barrierf(L, obj2gco(p), obj2gco(o)); }
4// obj2gco on typed GC pointers is a plain cast in C.
5#[allow(non_snake_case)]
6#[macro_export]
7macro_rules! luaC_objbarrier {
8    ($L:expr, $p:expr, $o:expr) => {
9        if $crate::macros::isblack::isblack!($p as *mut $crate::records::gc_object::GCObject)
10            && $crate::macros::iswhite::iswhite!($o as *mut $crate::records::gc_object::GCObject)
11        {
12            $crate::functions::lua_c_barrierf::luaC_barrierf(
13                $L,
14                $p as *mut $crate::records::gc_object::GCObject,
15                $o as *mut $crate::records::gc_object::GCObject,
16            );
17        }
18    };
19}
20pub use luaC_objbarrier;
21#[allow(unused_imports)]
22pub use luaC_objbarrier as lua_c_objbarrier;