Expand description
Object model of lean.h: object layouts, allocation, reference counting, boxing and
constructor objects.
The layouts are the ones of lean.h on a 64-bit machine. Reference counting is
single-threaded: m_rc > 0 is the count, m_rc == 0 marks a persistent object (inc/dec are
no-ops), and negative counts are never created. With debug_assertions a freed object has
its count set to FREED_RC and its memory is kept for a while, so that a later
increment, decrement or field access of it panics.
Re-exports§
pub use crate::panic::lean_internal_panic;pub use crate::panic::lean_internal_panic_out_of_memory;pub use crate::panic::lean_internal_panic_rc_overflow;pub use crate::panic::lean_internal_panic_unreachable;
Structs§
- Array
Object - Closure
Object - Ctor
Object - External
Class lean_external_class.- External
Object - MpzObject
- A big natural number or integer (
mpz_object), holding anum-bigintvalue. - Object
- Header of every heap object (
lean_object). - RefObject
- SArray
Object - String
Object - Task
Object - Tasks run synchronously when they are created, so
m_impis always null andm_valueis set. - Thunk
Object
Constants§
- FREED_
RC - Reference count written into a freed object when
debug_assertionsare enabled. - LEAN_
ARRAY - LEAN_
CLOSURE - LEAN_
EXTERNAL - LEAN_
LINEAR_ MARK_ MASK - Linearity marker bit in
m_otherof arrays, scalar arrays and strings. - LEAN_
MAX_ CTOR_ TAG - LEAN_
MPZ - LEAN_
PROMISE - LEAN_
REF - LEAN_
RESERVED - LEAN_
SCALAR_ ARRAY - LEAN_
STRING - LEAN_
STRUCT_ ARRAY - LEAN_
TASK - LEAN_
THUNK
Functions§
- debug_
check_ ⚠live - Panics (with
debug_assertions) ifois a freed object. - lean_
alloc_ ⚠ctor - Allocates a constructor object; the object fields are left for
lean_ctor_set, the scalar area is zeroed. - lean_
alloc_ ⚠external - lean_
alloc_ ⚠object - Allocates
szbytes for an object (lean_alloc_object). The header is not initialized. - lean_
alloc_ ⚠ref - lean_
alloc_ ⚠small_ object - lean_
array_ ⚠cptr - lean_
box - lean_
box_ ⚠float - lean_
box_ ⚠float32 - lean_
box_ ⚠uint32 - lean_
box_ ⚠uint64 - lean_
box_ ⚠usize - lean_
closure_ ⚠arg_ cptr - lean_
ctor_ ⚠get - lean_
ctor_ ⚠get_ float - Reads a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠get_ float32 - Reads a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠get_ uint8 - Reads a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠get_ uint16 - Reads a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠get_ uint32 - Reads a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠get_ uint64 - Reads a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠get_ usize - lean_
ctor_ ⚠num_ objs - lean_
ctor_ ⚠obj_ cptr - lean_
ctor_ ⚠release - lean_
ctor_ ⚠scalar_ cptr - lean_
ctor_ ⚠set - lean_
ctor_ ⚠set_ float - Writes a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠set_ float32 - Writes a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠set_ tag - lean_
ctor_ ⚠set_ uint8 - Writes a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠set_ uint16 - Writes a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠set_ uint32 - Writes a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠set_ uint64 - Writes a scalar field at
offsetbytes from the start of the object fields. - lean_
ctor_ ⚠set_ usize - lean_
dealloc ⚠ - Returns the memory block of an object of
szbytes to the allocator. - lean_
dec ⚠ - lean_
dec_ ⚠ref - lean_
dec_ ⚠ref_ cold - Frees
o(whose count dropped to zero) and every object only reachable from it, with an explicit work list instead of recursion (lean_del). - lean_
del_ ⚠object - Frees the memory of
ounless it is a scalar (delin the IR). - lean_
free_ ⚠object - Frees the memory of an object without touching its fields (
lean_free_object). - lean_
free_ ⚠small_ object - lean_
get_ ⚠external_ class - lean_
get_ ⚠external_ data - lean_
has_ ⚠rc - lean_
inc ⚠ - lean_
inc_ ⚠n - lean_
inc_ ⚠ref - lean_
inc_ ⚠ref_ n - lean_
is_ ⚠array - lean_
is_ ⚠closure - lean_
is_ ⚠ctor - lean_
is_ ⚠exclusive - lean_
is_ ⚠exclusive_ obj - lean_
is_ ⚠external - lean_
is_ ⚠mpz - lean_
is_ ⚠persistent - lean_
is_ ⚠ref - lean_
is_ ⚠sarray - lean_
is_ scalar - lean_
is_ ⚠shared - lean_
is_ ⚠st - lean_
is_ ⚠string - lean_
is_ ⚠task - lean_
is_ ⚠thunk - lean_
mark_ ⚠mt - lean_
mark_ ⚠persistent - Marks
oand every object reachable from it as persistent (RC 0). - lean_
nonzero_ ⚠rc - lean_
obj_ ⚠tag - lean_
object_ ⚠byte_ size - Size in bytes of the memory block of an object (
lean_object_byte_size). - lean_
ptr_ addr - lean_
ptr_ ⚠other - lean_
ptr_ ⚠tag - lean_
sarray_ ⚠elem_ size - lean_
set_ ⚠external_ data - lean_
set_ ⚠non_ heap_ header lean_set_non_heap_header: persistent header (RC 0).- lean_
set_ ⚠st_ header lean_set_st_header: single-threaded header with RC 1.- lean_
unbox - lean_
unbox_ ⚠float - lean_
unbox_ ⚠float32 - lean_
unbox_ ⚠uint32 - lean_
unbox_ ⚠uint64 - lean_
unbox_ ⚠usize
Type Aliases§
- Obj
- A Lean value: a pointer to a heap object, or a scalar
(n << 1) | 1.