Struct oxischeme::heap::Heap
[-]
[+]
[src]
pub struct Heap { pub environment: Environment, // some fields omitted }
The scheme heap and GC runtime, containing all allocated cons cells, activations, procedures, and strings (including strings for symbols).
Fields
environment | The static environment. |
Methods
impl Heap
fn new() -> Heap
Create a new Heap
with the default capacity.
fn with_arenas(cons_cells: ArenaSet<Cons>, strings: ArenaSet<String>, acts: ArenaSet<Activation>, procs: ArenaSet<Procedure>) -> Heap
Create a new Heap
using the given arenas for allocating cons cells and
strings within.
impl Heap
fn allocate_cons(&mut self) -> RootedConsPtr
Allocate a new cons cell and return a pointer to it.
Panics
Panics if the Arena
for cons cells has already reached capacity.
fn allocate_string(&mut self) -> RootedStringPtr
Allocate a new string and return a pointer to it.
Panics
Panics if the Arena
for strings has already reached capacity.
fn allocate_activation(&mut self) -> RootedActivationPtr
Allocate a new Activation
and return a pointer to it.
Panics
Panics if the Arena
for activations has already reached capacity.
fn allocate_procedure(&mut self) -> RootedProcedurePtr
Allocate a new Procedure
and return a pointer to it.
Panics
Panics if the Arena
for procedures has already reached capacity.
impl Heap
fn collect_garbage(&mut self)
Perform a garbage collection on the heap.
fn add_root(&mut self, root: GcThing)
Explicitly add the given GC thing as a root.
fn drop_root<T: ToGcThing>(&mut self, root: &Rooted<T>)
Unroot a GC thing that was explicitly rooted with add_root
.
fn increase_gc_pressure(&mut self)
Apply pressure to the GC, and if enough pressure has built up, then perform a garbage collection.
impl Heap
fn global_activation(&mut self) -> RootedActivationPtr
Get the global activation.
fn with_extended_env<T>(&mut self, names: Vec<String>, block: &Fn(&mut Heap) -> T) -> T
Extend the environment with a new lexical block containing the given variables and then perform some work before popping the new block.
impl Heap
fn enlocate(&mut self, loc: Location, cons: RootedConsPtr)
Register the given pair as having originated from the given location.
fn locate(&self, cons: &RootedConsPtr) -> Location
Get the registered source location of the given pair. If the pair was not created by the reader, then None is returned.
impl Heap
fn get_or_create_symbol(&mut self, str: String) -> RootedValue
Ensure that there is an interned symbol extant for the given String
and return it.