Static allocations
This commit is contained in:
@@ -15,6 +15,8 @@ pub(crate) struct State {
|
||||
pub functions: BTreeMap<String, CompiledFn>,
|
||||
/// The string table
|
||||
pub strings: Vec<(Label, String)>,
|
||||
/// The statically-allocated buffers (size in bytes)
|
||||
pub buffers: Vec<(Label, usize)>,
|
||||
/// The functions that have been prototyped but not yet defined
|
||||
pub prototypes: Scope,
|
||||
}
|
||||
@@ -52,6 +54,12 @@ impl State {
|
||||
sym
|
||||
}
|
||||
|
||||
pub(crate) fn add_buffer(&mut self, size: usize) -> Label {
|
||||
let sym = self.gensym();
|
||||
self.buffers.push((sym.clone(), size));
|
||||
sym
|
||||
}
|
||||
|
||||
pub(crate) fn declare_function(&mut self, name: &str, _args: Vec<String>) -> Result<(), CompileError> {
|
||||
// If it's not already prototyped, gensym a label and put it in the list. If it is, just
|
||||
// ignore this (we don't check arity so it's not like the arglist being different matters)
|
||||
|
||||
Reference in New Issue
Block a user