pub(crate) struct SymbolCell(GcHeap<SymbolCellData>);
Expand description
The allocation of a global symbol. This is shared between threads, so the
interned value of a symbol will be the same location no matter which thread
interned it. Functions are safe to share between threads because they are
marked immutable by
SymbolMap::set_func
and they
can only be replaced atomically. In order to garbage collect the function we
need to halt all running threads. This has not been implemented yet.
Tuple Fields§
§0: GcHeap<SymbolCellData>
Implementations§
Source§impl SymbolCell
impl SymbolCell
const NULL: *mut u8 = {0x0 as *mut u8}
const EMTPTY: AtomicPtr<u8>
pub(crate) fn as_bytes(&self) -> &[u8] ⓘ
fn new_normal(name: &'static str, block: &Block<true>) -> Self
pub(in core) const fn new_static( name: &'static str, ) -> Self
pub(in core) const fn new_static_special( name: &'static str, ) -> Self
fn new_const(name: &'static str, _block: &Block<true>) -> Self
pub(in core) const fn new_static_const( name: &'static str, ) -> Self
fn new_uninterned<const C: bool>(name: &str, bk: &Block<C>) -> Self
pub(crate) fn name(&self) -> &str
pub(crate) fn interned(&self) -> bool
pub(crate) fn has_func(&self) -> bool
fn get(&self) -> Option<Gc<FunctionType<'_>>>
pub(crate) fn func<'a>( &self, _cx: &'a Context<'_>, ) -> Option<Gc<FunctionType<'a>>>
Sourcepub(crate) fn follow_indirect<'ob>(
&self,
cx: &'ob Context<'_>,
) -> Option<Gc<FunctionType<'ob>>>
pub(crate) fn follow_indirect<'ob>( &self, cx: &'ob Context<'_>, ) -> Option<Gc<FunctionType<'ob>>>
Follow the chain of symbols to find the function at the end, if any.
Sourcepub(in core) unsafe fn set_func(
&self,
func: Gc<FunctionType<'_>>,
) -> Result<()>
pub(in core) unsafe fn set_func( &self, func: Gc<FunctionType<'_>>, ) -> Result<()>
Set the function for this symbol. This function is unsafe to call and requires that the caller:
- Has marked the entire function as read only
- Has cloned the function into the
SymbolMap
block - Ensured the symbol is not constant
pub(crate) fn unbind_func(&self)
Trait Implementations§
Source§impl Debug for SymbolCell
impl Debug for SymbolCell
Source§impl Display for SymbolCell
impl Display for SymbolCell
Source§impl IntoObject for SymbolCell
impl IntoObject for SymbolCell
Source§impl PartialEq for SymbolCell
impl PartialEq for SymbolCell
Auto Trait Implementations§
impl !Freeze for SymbolCell
impl !RefUnwindSafe for SymbolCell
impl Send for SymbolCell
impl Sync for SymbolCell
impl Unpin for SymbolCell
impl UnwindSafe for SymbolCell
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more