Skip to content

Commit

Permalink
add some more todos
Browse files Browse the repository at this point in the history
  • Loading branch information
ejrgilbert committed Nov 5, 2024
1 parent 175ef5d commit 0054a23
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/emitter/module_emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl<'a, 'b, 'c, 'd, 'e, 'f> ModuleEmitter<'a, 'b, 'c, 'd, 'e, 'f> {
let func = FunctionBuilder::new(params, results);
self.emitting_func = Some(func);

// TODO(alloc) -- load alloc vars
if self.map_lib_adapter.is_used {
let fid = self.map_lib_adapter.get_map_init_fid(self.app_wasm, err);
if let Some(func) = &mut self.emitting_func {
Expand All @@ -147,6 +148,7 @@ impl<'a, 'b, 'c, 'd, 'e, 'f> ModuleEmitter<'a, 'b, 'c, 'd, 'e, 'f> {
// emit the function body
self.emit_body(&[], block, err);

// TODO(alloc) -- save alloc vars
// emit the function
if let Some(func) = self.emitting_func.take() {
let fid = func.finish_module(self.app_wasm);
Expand Down
2 changes: 2 additions & 0 deletions src/generator/wizard/metadata_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ impl WhammVisitor<()> for WizardProbeMetadataCollector<'_, '_, '_> {
if *is_report {
self.curr_probe.incr_reports();
}
// change this to save off data to allocate
todo!()
}
Statement::Assign { var_id, expr, .. } => {
if let Expr::VarId { name, .. } = var_id {
Expand Down
2 changes: 1 addition & 1 deletion src/generator/wizard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ impl WizardGenerator<'_, '_, '_, '_, '_, '_, '_, '_, '_> {
let mut params = vec![];
let mut param_str = "".to_string();

// TODO(alloc) -- handle $alloc param (if there are alloc vars)
for (local_id, (param_name, param_ty)) in param_reqs.iter().enumerate() {
// handle param list
params.push(whamm_type_to_wasm_type(param_ty));
Expand Down Expand Up @@ -168,7 +169,6 @@ impl WizardGenerator<'_, '_, '_, '_, '_, '_, '_, '_, '_> {
}

fn visit_wiz_probe(&mut self, probe: &mut WizardProbe) {
// TODO -- handle provided functions (provider, package, event, probe)
self.set_curr_loc(self.create_curr_loc(probe));

let (pred_fid, pred_param_str) = if let Some(pred) = &mut probe.predicate {
Expand Down
5 changes: 5 additions & 0 deletions src/lang_features/alloc_vars/wizard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ pub fn load_alloc_vars(
_alloc_mem_offset: VarAddr,
_alloc_vars: Vec<(String, DataType)>,
) -> HashMap<String, (VarAddr, DataType)> {
// increment by bytes used by each var's DataType as we load them
// will be used to load the next variable AND to save in the VarAddr!
let _used_bytes = 0;

// alloc_mem_offset: parameter that specifies the result of calling $alloc (should be wasm local var)
// alloc_vars: Vec<(var_name, var_ty)>, in the order they should appear in memory starting at
// the offset `alloc_mem_offset`
// result: The new local variables: name -> (addr, ty)
// as a hashmap to enable caller to place in SymbolTable and handle report variables
// the new VarAddr will be a pointer into memory with an offset (real addr should be alloc_mem_offset + len_of_prev_vars)

// At start of probe logic, pull the current values of the 'alloc' variables from memory.
// Add these VarAddrs to the symbol table.
Expand Down

0 comments on commit 0054a23

Please sign in to comment.