You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
693 B

use faerie::{Artifact, Decl};
/// Declares data segment symbol
pub fn declare_table(obj: &mut Artifact, index: usize) -> Result<(), String> {
let name = format!("_table_{}", index);
obj.declare(
name,
Decl::Data {
writable: false,
global: false,
},
)
.map_err(|err| format!("{}", err))?;
Ok(())
}
/// Emit segment data and initialization location
pub fn emit_table(obj: &mut Artifact, index: usize) -> Result<(), String> {
let name = format!("_table_{}", index);
// FIXME: We need to initialize table using function symbols
obj.define(name, Vec::new())
.map_err(|err| format!("{}", err))?;
Ok(())
}